def main(): # Set working directory, relatively, to root of project this_path = os.path.abspath(os.path.dirname(__file__)) this_path += '/../' os.chdir(this_path) # Instantiate UI Application()
def startapp(): if platform.system() == 'Windows': #from .__init__ import set_locale set_locale() else: pass #Gtk.threads_init() install_gettext("sanaviron") if '--debug' in sys.argv: import gc gc.enable() gc.set_debug(gc.DEBUG_LEAK) print(get_summary()) sys.path.append(os.path.dirname(os.path.abspath(__file__))) from ui.application import Application application = Application() if '--sample' in sys.argv: application.editor.canvas.load_from_xml(os.path.join("..", "examples", "invoice.xml")) application.run()
import sys import traceback logging.config.fileConfig("logging.conf") logger = logging.getLogger(__name__) logger.info("Application started.") def exception_handler(etype, value, tb): # TODO: Add pyqt warning dialog # "A critical error has occured. You may keep using the software # but utilization may be degraded. Restart of the Makura Reader is # recommended." or something to that effect logger.critical("Uncaught exception.\n --------------%s------------" % "".join(traceback.format_exception(etype,value,tb))) sys.excepthook = exception_handler tokenizer = tests.text.mock_tokenizer.MockTokenizer() recognizer = tests.ocr.mock_recognizer.MockRecognizer() history = history.History(**config.history_config) recorder = recorder.Recorder(**config.recorder_config) reader = makura_reader.MakuraReader(recognizer, tokenizer, recorder, history) app = QApplication([]) wrapper = Application(reader) wrapper.start() app.exec_() logger.info("Application stopped.") logger.info("--------------------")
from tester.tester import Tester from ui.application import Application from controller.controller import Controller from repository.repository import Repository with open("database.txt", "r") as f: t = Tester() repo = Repository() controller = Controller(repo, f) app = Application(controller, repo) app.run()
import tkinter as tk from ui.application import Application from utils.constants import CONST_APP_TITLE root = tk.Tk() root.title(CONST_APP_TITLE) app = Application(master=root) app.mainloop()