Mercurial > pyarq-presupuestos
diff pyArq-Presupuestos.py @ 23:65e7ae0d0e63
GTK2 to GTK3
author | Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es> |
---|---|
date | Thu, 02 May 2019 16:31:17 +0200 |
parents | 2a13413dcc13 |
children | 16f91684686b |
line wrap: on
line diff
--- a/pyArq-Presupuestos.py Tue Sep 30 17:16:50 2014 +0200 +++ b/pyArq-Presupuestos.py Thu May 02 16:31:17 2019 +0200 @@ -3,7 +3,7 @@ ## File presupuestos.py ## This file is part of pyArq-Presupuestos. ## -## Copyright (C) 2010 Miguel Ángel Bárcena Rodríguez +## Copyright (C) 2010-2019 Miguel Ángel Bárcena Rodríguez ## <miguelangel@obraencurso.es> ## ## pyArq-Presupuestos is free software: you can redistribute it and/or modify @@ -21,10 +21,11 @@ # Modules import sys +import getopt import gettext # pyArq-Presupuestos modules +from Generic import win32Locale from Generic import globalVars -from Generic import win32Locale def _take_APPDATA_path(): # take path to find mo file @@ -40,18 +41,45 @@ _dir = globalVars.path["APPDATA"] + "/mo/" if sys.platform == 'win32': win32Locale.check_win32_locale() - gettext.install(_app, _dir, unicode=1) + kwargs = {} + if sys.version_info < (3,): + kwargs['unicode'] = True + gettext.install(_app, _dir, **kwargs) -def _run_gui(): +def _run_gtk(): + print("Iniciando interfaz Gtk3.") + from Gtk import gui + _app = gui.App() + _app.run(sys.argv) + +def _run_gui(argumentList): """def _run_gui Shows main window and starts the GTK+ event processing loop. """ - from Gtk import gui - _window = gui.MainWindow() + unixOptions = "h" + gnuOptions = ["help"] + # import before transtale + from Generic import base + + help = base.help + try: + arguments, values = getopt.getopt(argumentList, unixOptions, gnuOptions) + if len(arguments) > 0: + for currentArgument, currentValue in arguments: + if currentArgument in ("-h", "--help"): + print(help) + break + else: + _run_gtk() + else: + _run_gtk() + except getopt.error as err: + # output error + print (str(err)) # Run pyArq-Presupuestos if __name__ == "__main__": _take_APPDATA_path() _translate() - _run_gui() + _run_gui(sys.argv[1:])