def conf_session(self): """This can be selected by the user to select both a different user and a different car. It does so by going back to the Login Dialog. """ from LoginDialog import LoginDialog login = LoginDialog(self.obd_path, self.data) self.close() login.exec_()
def main(): app = QApplication(sys.argv) while True: loginDialog = LoginDialog() if loginDialog.exec() == LoginDialog.Rejected: return db, userName, password = loginDialog.result() try: database = Database(db, userName, password) break except WrongUserPass as e: QMessageBox.warning(None, "Error", "Wrong username or password") continue except Exception as e: QMessageBox.warning(None, "Error", "Failed to open database: \n" + str(e)) return config = Configuration() config.addRecentDB(db) wnd = MainWindow(database) wnd.show() res = app.exec_() try: config.save() except Exception as e: print("Error: %s" % str(e)) return res
def login(self): sender = self.sender() login = LoginDialog(parent=self, pop3=self.pop3, parentWindow=main) self.loginButton.hide() login.show() if not login.exec_(): self.statusBar().showMessage('Log in cancelled')
def main(): app = QApplication(sys.argv) dialog = LoginDialog() if dialog.exec_(): mainWindow = MainUI() mainWindow.setUsername(dialog.username) mainWindow.show() sys.exit(app.exec_())
def login_dialog(self): global app if (self.maya_enabled): app = QtGui.QApplication(sys.argv) login = LoginDialog() login.show() time.sleep(0.02) app.exec_() return login.getLoginDetails()
def login_dialog(self): global app if(self.maya_enabled): app = QtGui.QApplication(sys.argv) login = LoginDialog() login.show() time.sleep(0.02) app.exec_() return login.getLoginDetails()
def main(): app = QtGui.QApplication(sys.argv) logging.info("Absolute app root: '%s'", AppSettings.APP_ABS_ROOT) # set application icon app.setWindowIcon(QtGui.QIcon(AppSettings.APP_ICON_PATH)) # create neccessary paths if missing ifNotExCreate(AppSettings.TMP_PATH) ifNotExCreate(AppSettings.BACKUP_PATH) ifNotExCreate(AppSettings.DATA_PATH) ifNotExCreate(AppSettings.DB_PATH) ifNotExCreate(AppSettings.ICONS_PATH) # preapare languages AppSettings.writeLanguage("sk") AppSettings.LANG = AppSettings.readLanguage() TransController.loadTranslation("sk") TransController.loadTranslation("en") # DB controller instance db_con = DbController() # login dialog instance login_dialog = LoginDialog(db_con) db_path = AppSettings.readDbFilePath() logging.info("DB path: '%s'", db_path) if (not os.path.exists(AppSettings.decodePath(db_path))): # if default DB file doesnt exists, run create DB dialog login_dialog.enLogIn(False) else: # leave only last 10 backups backups = sorted(os.listdir(AppSettings.BACKUP_PATH), reverse=True) if len(backups) >= 10: for i in range(9, len(backups)): os.remove(AppSettings.BACKUP_PATH + backups[i]) # first backup database backup_file = AppSettings.BACKUP_PATH + time.strftime("%Y-%m-%dT%H:%M:%S_", time.localtime()) + os.path.basename(db_path) logging.info("backup file: '%s'", backup_file) shutil.copyfile(AppSettings.decodePath(db_path), AppSettings.decodePath(backup_file)) login_dialog.show() w = MainWindow(db_con) # when succesfully logged load main window login_dialog.signalSuccessfullyLogged.connect(w.setUserReloadShow) sys.exit(app.exec_())
def check_GPS_show_users(self): """GPS FIX""" #Sets flat 'show user list button' so that the user knows the #software is still working."" self.ui.pushButtonUserList.setFlat(True) self.ui.pushButtonUserList.setText(u"Espere al FIX del GPS...") #R-pi GPSD needs to be disabled as well: """Raspbian default install already features a gpsd daemon of its own. We will be calling it on demand so it needs to be disabled due to compatibility issues, as both instances cannot be running at once.""" os.system('sudo systemctl stop gpsd.socket') os.system('sudo systemctl disable gpsd.socket') """ Communication with the GPS device takes place using the agps3 library, available through pip. This library acts as an interface to parse the raw data provided by the gpsd daemon. In order to get the data a GPS fix (i.e. a working satellite link) is required. """ try: gpsd_socket = agps3.GPSDSocket() #Opens a 'socket' form which #can be polled data_stream = agps3.DataStream() #Opens a new data stream #inside the socket gpsd_socket.connect() #Links to the socket. gpsd_socket.watch() #Watches the socket for changes. #Tries to grab an object from the data stream. #If no new objects are found inside the data stream, an #exception is issued warning the user to check the gps link. #If there's a working link but no fix, then the gps device #will be repeatedly polled until success. #Meanwhile, the user is instructed to wait patiently. for new_data in gpsd_socket: if new_data: data_stream.unpack(new_data) if data_stream.lat != 'n/a': break except (OSError, IOError): mb = QtGui.QMessageBox(u'Advertencia', u'Compruebe la conexión del GPS', QtGui.QMessageBox.Warning, QtGui.QMessageBox.Ok, 0, 0) mb.setWindowFlags(QtCore.Qt.FramelessWindowHint) mb.setAttribute(QtCore.Qt.WA_DeleteOnClose, True) # delete dialog on close mb.exec_() #prevent focus loss raise SystemExit #No gps device found -- QUIT #Now a login dialog object is created with all the #collected user data as an argument from LoginDialog import LoginDialog login = LoginDialog(self.obd_path, self.data) self.close() #closes login dialog login.exec_() #keeps focus on loginion dialog
def __init__(self): self.window = Tk() self.window["bg"] = self.BACKGROUND self.window.title(APP_NAME) self.window.minsize(700, 550) tksupport.install(self.window) self.window.protocol("WM_DELETE_WINDOW", self.application_quit) self.createMenu() selectionGet = self.window.selection_get self.client = Client(self, selectionGet) self.client.pack() self.factory = pb.PBClientFactory() self.window.wait_visibility() self.logindialog = LoginDialog(self.window, self.loginSuccess, self.application_quit, REMOTE_SERVER, self.PORTNO, self.factory, self.client.cc) reactor.callWhenRunning(self.logindialog.run) reactor.run()
def link_admin_click(self, **event_args): """This method is called when the link is clicked""" user = anvil.users.get_user() if user is not None and user['email'] == '*****@*****.**': open_form('Admin') else: d = LoginDialog() choice = alert(d) if 1: if app_tables.admins.get( Email=d.email_box.text) and app_tables.admins.get( Password=d.password_box.text): open_form('Admin') else: alert( 'Password and email are invalid.This link is only for Admin' )
def login_with_form(allow_cancel=True): """Log in by popping up the custom LoginDialog""" d = LoginDialog() BUTTONS = [("Log in", "login", "primary")] if allow_cancel: BUTTONS += [("Cancel", None)] while anvil.users.get_user() is None: choice = anvil.alert(d, title="Log In", dismissible=allow_cancel, buttons=BUTTONS) if choice == 'login': try: anvil.users.login_with_email(d.email_box.text, d.password_box.text, remember=True) except anvil.users.EmailNotConfirmed: d.confirm_lnk.visible = True except anvil.users.AuthenticationFailed as e: d.login_err_lbl.text = str(e.args[0]) d.login_err_lbl.visible = True elif choice == 'reset_password': fp = ForgottenPasswordDialog(d.email_box.text) if anvil.alert(fp, title='Forgot Password', buttons=[("Reset password", True, "primary"), ("Cancel", False)]): if anvil.server.call('_send_password_reset', fp.email_box.text): anvil.alert("A password reset email has been sent to %s." % fp.email_box.text) else: anvil.alert("That username does not exist in our records.") elif choice == 'confirm_email': if anvil.server.call('_send_email_confirm_link', d.email_box.text): anvil.alert("A new confirmation email has been sent to %s." % d.email_box.text) else: anvil.alert("'%s' is not an unconfirmed user account." % d.email_box.text) d.confirm_lnk.visible = False elif choice is None and allow_cancel: break
def __init__(self): Gtk.Window.__init__(self, title="Cloud Disk") self.set_border_width(10) self.maximize() #Setting up the self.grid in which the elements are to be positionned self.grid = Gtk.Grid() self.grid.set_column_homogeneous(True) self.grid.set_row_homogeneous(True) self.add(self.grid) #box = Gtk.Box(spacing=6) #self.add(box) self.tokens = auth.index() self.bdstoken, self.sign1, self.sign3, self.timestamp = self.tokens #self.connect('activate', self.on_login_dialog_close) #self.connect("delete-event", Gtk.main_quit) if not self.bdstoken: dialog = LoginDialog(self) #dialog.connect("close",self.on_login_dialog_close) response = dialog.run() dialog.destroy() if response == Gtk.ResponseType.DELETE_EVENT: print(response) print("quit") #self.close() self.destroy() return elif response == 11: print("login") else: return self.down_list = [] self.current_path = "/" self.current_selection = None ## num,pix,filename,size,path,isdir,fsid,cate,spath,speed,progress,status # 0 1 2 3 4 5 6 7 8 9 10 11 self.liststore = Gtk.ListStore(int, GdkPixbuf.Pixbuf, str, str, str, int, str, int, str, str, int, str) self.current_list = [] #self.loading_spin = Gtk.Spinner() #self.loading_spin.props.valign = Gtk.Align.CENTER #box.pack_start(self.loading_spin, False, False, 0) #self.grid.add(self.loading_spin) self.init_view(self.current_path) #self.spinn.hide() #list_json = cloudapi.list_path(self.current_path,500,settings.DRY,self.bdstoken) #logger.debug("list json: %s"%str(len(list_json)) #file_list = cloudapi.get_list(list_json) #logger.debug("file_list: %s"%str(file_list)) #self.populate_view(file_list) self.stop_gif = False #creating the treeview, making it use the filter as a model, and adding the columns self.treeview = Gtk.TreeView(model=self.liststore) for i, column_title in enumerate( ["Num", "Thumb", "File", "Size", "Path"]): if column_title != "Thumb": renderer = Gtk.CellRendererText() column = Gtk.TreeViewColumn(column_title, renderer, text=i) else: renderer_pixbuf = Gtk.CellRendererPixbuf() column = Gtk.TreeViewColumn(column_title, renderer_pixbuf, pixbuf=i) #if not column_title == 'isdir' and not column_title == 'fsid' and not column_title == 'cate' : self.treeview.append_column(column) self.treeview.props.activate_on_single_click = False self.treeview.connect("row-activated", self.on_row_double_click) self.selection = self.treeview.get_selection() self.selection.connect("changed", self.on_tree_selection_changed) self.selection.set_mode(Gtk.SelectionMode.MULTIPLE) #select = selection.get_selected_rows() #creating buttons to filter by programming language, and setting up their events self.buttons = list() for act in [ "Up level", "Refresh View", "Batch Add Task", "Remove File", "Download", "CleanUp", "Search" ]: button = Gtk.Button(act) self.buttons.append(button) funcname = "on_%s_button_clicked" % act.lower().replace(" ", "_") print(funcname) func = getattr(self, funcname) button.connect("clicked", func) #setting up the layout, putting the treeview in a scrollwindow, and the buttons in a row self.scrollable_treelist = Gtk.ScrolledWindow() self.scrollable_treelist.set_vexpand(True) #self.grid.attach(self.loading_spin, 0, 0, 10, 20) #self.grid.attach_next_to(self.scrollable_treelist,self.loading_spin, Gtk.PositionType.BOTTOM, 10, 23) self.grid.attach(self.scrollable_treelist, 0, 0, 8, 20) #box.pack_start(self.scrollable_treelist, True, True, 0) self.grid.attach_next_to(self.buttons[0], self.scrollable_treelist, Gtk.PositionType.BOTTOM, 1, 1) for i, button in enumerate(self.buttons[1:]): self.grid.attach_next_to(button, self.buttons[i], Gtk.PositionType.RIGHT, 1, 1) #self.add_action_widget(self.buttons[i],i+1) #box.pack_start(self.buttons[i], False, False, 0) self.scrollable_treelist.add(self.treeview) #box.show_all() self.grid.show_all()
msg = {} msg["cmd"] = 'send_control_code' code = '{:04X}'.format(code) # 十进制控制代码转十六进制 msg['machine_number'] = "%d" % machine_number msg['code'] = "%s" % code message.append(msg) if __name__ == '__main__': app = QApplication([]) # 初始化应用 # # 检查是否需要验证产品密钥 # login_dial = LoginDialog() if login_dial.check() or login_dial.exec_(): # # 显示界面 # main_window = MainWindow() # 创建主窗口 # main_window.ui.show() # 按实际大小显示窗口 main_window.ui.showMaximized() # 全屏显示窗口,必须要用,不然不显示界面 # # 子线程启动 # serial_worker = SerialWorker(main_window) serial_worker.start() check_worker = CheckWorker(main_window) check_worker.start()
def login(): dialog = LoginDialog() if dialog.exec_(): return True else: return False
def __init__(self): Gtk.Window.__init__(self, title="Cloud Disk") self.set_border_width(10) self.maximize() #Setting up the self.grid in which the elements are to be positionned self.grid = Gtk.Grid() self.grid.set_column_homogeneous(True) self.grid.set_row_homogeneous(True) self.add(self.grid) #box = Gtk.Box(spacing=6) #self.add(box) self.tokens = auth.index() self.bdstoken,self.sign1,self.sign3,self.timestamp = self.tokens #self.connect('activate', self.on_login_dialog_close) #self.connect("delete-event", Gtk.main_quit) if not self.bdstoken: dialog = LoginDialog(self) #dialog.connect("close",self.on_login_dialog_close) response = dialog.run() dialog.destroy() if response == Gtk.ResponseType.DELETE_EVENT: print(response) print("quit") #self.close() self.destroy() return elif response == 11: print("login") else: return self.down_list = [] self.current_path = "/" self.current_selection = None ## num,pix,filename,size,path,isdir,fsid,cate,spath,speed,progress,status # 0 1 2 3 4 5 6 7 8 9 10 11 self.liststore = Gtk.ListStore(int,GdkPixbuf.Pixbuf,str, str, str,int,str,int,str,str,int,str) self.current_list = [] #self.loading_spin = Gtk.Spinner() #self.loading_spin.props.valign = Gtk.Align.CENTER #box.pack_start(self.loading_spin, False, False, 0) #self.grid.add(self.loading_spin) self.init_view(self.current_path) #self.spinn.hide() #list_json = cloudapi.list_path(self.current_path,500,settings.DRY,self.bdstoken) #logger.debug("list json: %s"%str(len(list_json)) #file_list = cloudapi.get_list(list_json) #logger.debug("file_list: %s"%str(file_list)) #self.populate_view(file_list) self.stop_gif = False #creating the treeview, making it use the filter as a model, and adding the columns self.treeview = Gtk.TreeView(model=self.liststore) for i, column_title in enumerate(["Num","Thumb","File", "Size", "Path"]): if column_title != "Thumb": renderer = Gtk.CellRendererText() column = Gtk.TreeViewColumn(column_title, renderer, text=i) else: renderer_pixbuf = Gtk.CellRendererPixbuf() column = Gtk.TreeViewColumn(column_title, renderer_pixbuf,pixbuf=i) #if not column_title == 'isdir' and not column_title == 'fsid' and not column_title == 'cate' : self.treeview.append_column(column) self.treeview.props.activate_on_single_click = False self.treeview.connect("row-activated",self.on_row_double_click) self.selection = self.treeview.get_selection() self.selection.connect("changed", self.on_tree_selection_changed) self.selection.set_mode(Gtk.SelectionMode.MULTIPLE) #select = selection.get_selected_rows() #creating buttons to filter by programming language, and setting up their events self.buttons = list() for act in ["Up level", "Refresh View", "Batch Add Task", "Remove File", "Download","CleanUp","Search"]: button = Gtk.Button(act) self.buttons.append(button) funcname = "on_%s_button_clicked"%act.lower().replace(" ","_") print(funcname) func = getattr(self, funcname) button.connect("clicked", func) #setting up the layout, putting the treeview in a scrollwindow, and the buttons in a row self.scrollable_treelist = Gtk.ScrolledWindow() self.scrollable_treelist.set_vexpand(True) #self.grid.attach(self.loading_spin, 0, 0, 10, 20) #self.grid.attach_next_to(self.scrollable_treelist,self.loading_spin, Gtk.PositionType.BOTTOM, 10, 23) self.grid.attach(self.scrollable_treelist, 0, 0, 8, 20) #box.pack_start(self.scrollable_treelist, True, True, 0) self.grid.attach_next_to(self.buttons[0], self.scrollable_treelist, Gtk.PositionType.BOTTOM, 1, 1) for i, button in enumerate(self.buttons[1:]): self.grid.attach_next_to(button, self.buttons[i], Gtk.PositionType.RIGHT, 1, 1) #self.add_action_widget(self.buttons[i],i+1) #box.pack_start(self.buttons[i], False, False, 0) self.scrollable_treelist.add(self.treeview) #box.show_all() self.grid.show_all()
def show_login_dialog(self): username, password, ok = LoginDialog.run() if ok: self.onLogin.emit(username, password)
def __init__(self, parent=None): super(PlayerGui, self).__init__(parent) self.player = None self.loginDialog = LoginDialog(self) self.loginDialog.show()
class PlayerGui(Gui): buzzed = pyqtSignal() """ ***REIMPLEMENTED METHODS FROM BASECLASS*** These work similarly to the ones in AdminGui. For more information, check those. """ def __init__(self, parent = None): super(PlayerGui, self).__init__(parent) self.player = None self.loginDialog = LoginDialog(self) self.loginDialog.show() def setupGui(self, buttonText, width, height): Gui.setupGui(self, buttonText, width, height) self.setLabelText(self.player.name) def startGame(self): self.player = self.loginDialog.player self.loginDialog.close() self.setupGui('Buzz', self.player.game.getWidth(), self.player.game.getHeight()) for i in self.player.game.getUsedQuestions(): self.getGridButton(i).setEnabled(False) self.show() self.gameStarted.emit() self.player.game.gameStarted() def setupTable(self): table = PlayerTable(['Nickname', 'Score'], '') for player in self.player.game.getPlayers(): table.addPlayer(player) return table def setupSignals(self): self.gameStarted.connect(self.player.setupGuiSignals) self.getDisplayButton().clicked.connect(self.player.buzz) def displayQuestion(self, i): Gui.displayQuestion(self, i) if self.player.game.getStatus(self.player.name) != 'Muted': self.getDisplayButton().setEnabled(True) def getRound(self): return self.player.game.getRound() def getQuestion(self): return self.player.game.getQuestion() def getTemplate(self): return self.player.template def getTempPath(self): return self.player.tempPath def getScores(self): return self.player.game.getScores() """ The player's status is displayed above the PlayerTable. {Waiting,Selecting, Answering} -> [:-3] """ def updateStatus(self, status): self.log('Updating ' + self.player.name + ' status to ' + status) self.player.status = status if status == 'Muted': self.setLabelText('Muted') else: self.setLabelText(status[:-3]) def disableBuzz(self): self.getDisplayButton().setEnabled(False)
def loginSlot(self): res = LoginDialog().work() if res: self.tabWidget.setEnabled(True) self.label_2.setText("欢迎登陆," + res)
def __init__(self, parent = None): super(PlayerGui, self).__init__(parent) self.player = None self.loginDialog = LoginDialog(self) self.loginDialog.show()
class PlayerGui(Gui): buzzed = pyqtSignal() """ ***REIMPLEMENTED METHODS FROM BASECLASS*** These work similarly to the ones in AdminGui. For more information, check those. """ def __init__(self, parent=None): super(PlayerGui, self).__init__(parent) self.player = None self.loginDialog = LoginDialog(self) self.loginDialog.show() def setupGui(self, buttonText, width, height): Gui.setupGui(self, buttonText, width, height) self.setLabelText(self.player.name) def startGame(self): self.player = self.loginDialog.player self.loginDialog.close() self.setupGui('Buzz', self.player.game.getWidth(), self.player.game.getHeight()) for i in self.player.game.getUsedQuestions(): self.getGridButton(i).setEnabled(False) self.show() self.gameStarted.emit() self.player.game.gameStarted() def setupTable(self): table = PlayerTable(['Nickname', 'Score'], '') for player in self.player.game.getPlayers(): table.addPlayer(player) return table def setupSignals(self): self.gameStarted.connect(self.player.setupGuiSignals) self.getDisplayButton().clicked.connect(self.player.buzz) def displayQuestion(self, i): Gui.displayQuestion(self, i) if self.player.game.getStatus(self.player.name) != 'Muted': self.getDisplayButton().setEnabled(True) def getRound(self): return self.player.game.getRound() def getQuestion(self): return self.player.game.getQuestion() def getTemplate(self): return self.player.template def getTempPath(self): return self.player.tempPath def getScores(self): return self.player.game.getScores() """ The player's status is displayed above the PlayerTable. {Waiting,Selecting, Answering} -> [:-3] """ def updateStatus(self, status): self.log('Updating ' + self.player.name + ' status to ' + status) self.player.status = status if status == 'Muted': self.setLabelText('Muted') else: self.setLabelText(status[:-3]) def disableBuzz(self): self.getDisplayButton().setEnabled(False)
class Login: PORTNO = 10102 #BACKGROUND = "#c0a9cf" BACKGROUND = "#c098af" def __init__(self): self.window = Tk() self.window["bg"] = self.BACKGROUND self.window.title(APP_NAME) self.window.minsize(700, 550) tksupport.install(self.window) self.window.protocol("WM_DELETE_WINDOW", self.application_quit) self.createMenu() selectionGet = self.window.selection_get self.client = Client(self, selectionGet) self.client.pack() self.factory = pb.PBClientFactory() self.window.wait_visibility() self.logindialog = LoginDialog(self.window, self.loginSuccess, self.application_quit, REMOTE_SERVER, self.PORTNO, self.factory, self.client.cc) reactor.callWhenRunning(self.logindialog.run) reactor.run() def loginSuccess(self, avatar): self.client.setAvatar(avatar) #self.client.swb.focus_set() self.window.bind("<FocusIn>", lambda e: self.client.swb.focus_set()) df = avatar.callRemote("getWbServer") df.addCallback(self.gotRootObject) df2 = avatar.callRemote("whoami") df2.addCallback(self.updateMenu) df3 = avatar.callRemote("myName") df3.addCallback(self.client.setName) df3.addCallback(lambda a: self.setWindowStatus()) def setWindowStatus(self, desc=OUT): self.window.title(APP_NAME + " - " + self.client.name + " (" + statusMsg[desc] +")") def showRoomAdmin(self, event=None): self.client.showRooms() def showPostAdmin(self, event=None): self.client.showPost() def showQuestionAdmin(self, event=None): self.client.showQuestions() def showSubjectAdmin(self, event=None): self.client.showSubjects() def gotRootObject(self, root): self.client.setRoot(root) def createMenu(self): menubar = Menu(self.window) self.fileMenu = Menu(menubar, tearoff=0) self.fileMenu.add_command(label=_("Lista de aulas"), command=self.showRoomAdmin) self.fileMenu.add_command(label=_("Lista de materias"), command=self.showSubjectAdmin) self.fileMenu.add_separator() self.fileMenu.add_command(label=_("Imprimir")) self.fileMenu.add_separator() self.fileMenu.add_command(label=_("Salir"), command=self.application_quit) menubar.add_cascade(label=_("Archivo"), menu=self.fileMenu) self.editMenu = Menu(menubar, tearoff=0) menubar.add_cascade(label=_("Edicion"), menu=self.editMenu) self.emoticMenu = Menu(menubar, tearoff=0) menubar.add_cascade(label=_("Emoticonos"), menu=self.emoticMenu) self.symbolMenu = Menu(menubar, tearoff=0) menubar.add_cascade(label=_("Simbolos"), menu=self.symbolMenu) self.mathMenu = Menu(self.symbolMenu, tearoff=0) self.symbolMenu.add_cascade(label=_("Matematica"), menu=self.mathMenu) self.greekMenu = Menu(self.symbolMenu, tearoff=0) self.symbolMenu.add_cascade(label=_("Griego"), menu=self.greekMenu) self.helpMenu = Menu(menubar, tearoff=0) self.helpMenu.add_command(label=_("Manual de instrucciones"), command=self.showHelp) self.helpMenu.add_command(label=_("Acerca de..."), command=self.showAbout) menubar.add_cascade(label=_("Ayuda"), menu=self.helpMenu) self.linksMenu = Menu(menubar, tearoff=0) self.linksMenu.add_command(label=_("Links utiles"), command=self.showLinks) menubar.add_cascade(label=_("Links"), menu=self.linksMenu) self.window.config(menu=menubar) def showHelp(self): webbrowser.open(APP_URL + '/content/help.html', new=0) def showLinks(self): webbrowser.open(APP_URL + '/content/links.html', new=0) def showAbout(self): pass def updateMenu(self, whoami): if whoami == TUTOR: self.fileMenu.insert_command(1, label=_("Preguntas offline"), command=self.showQuestionAdmin) self.fileMenu.insert_command(2, label=_("Postprocesado de pizarras"), command=self.showPostAdmin) self.editMenu.add_command(label=_("Cortar"), accelerator="Ctrl-X", command=self.client.swb.wb.cutSelection) self.editMenu.add_command(label=_("Copiar"), accelerator="Ctrl-C", command=self.client.swb.wb.copySelection) self.editMenu.add_command(label=_("Pegar"), accelerator="Ctrl-V", command=self.client.swb.wb.paste) self.editMenu.add_separator() self.editMenu.add_command(label=_("Importar texto"), accelerator="Ctrl-B", command=self.client.swb.wb.pasteForeign) self._loadImgMenu(self.emoticMenu, EMOTIC) self._loadImgMenu(self.greekMenu, SYMBOL) self._loadImgMenu(self.mathMenu, MATH) def _loadImgMenu(self, menu, kind): first = self.client.swb.wb.imgs.firstKind(kind) q = self.client.swb.wb.imgs.getQKind(kind) for x in range(first, first + q): self._createImgOption(menu, x) def _createImgOption(self, menu, imgNumber): menu.add_command(image=self.client.swb.wb.imgs.getImg(imgNumber), command=lambda: self.client.swb.wb.putImg(imgNumber)) def application_quit(self, widget=None): if reactor.running: reactor.stop() self.logindialog.destroy() self.window.quit()