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()
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()
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()
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()
class GuiSync(): """There may be only one instance of this class, because of the slot declarations. """ def __init__(self, appString, filepath=None): self.app = Application(appString) self.settings = self.app.settings slot("%s-closeMainWindow" % appString, self.slot_tidy) self.sp = SyncPanel(self.settings) self.init(filepath) def init(self, filepath=None): self.gui = GuiWidget(self.settings) self.app.init(self.gui) self.sp.init(self.gui, filepath) def run(self): if self.sp and self.sp.filepath: #self.app.run() self.gui.exec_() def slot_tidy(self, arg): """Stuff to do when the program quits """ if self.sp: self.sp.disconnect() self.sp.closeFile()
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
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()
class GuiConnectInfo: def __init__(self, appString, user): self.app = Application(appString) self.settings = self.app.settings self.gui = GuiWidget(self.settings) #slot("%s-closeMainWindow" % appString, self.slot_tidy) self.app.init(self.gui) self.gui.init(user) def run(self): if not self.gui.exec_(): return None return { u"host" : self.gui.host, u"user" : self.gui.dbuser, u"pw" : self.gui.pw, u"db" : CONTROLDB }
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()
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()
class GuiConnectInfo: def __init__(self, appString, user): self.app = Application(appString) self.settings = self.app.settings self.gui = GuiWidget(self.settings) #slot("%s-closeMainWindow" % appString, self.slot_tidy) self.app.init(self.gui) self.gui.init(user) def run(self): if not self.gui.exec_(): return None return { u"host": self.gui.host, u"user": self.gui.dbuser, u"pw": self.gui.pw, u"db": CONTROLDB }