self.__opt_file = opt_file
def __fix_ini_parsing(self):
- #if len(self.__scenes_done) == 1 and not self.__scenes_done[0]:
- # self.__scenes_done = []
+ if len(self.__scenes_done) == 1 and not self.__scenes_done[0]:
+ self.__scenes_done = []
#print(self.__scenes_done)
#self.__scenes_done = self.__scenes_done[0]
if self.__scenes_done:
from direct.gui.OnscreenText import OnscreenText
from direct.showbase.DirectObject import DirectObject
from ya2.utils.cursor import MouseCursor
-from ya2.utils.gfx import GfxTools, DirectGuiMixin
+from ya2.utils.gfx import GfxTools, DirectGuiMixin, pos_pixel
class DirectOptionMenuTest(DirectOptionMenu):
info('enforced resolution: ' + val)
def _set_main(self):
- self._pos_mgr = {}
+ for k in list(self._pos_mgr.keys()): del self._pos_mgr[k]
self._widgets = []
self._widgets += [DirectButton(
text=_('Play'), pos=(0, 1, .6), command=self.on_play,
self.accept('enforce_resolution', self.enforce_res)
def _set_options(self):
- self._pos_mgr = {}
+ for k in list(self._pos_mgr.keys()): del self._pos_mgr[k]
self._widgets = []
self._lang_funcs = [lambda: _('English'), lambda: _('Italian')]
items = [fnc() for fnc in self._lang_funcs]
for tgt_res in ['1440x900', '1360x768']:
for btn in comps:
if btn['text'] == tgt_res:
- pos = btn.pos_pixel()
+ pos = pos_pixel(btn)
self._pos_mgr['res_' + tgt_res] = (pos[0] + 5, pos[1])
btn = DirectOptionMenuTest(
text=_('Resolution'), items=resolutions, initialitem=res,
self.accept('enforce_resolution', self.enforce_res)
def _set_credits(self):
- self._pos_mgr = {}
+ for k in list(self._pos_mgr.keys()): del self._pos_mgr[k]
self._widgets = []
tp_scale = TextProperties()
tp_scale.set_text_scale(.64)
self.accept('enforce_resolution', self.enforce_res)
def on_play(self):
- self._pos_mgr = {}
+ for k in list(self._pos_mgr.keys()): del self._pos_mgr[k]
self.destroy()
self._cursor = MouseCursor(
'assets/images/buttons/arrowUpLeft.dds', (.04, 1, .04), (.5, .5, .5, 1),
def __add_from_json_to_pot(self):
json_files = [name for name in listdir(self.__json_path)
if isfile(join(self.__json_path, name)) and
- name.endswith('.json')]
+ name.endswith('.json') and
+ name != 'index.json']
json_strings = []
for json_file in json_files:
with open(f'{self.__json_path}{json_file}') as f:
json = loads(f.read())
json_strings += [json['name']]
- for instruction_line in json['instructions']:
- json_strings += [instruction_line]
+ for instruction_line in json['instructions'].split('\n'):
+ if instruction_line:
+ json_strings += [instruction_line]
def process_json_escape(string):
return bytes(string, 'utf-8').decode('unicode-escape')
json_strings = [process_json_escape(s) for s in json_strings]