Merge pull request #787 from andkit/fix-761
Fix issues when starting portable from a non-ascii path (#761)
This commit is contained in:
commit
46812a96f6
15
extras/openslides_gui/gui.py
Normal file → Executable file
15
extras/openslides_gui/gui.py
Normal file → Executable file
@ -25,7 +25,8 @@ ungettext = lambda msg1, msg2, n: _translations.ungettext(msg1, msg2, n)
|
|||||||
|
|
||||||
|
|
||||||
def get_data_path(*args):
|
def get_data_path(*args):
|
||||||
return os.path.join(os.path.dirname(__file__), "data", *args)
|
path = openslides.main.fs2unicode(__file__)
|
||||||
|
return os.path.join(os.path.dirname(path), "data", *args)
|
||||||
|
|
||||||
|
|
||||||
class RunCmdEvent(wx.PyCommandEvent):
|
class RunCmdEvent(wx.PyCommandEvent):
|
||||||
@ -82,6 +83,15 @@ class RunCommandControl(wx.Panel):
|
|||||||
|
|
||||||
cmd = [sys.executable, "-u", "-m", "openslides.main"]
|
cmd = [sys.executable, "-u", "-m", "openslides.main"]
|
||||||
cmd.extend(args)
|
cmd.extend(args)
|
||||||
|
|
||||||
|
# XXX: subprocess on windows only handles byte strings
|
||||||
|
# with python3 this will hopefully no longer be the case
|
||||||
|
fs_encoding = sys.getfilesystemencoding() or sys.getdefaultencoding()
|
||||||
|
cmd = [
|
||||||
|
x.encode(fs_encoding) if isinstance(x, unicode) else x
|
||||||
|
for x in cmd
|
||||||
|
]
|
||||||
|
|
||||||
creationflags = getattr(subprocess, "CREATE_NEW_PROCESS_GROUP", 0)
|
creationflags = getattr(subprocess, "CREATE_NEW_PROCESS_GROUP", 0)
|
||||||
self.child_process = subprocess.Popen(
|
self.child_process = subprocess.Popen(
|
||||||
cmd, stdin=subprocess.PIPE, stdout=subprocess.PIPE,
|
cmd, stdin=subprocess.PIPE, stdout=subprocess.PIPE,
|
||||||
@ -682,7 +692,8 @@ def main():
|
|||||||
lang = locale.getdefaultlocale()[0]
|
lang = locale.getdefaultlocale()[0]
|
||||||
if lang:
|
if lang:
|
||||||
global _translations
|
global _translations
|
||||||
localedir = os.path.dirname(openslides.__file__)
|
localedir = openslides.main.fs2unicode(openslides.__file__)
|
||||||
|
localedir = os.path.dirname(localedir)
|
||||||
localedir = os.path.join(localedir, "locale")
|
localedir = os.path.join(localedir, "locale")
|
||||||
_translations = gettext.translation(
|
_translations = gettext.translation(
|
||||||
"django", localedir, [lang], fallback=True)
|
"django", localedir, [lang], fallback=True)
|
||||||
|
Loading…
Reference in New Issue
Block a user