ya2
·
news
·
projects
·
code
·
about
Ya2
/
projects
/
pmachines.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
|
inline
| side by side (parent:
f62d6fc
)
fixes for building
author
Flavio Calva
<f.calva@gmail.com>
Sat, 14 Jan 2023 07:41:15 +0000
(09:41 +0200)
committer
Flavio Calva
<f.calva@gmail.com>
Sat, 14 Jan 2023 07:41:15 +0000
(09:41 +0200)
pmachines/application/persistent.py
patch
|
blob
|
blame
|
history
pmachines/gui/menu.py
patch
|
blob
|
blame
|
history
pmachines/scene/scene.py
patch
|
blob
|
blame
|
history
ya2/build/lang.py
patch
|
blob
|
blame
|
history
ya2/utils/gfx.py
patch
|
blob
|
blame
|
history
diff --git
a/pmachines/application/persistent.py
b/pmachines/application/persistent.py
index 81bbc91fb24fc27e7e31645265a3e761d8671767..eba2f3946e4e8da558421d734452b51d713a5afe 100644
(file)
--- a/
pmachines/application/persistent.py
+++ b/
pmachines/application/persistent.py
@@
-9,8
+9,8
@@
class Persistent:
self.__opt_file = opt_file
def __fix_ini_parsing(self):
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:
#print(self.__scenes_done)
#self.__scenes_done = self.__scenes_done[0]
if self.__scenes_done:
diff --git
a/pmachines/gui/menu.py
b/pmachines/gui/menu.py
index 4fef839f33df48e058bba825a3ff4f0c724273d2..4bd88901ed09b52664fe33c89fa4ee14b7a7a48e 100644
(file)
--- a/
pmachines/gui/menu.py
+++ b/
pmachines/gui/menu.py
@@
-11,7
+11,7
@@
from direct.gui.DirectGuiGlobals import FLAT
from direct.gui.OnscreenText import OnscreenText
from direct.showbase.DirectObject import DirectObject
from ya2.utils.cursor import MouseCursor
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):
class DirectOptionMenuTest(DirectOptionMenu):
@@
-90,7
+90,7
@@
class Menu(DirectObject):
info('enforced resolution: ' + val)
def _set_main(self):
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._widgets = []
self._widgets += [DirectButton(
text=_('Play'), pos=(0, 1, .6), command=self.on_play,
@@
-121,7
+121,7
@@
class Menu(DirectObject):
self.accept('enforce_resolution', self.enforce_res)
def _set_options(self):
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]
self._widgets = []
self._lang_funcs = [lambda: _('English'), lambda: _('Italian')]
items = [fnc() for fnc in self._lang_funcs]
@@
-195,7
+195,7
@@
class Menu(DirectObject):
for tgt_res in ['1440x900', '1360x768']:
for btn in comps:
if btn['text'] == tgt_res:
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._pos_mgr['res_' + tgt_res] = (pos[0] + 5, pos[1])
btn = DirectOptionMenuTest(
text=_('Resolution'), items=resolutions, initialitem=res,
@@
-233,7
+233,7
@@
class Menu(DirectObject):
self.accept('enforce_resolution', self.enforce_res)
def _set_credits(self):
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._widgets = []
tp_scale = TextProperties()
tp_scale.set_text_scale(.64)
@@
-259,7
+259,7
@@
class Menu(DirectObject):
self.accept('enforce_resolution', self.enforce_res)
def on_play(self):
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),
self.destroy()
self._cursor = MouseCursor(
'assets/images/buttons/arrowUpLeft.dds', (.04, 1, .04), (.5, .5, .5, 1),
diff --git
a/pmachines/scene/scene.py
b/pmachines/scene/scene.py
index 287f84f2f73bc7cdbfe5436b330522c04eac1210..0343d895eb61d1e83c500a7377f59c38010f59ff 100644
(file)
--- a/
pmachines/scene/scene.py
+++ b/
pmachines/scene/scene.py
@@
-40,7
+40,7
@@
class Scene(DirectObject):
self._dbg_items = dbg_items
self._reload_cb = reload_cb
self._pos_mgr = pos_mgr
self._dbg_items = dbg_items
self._reload_cb = reload_cb
self._pos_mgr = pos_mgr
- self._pos_mgr = {}
+ for k in list(self._pos_mgr.keys()): del self._pos_mgr[k]
self._scenes = scenes
self._start_evt_time = None
self._enforce_result = ''
self._scenes = scenes
self._start_evt_time = None
self._enforce_result = ''
diff --git
a/ya2/build/lang.py
b/ya2/build/lang.py
index 7a67cc4b8fc0d16982a0717dcbc236cd715c0904..54fafdce1fc1e2f9d275272cb3827312c4c40c39 100644
(file)
--- a/
ya2/build/lang.py
+++ b/
ya2/build/lang.py
@@
-36,14
+36,16
@@
class LanguageBuilder:
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
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']]
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]
def process_json_escape(string):
return bytes(string, 'utf-8').decode('unicode-escape')
json_strings = [process_json_escape(s) for s in json_strings]
diff --git
a/ya2/utils/gfx.py
b/ya2/utils/gfx.py
index cadcaa857a53ff90c098751d973d978c8f8b5f22..a25365af7e7de34cb246031c7f4552fcb4a3a527 100755
(executable)
--- a/
ya2/utils/gfx.py
+++ b/
ya2/utils/gfx.py
@@
-94,6
+94,11
@@
class DirectGuiMixin():
DirectGuiMixin.registered_tooltips = []
DirectGuiMixin.registered_tooltips = []
+def pos_pixel(widget):
+ pos = widget.get_pos(pixel2d)
+ return int(round(pos[0])), int(round(-pos[2]))
+
+
class Point(Decorator):
def screen_coord(self):
class Point(Decorator):
def screen_coord(self):