Ejemplo n.º 1
0
class GuiPrint():
    """There may be only one instance of this class, because of the
    slot declarations.
    """
    def __init__(self, appString, file=None):
        self.app = Application(appString)
        self.settings = self.app.settings

        slot("%s-closeMainWindow" % appString, self.slot_tidy)

        # Prepare the print handler
        self.pView = PrintView()

        self.init(file)

    def init(self, file):
        """Subsequent invocations of the print application start by
        reinitializing the print handler here.
        """
        self.gui = GuiWidget(self.settings)
        self.app.init(self.gui)

        # Set up the print gui
        self.pView.init(self.gui, file)

    def run(self):
        self.app.run()

    def slot_tidy(self, arg):
        """Stuff to do when the program quits
        """
        if self.pView.printer:
            self.pView.printer.abort()
Ejemplo n.º 2
0
class GuiEditor:
    """There may be only one instance of this class, because of the
    slot declarations (in editorView.py and edit.py). At present there
    is no possibility of closing an editor and reopening it in the same
    process - the other files would need modifying.
    """
    def __init__(self, appString):
        self.app = Application(appString)
        self.settings = self.app.settings

        self.gui = GuiWidget(self.settings, self.app.clipboard())

        # Initialize the colour objects used by the editor
        coloursInit()

        self.app.init(self.gui)

        styleGroup = QtGui.QActionGroup(self.gui)
        styleGroup.addAction(self.gui.ui.action_styleN)
        styleGroup.addAction(self.gui.ui.action_styleS)
        styleGroup.addAction(self.gui.ui.action_styleSR)

        # Set up the editor gui
        self.edView = EditorView(self.gui)
        # Open a database and initialize the editor
        self.edView.slot_open(force=False)

    def run(self):
        if self.edView.db:
            self.app.run()
Ejemplo n.º 3
0
class GuiPrint():
    """There may be only one instance of this class, because of the
    slot declarations.
    """
    def __init__(self, appString, file=None):
        self.app = Application(appString)
        self.settings = self.app.settings

        slot("%s-closeMainWindow" % appString, self.slot_tidy)

        # Prepare the print handler
        self.pView = PrintView()

        self.init(file)

    def init(self, file):
        """Subsequent invocations of the print application start by
        reinitializing the print handler here.
        """
        self.gui = GuiWidget(self.settings)
        self.app.init(self.gui)

        # Set up the print gui
        self.pView.init(self.gui, file)

    def run(self):
        self.app.run()

    def slot_tidy(self, arg):
        """Stuff to do when the program quits
        """
        if self.pView.printer:
            self.pView.printer.abort()
Ejemplo n.º 4
0
class GuiEditor:
    """There may be only one instance of this class, because of the
    slot declarations (in editorView.py and edit.py). At present there
    is no possibility of closing an editor and reopening it in the same
    process - the other files would need modifying.
    """
    def __init__(self, appString):
        self.app = Application(appString)
        self.settings = self.app.settings

        self.gui = GuiWidget(self.settings, self.app.clipboard())

        # Initialize the colour objects used by the editor
        coloursInit()

        self.app.init(self.gui)

        styleGroup = QtGui.QActionGroup(self.gui)
        styleGroup.addAction(self.gui.ui.action_styleN)
        styleGroup.addAction(self.gui.ui.action_styleS)
        styleGroup.addAction(self.gui.ui.action_styleSR)

        # Set up the editor gui
        self.edView = EditorView(self.gui)
        # Open a database and initialize the editor
        self.edView.slot_open(force=False)

    def run(self):
        if self.edView.db:
            self.app.run()
Ejemplo n.º 5
0
class GuiConfigEd:
    """There may be only one instance of this class, because of the
    slot declarations.
    """
    def __init__(self, appString):
        self.app = Application(appString)
        self.settings = self.app.settings
        slot("%s-closeMainWindow" % appString, self.slot_tidy)
        self.cfed = ConfigEd(self.settings)

        self.init()

    def init(self):
        self.gui = GuiWidget(self.settings)
        self.gui.show()
        self.app.init(self.gui)
        self.gui.setup()
        self.cfed.init(self.gui)

    def run(self):
        self.app.run()

    def slot_tidy(self, arg):
        """Stuff to do when the program quits
        """
        self.cfed.save()
        signal("ced_done")

    def getSourcePath(self):
        return self.cfed.sourcePath

    def getErrorCount(self):
        return self.cfed.errorCount
Ejemplo n.º 6
0
def setup():
    # Initialize graphical interface, note that the same settings
    # group as the control panel is used.
    global app, gui
    app = Application("cp")

    gui = GuiDbInit(intro, go)
    app.run()
Ejemplo n.º 7
0
def setup():
    # Initialize graphical interface, note that the same settings
    # group as the control panel is used.
    global app, gui
    app = Application("cp")

    gui = GuiDbInit(intro, go)
    app.run()
Ejemplo n.º 8
0
class GuiGetApplication:
    def __init__(self, appString):
        self.app = Application(appString)

        self.settings = self.app.settings
        self.gui = GuiWidget(self.settings)

        self.app.init(self.gui)

    def run(self):
        self.app.run()
Ejemplo n.º 9
0
class GuiCP:
    """There may be only one instance of this class, because of the
    slot declarations.
    """
    def __init__(self, appString):
        self.app = Application(appString)
        self.settings = self.app.settings
        slot("%s-closeMainWindow" % appString, self.slot_tidy)
        self.cp = ControlPanel(self.settings)

        self.init()

    def init(self):
        self.db = None

        self.gui = GuiWidget(self.settings)
        self.gui.show()
        c0 = self.gui.cursor()
        self.gui.setCursor(QtGui.QCursor(QtCore.Qt.BusyCursor))

        # Connect to control database
        connectData = getConnectInfo(self.settings, ADMIN)
        if not connectData:
            return
        db = DB(connectData)
        self.gui.setCursor(c0)
        if not db.isOpen():
            error(_("Couldn't open control database"))
            return # actually error shouldn't return
        self.db = db

        self.app.init(self.gui)

        # set up lists of available databases, admins, users, etc.
        # and initialize the main module
        self.cp.init(self.gui, self.db)

    def run(self):
        if self.db:
            self.app.run()

    def slot_tidy(self, arg):
        """Stuff to do when the program quits
        """
        if self.db:
            self.db.close()
Ejemplo n.º 10
0
class GuiCP:
    """There may be only one instance of this class, because of the
    slot declarations.
    """
    def __init__(self, appString):
        self.app = Application(appString)
        self.settings = self.app.settings
        slot("%s-closeMainWindow" % appString, self.slot_tidy)
        self.cp = ControlPanel(self.settings)

        self.init()

    def init(self):
        self.db = None

        self.gui = GuiWidget(self.settings)
        self.gui.show()
        c0 = self.gui.cursor()
        self.gui.setCursor(QtGui.QCursor(QtCore.Qt.BusyCursor))

        # Connect to control database
        connectData = getConnectInfo(self.settings, ADMIN)
        if not connectData:
            return
        db = DB(connectData)
        self.gui.setCursor(c0)
        if not db.isOpen():
            error(_("Couldn't open control database"))
            return  # actually error shouldn't return
        self.db = db

        self.app.init(self.gui)

        # set up lists of available databases, admins, users, etc.
        # and initialize the main module
        self.cp.init(self.gui, self.db)

    def run(self):
        if self.db:
            self.app.run()

    def slot_tidy(self, arg):
        """Stuff to do when the program quits
        """
        if self.db:
            self.db.close()