Exemplo n.º 1
0
    def slot_print(self, arg):
        """Pass a database dump file (*.zgb) to the print applicataion.
        """
        dir0 = self.settings.getSetting("destDir")
        filepath = None
        if dir0:
            # See if there is already an adequately new dump file
            rex = re.compile(r"%s_(\d{8}_\d{6}).zgb$" % self.master.getName())
            dumpfiles = [f for f in os.listdir(dir0) if rex.match(f)]
            if dumpfiles:
                dumpfiles.sort()
                latest = dumpfiles[-1]
                dumptime = rex.match(latest).group(1)

                udt = self.master.readValue(u"config", u"updatetime")
                lst = self.master.readValue(u"interface", u"lastsynctime")

                if (dumptime > udt) and (dumptime > lst):
                    filepath = os.path.join(dir0, latest)

        if not filepath:
            dbpath = self.getDbDir("destDir")
            if not dbpath: return

            # Dump a full database
            filepath = self.dump(dbpath, u"")
            if not filepath:
                return

        # Start the printer dialog with this file.
        if self.printHandler:
            self.printHandler.init(filepath)
        else:
            self.printHandler = GuiPrint("print", filepath)
        self.printHandler.run()
Exemplo n.º 2
0
def slot_gotProg(prog):
    if (prog == "setup"):
        from dbInit import setup
        setup()
        return

    elif (prog == "control"):
        from guiCP import GuiCP
        # Initialize graphical interface
        gui = GuiCP("cp")

    elif (prog == "edit"):
        from guiEditor import GuiEditor
        # Initialize graphical interface
        gui = GuiEditor("editor")

    elif (prog == "sync"):
        from guiSync import GuiSync
        # See if a client database file has been passed on the command line
        filepath = None
        if (len(sys.argv) > 2):
            f = sys.argv[2]
            if f.endswith(".zgn"):
                filepath = f

        # Initialize graphical interface
        gui = GuiSync("sync", filepath)

    elif (prog == "print"):
        from guiPrint import GuiPrint
        # Initialize graphical interface
        gui = GuiPrint("print")

    elif (prog == "cfged"):
        from guiConfigEd import GuiConfigEd
        # Initialize graphical interface
        gui = GuiConfigEd("cfged")

    else:
        return

    # enter event loop
    gui.run()
Exemplo n.º 3
0
def start():
    # Initialize graphical interface
    gui = GuiPrint("print")

    # enter event loop
    gui.run()