def show_about(self): self.about = About() self.ui.mdiArea.addSubWindow(self.about) self.about.show_window()
class Main(QtGui.QMainWindow, Ui_MainWindow): #@+others #@+node:amd_yen.20130429221223.10911: *3* __init__ def __init__(self, parent=None): super(Main, self).__init__(parent) self.setupUi(self) self.sendMailwidget.hide() self.lineEdit_2.setEchoMode(True) # 訊號與 slot(動作) 的連結, 動作依靠回呼函式的呼叫執行 self.connect(self.actionSendMail, QtCore.SIGNAL('triggered()'), self.ShowsendMailwidget) self.connect(self.actionExit, QtCore.SIGNAL('triggered()'), QtCore.SLOT('close()')) self.connect(self.actionAbout, QtCore.SIGNAL('triggered()'), self.aboutMessage) self.connect(self.sendemailButton, QtCore.SIGNAL('clicked()'), self.sendMailaction) #@+node:amd_yen.20130429221223.10912: *3* ShowsendMailwidget def ShowsendMailwidget(self): self.sendMailwidget.show() #@+node:amd_yen.20130429221223.10913: *3* sendMailaction def sendMailaction(self): emptyfields = self.checkEmptyfields() if len(emptyfields) != 0: self.missing = Missing(emptyfields) self.missing.show() else: self.gmail = GMail(str(self.lineEdit.text()), str(self.lineEdit_2.text())) self.gmail.sendMail(str(self.lineEdit_3.text()), str(self.lineEdit_4.text()), str(self.textEdit.toPlainText())) self.widgetHide() #@+node:amd_yen.20130429221223.10914: *3* aboutMessage def aboutMessage(self): self.sendMailwidget.hide() self.about = About() self.about.show() #@+node:amd_yen.20130429221223.10915: *3* widgetHide def widgetHide(self): self.sendMailwidget.hide() #@+node:amd_yen.20130429221223.10916: *3* checkEmptyfields def checkEmptyfields(self): emptyfields = set([]) if len(self.lineEdit.text()) == 0: emptyfields.add("Your gmail") if len(self.lineEdit_2.text()) == 0: emptyfields.add("Your password") if len(self.lineEdit_3.text()) == 0: emptyfields.add("Receiver mail") if len(self.textEdit.toPlainText()) == 0: emptyfields.add("Your mail") return emptyfields
class mainWindow(QtWidgets.QMainWindow, userInterface): def __init__(self, pilot, parent=None): # Initialization main interface from QT to Python QtWidgets.QMainWindow.__init__(self, parent) # Variable self.setupUi(self) self.actionAbout.triggered.connect(self.About) self.actionTicket_info.triggered.connect(self.TicketInfo) self.actionUser_Payments_Info.triggered.connect(self.userPaymentGrid) self.actionList_Users.triggered.connect(self.ListOfUsers) labelpic = QLabel() pixmap = QPixmap('icon/ticket_background.png') pixmap = pixmap.scaledToWidth(611) labelpic.setPixmap(pixmap) labelpic.setFixedHeight(391) print(pilot) self.action_Exit.triggered.connect(self.exit) self.update_CurrentDateTime() def update_CurrentDateTime(self): now = datetime.datetime.now() self.label_datetime.setText(now.strftime("%Y-%m-%d %H:%M:%S")) def About(self): self.about = About(None) self.about.exec_() def TicketInfo(self): self.ticketinfo = TicketInfo(None) self.ticketinfo.exec_() def userPaymentGrid(self): self.userPaymentGrid = userPaymentGrid(None) self.userPaymentGrid.show() def ListOfUsers(self): self.ListOfUsers = ListOfUsers(None) self.ListOfUsers.show() def exit(self): quit_msg = "Are you sure you want to exit the program?" reply = QMessageBox.question(self, 'Message', quit_msg, QMessageBox.Yes, QMessageBox.No) if reply == QMessageBox.Yes: sys.exit() else: print("ignore close")
def enter_key_event(self): if self.cursor_position == self.SINGLE_PLAYER: game = Game(self.SINGLE_PLAYER) game.run() elif self.cursor_position == self.MULTI_PLAYER: game = Game(self.MULTI_PLAYER) game.run() elif self.cursor_position == self.OPTIONS: options = Options() options.run() elif self.cursor_position == self.ABOUT: about = About() about.run() elif self.cursor_position == self.EXIT: self.done = True
class Main(QtGui.QMainWindow, Ui_MainWindow): #@+others #@+node:amd_yen.20130429221223.10911: *3* __init__ def __init__(self,parent=None): super(Main,self).__init__(parent) self.setupUi(self) self.sendMailwidget.hide() self.lineEdit_2.setEchoMode(True) # 訊號與 slot(動作) 的連結, 動作依靠回呼函式的呼叫執行 self.connect(self.actionSendMail,QtCore.SIGNAL('triggered()'),self.ShowsendMailwidget) self.connect(self.actionExit,QtCore.SIGNAL('triggered()'),QtCore.SLOT('close()')) self.connect(self.actionAbout,QtCore.SIGNAL('triggered()'),self.aboutMessage) self.connect(self.sendemailButton,QtCore.SIGNAL('clicked()'),self.sendMailaction) #@+node:amd_yen.20130429221223.10912: *3* ShowsendMailwidget def ShowsendMailwidget(self): self.sendMailwidget.show() #@+node:amd_yen.20130429221223.10913: *3* sendMailaction def sendMailaction(self): emptyfields = self.checkEmptyfields() if len(emptyfields) !=0: self.missing = Missing(emptyfields) self.missing.show() else: self.gmail = GMail(str(self.lineEdit.text()),str(self.lineEdit_2.text())) self.gmail.sendMail(str(self.lineEdit_3.text()),str(self.lineEdit_4.text()),str(self.textEdit.toPlainText())) self.widgetHide() #@+node:amd_yen.20130429221223.10914: *3* aboutMessage def aboutMessage(self): self.sendMailwidget.hide() self.about = About() self.about.show() #@+node:amd_yen.20130429221223.10915: *3* widgetHide def widgetHide(self): self.sendMailwidget.hide() #@+node:amd_yen.20130429221223.10916: *3* checkEmptyfields def checkEmptyfields(self): emptyfields = set([]) if len(self.lineEdit.text())==0: emptyfields.add("Your gmail") if len(self.lineEdit_2.text())==0: emptyfields.add("Your password") if len(self.lineEdit_3.text())==0: emptyfields.add("Receiver mail") if len(self.textEdit.toPlainText())==0: emptyfields.add("Your mail") return emptyfields
def tools_combo_change(self, w): value = int(w.get_active()) if value == 0: self.ViewConfig() elif value == 1: self.choose_repo_path() elif value == 2: self.remove_config() elif value == 3: self.run_custom_device() elif value == 4: self.openBuildFolder() elif value == 5: InstallPackages().runInstall() elif value == 6: InstallPackages().repo() elif value == 7: self.change_background() elif value == 8: About().main() elif value == 9: self.remove_repo() else: pass
def menuAbout_activate(widget, data): if data.aboutDialog == None: data.aboutDialog = About() if data.aboutDialog.run() == RESPONSE_CANCEL: data.aboutDialog.hide()
def aboutAct(self): """Display info box.""" #QtWidgets.QMessageBox.information(self, 'About', ABOUT) about = About(self) about.exec_()
class StartQT5(QMainWindow): global irc_Connection #global server_OutputSorter global channelArray global channelWindow global _nick_ global app const_NONE=0 const_TILE=1 const_CASCADE=2 config="" _nick_="" _nick="" _version="0.5.0.2 ALPHA" statusWindow = "" _layout=const_NONE #PyQt5 Signals NickChange = QtCore.pyqtSignal(str) #Create and Empty array to hold the Channels in. channelArray=dict() def __init__(self,parent=None): global irc_Connection #global server_OutputSorter global channelWindow global _nick_ #scan the plugins. self.plugins=PluginArchitecture() QWidget.__init__(self,parent) self.ui = Ui_PyBirch() self.ui.setupUi(self) #Self is the main window. self.setWindowTitle("Py-Birch "+self._version) self.config = Properties() # self.config = configparser.ConfigParser(allow_no_value=True) # try: # if os.path.isfile("py-birch.cfg"): # self.config.read("py-birch.cfg") # except: # self.config.add_section("IRC_Server") # self.config.set("IRC_Server", "Server", "irc.dal.net") Gui = self #QtCore.QObject.connect(irc_Connection,QtCore.SIGNAL("incomming"),self.update_editorWindow); self.irc_Connection = IrcConnection(self.config) self.server_OutputSorter = ServerOutputSorter(self.config,self.plugins) self.channelArray = dict() #channelWindow = Channel() #self.ui.mdiArea.addSubWindow(channelWindow) #channelWindow.show() layout = QGridLayout() self.statusWindow = Channel("Status", self.config,self.plugins, Channel.STATUS) #self.ui.Status.setLayout(layout) self.ui.mdiArea.addSubWindow(self.statusWindow) #add a button to the button bar btn_Status = QtWidgets.QPushButton("Status") self.statusWindow.set_button(btn_Status) #btn_Status.resize(250, 250) button_bar_layout = self.ui.button_bar.layout() button_bar_layout.addWidget(btn_Status) # self.statusWindow.connect(btn_Status, QtCore.SIGNAL("clicked()"), self.statusWindow.button_click) btn_Status.clicked.connect(self.statusWindow.button_click) #Set Up Signals #self.setUpSignals() #self.ui.Status.setWindowTitle("Status") #self.ui.Status.show() #so who needs to know when a nickname is update. #PyQt4 Method #self.connect(self,QtCore.SIGNAL("NickChange"),self.nick_update) #self.connect(self,QtCore.SIGNAL("NickChange"),self.statusWindow.nick_update) #self.connect(self,QtCore.SIGNAL("NickChange"),self.irc_Connection.nick_update) self.NickChange.connect(self.nick_update) self.NickChange.connect(self.statusWindow.nick_update) self.NickChange.connect(self.irc_Connection.nick_update) #self.connect(self.statusWindow,QtCore.SIGNAL("UserInput"),self.send_to_server,2) self.statusWindow.UserInput.connect(self.send_to_server) #self.connect(self.irc_Connection,QtCore.SIGNAL("NickChange"), self.statusWindow.nick_update,2) self.irc_Connection.NickChange.connect(self.statusWindow.nick_update) #Qt::QueuedConnection = 2 #self.connect(self.irc_Connection,QtCore.SIGNAL("incomming"),self.update_editorWindow, 2) self.irc_Connection.Incomming.connect(self.update_editorWindow) #self.connect(self.irc_Connection,QtCore.SIGNAL("Status"),self.update_statusWindow, 2) self.irc_Connection.Status.connect(self.update_statusWindow) #self.connect(self.irc_Connection,QtCore.SIGNAL("NickChange"), self.nick_update, 2) self.irc_Connection.NickChange.connect(self.nick_update) #self.connect(self.irc_Connection,QtCore.SIGNAL("ProcessEvents"),self.process_gui_events,2) self.irc_Connection.ProcessEvents.connect(self.process_gui_events) #self.connect(self.irc_Connection, QtCore.SIGNAL("StatusBar"), self.statusBar) self.irc_Connection.StatusBar.connect(self.statusBar) #self.connect(self.irc_Connection, QtCore.SIGNAL("Disconnect"),self.disconnect,2) self.irc_Connection.Disconnect.connect(self.disconnect) #self.irc_Connection.connect(self.irc_Connection, QtCore.SIGNAL("NickChange"), self.irc_Connection.nick_update) #irc_Connection.connect(irc_Connection, QtCore.SIGNAL("NickChange"), self.nick_update) self.irc_Connection.NickChange.connect(self.irc_Connection.nick_update) #self.connect(self.server_OutputSorter,QtCore.SIGNAL("join"),self.channel_join) self.server_OutputSorter.JOIN.connect(self.channel_join) #Part/Quit/Kick are all currently dealt with by the same method, but they are separated #In the Sorter for future-proofing (if neeeded) - done: Alpha 0.4.2.1 #self.connect(self.server_OutputSorter, QtCore.SIGNAL("PART"), self.remove_nick) self.server_OutputSorter.PART.connect(self.remove_nick) #self.connect(self.server_OutputSorter, QtCore.SIGNAL("QUIT"), self.remove_nick) self.server_OutputSorter.QUIT.connect(self.remove_nick) #self.connect(self.server_OutputSorter, QtCore.SIGNAL("KICK"), self.remove_nick) self.server_OutputSorter.KICK.connect(self.remove_nick) #self.connect(self.server_OutputSorter, QtCore.SIGNAL("NamesOnChannel"), self.channel_nicklist) self.server_OutputSorter.NamesOnChannel.connect(self.channel_nicklist) #self.connect(self.server_OutputSorter, QtCore.SIGNAL("RemoveName"), self.remove_nick) self.server_OutputSorter.RemoveName.connect(self.remove_nick) #self.connect(self.server_OutputSorter, QtCore.SIGNAL("nick_mode"), self.nick_mode_change) self.server_OutputSorter.Nick_Mode.connect(self.nick_mode_change) #self.connect(self.server_OutputSorter, QtCore.SIGNAL("nicklist_update"), self.nicklist_update) self.server_OutputSorter.Nicklist_Update.connect(self.nicklist_update) #self.connect(self.server_OutputSorter, QtCore.SIGNAL("ChannelTitle"),self.channel_title_update) self.server_OutputSorter.ChannelTitle.connect(self.channel_title_update) #self.connect(self.server_OutputSorter, QtCore.SIGNAL("Notice"), self.statusBarNotice) self.server_OutputSorter.Notice.connect(self.statusBarNotice) #self.connect(self.server_OutputSorter, QtCore.SIGNAL("StatusBar"), self.statusBar) self.server_OutputSorter.StatusBar.connect(self.statusBar) #self.connect(self.server_OutputSorter, QtCore.SIGNAL("NickChange"), self.nick_update, 2) self.server_OutputSorter.NickChange.connect(self.nick_update) #self.connect(self.server_OutputSorter, QtCore.SIGNAL("NewNick"),self.new_nick) self.server_OutputSorter.NewNick.connect(self.new_nick) #QtCore.QObject.connect(self.ui.button_Connect,QtCore.SIGNAL("clicked()"),self.connectToServer) self.ui.button_Connect.clicked.connect(self.connectToServer) #QtCore.QObject.connect(self.ui.button_Send,QtCore.SIGNAL("clicked()"),self.sendToServer) #self.ui.button_Send.clicked.connect(self.sendToServer) #QtCore.QObject.connect(self.ui.button_Disconnect,QtCore.SIGNAL("clicked()"),self.button_disconnect) self.ui.button_Disconnect.clicked.connect(self.button_disconnect) #QtCore.QObject.connect(self.ui.button_Tile, QtCore.SIGNAL("clicked()"), self.tileHorizontally) self.ui.button_Tile.clicked.connect(self.tileHorizontally) #QtCore.QObject.connect(self.ui.button_Cascade, QtCore.SIGNAL("clicked()"), self.cascade) self.ui.button_Cascade.clicked.connect(self.cascade) #QtCore.QObject.connect(self.ui.button_Properties, QtCore.SIGNAL("clicked()"), self.show_properties) self.ui.button_Properties.clicked.connect(self.show_properties) #QtCore.QObject.connect(self.ui.actionProperties, QtCore.SIGNAL("triggered()"), self.show_properties) self.ui.actionProperties.triggered.connect(self.show_properties) #QtCore.QObject.connect(self.ui.actionConnect, QtCore.SIGNAL("triggered()"), self.connectToServer) self.ui.actionConnect.triggered.connect(self.connectToServer) #QtCore.QObject.connect(self.ui.actionDisconnect, QtCore.SIGNAL("triggered()"), self.button_disconnect) self.ui.actionDisconnect.triggered.connect(self.button_disconnect) #QtCore.QObject.connect(self.ui.actionTile, QtCore.SIGNAL("triggered()"), self.tileHorizontally) self.ui.actionTile.triggered.connect(self.tileHorizontally) #QtCore.QObject.connect(self.ui.actionCascade, QtCore.SIGNAL("triggered()"), self.cascade) self.ui.actionCascade.triggered.connect(self.cascade) #QtCore.QObject.connect(self.ui.actionAbout_Py_Birch, QtCore.SIGNAL("triggered()"), self.show_about) self.ui.actionAbout_Py_Birch.triggered.connect(self.show_about) self.pluginsMenu=self.ui.menubar.addMenu("Plugins") self.rescanAction=self.pluginsMenu.addAction("Rescan") # self.rescanMenu=QtGui.QAction("Rescan",self.pluginMenu) # self.rescanMenu.setObjectName("Rescan") # self.rescanAction.QtGui.QAction(self.plugins.discover_plugins()) #QtCore.QObject.connect(self.rescanAction,QtCore.SIGNAL("triggered()"),self.plugins.discover_plugins) self.rescanAction.triggered.connect(self.plugins.discover_plugins) #self.ui.text_Input.installEventFilter(self) ts = TextString() ts.set_channel("#test") ts.set_nick(self._nick) self.config.saveConfig() self.ui.statusbar.showMessage("Loaded...") # try: # with open('py-birch.cfg', 'w') as configfile: # self.config.write(configfile) # except: # print("Config Writing Fail") # self.channel_join(ts) def setUpSignals(self): self.NickChange = QtCore.pyqtSignal() def statusBarNotice(self, ts): message = "Notice From :"+ ts.get_nick()+" - "+ ts.get_message() self.statusBar(message) def statusBar(self, myMessage): self.ui.statusbar.showMessage("") self.ui.statusbar.showMessage(myMessage) def eventFilter(self, obj ,event): if event.type() == QtCore.QEvent.KeyPress and event.matches(QtGui.QKeySequence.InsertParagraphSeparator): self.sendToServer() return True return False def connectToServer(self): #print 'in file dialogue' self.statusWindow.append_channel_text("File Dialog Clicked. Touch me, I Rock!\n") try: self.irc_Connection.connectToIrc() # if irc_Connection.is_alive(): # irc_Connection.run() # else: # irc_Connection.start() self.statusBar("Connecting...") except Disconnected: self.statusWindow.append_channel_text(self.ui.editor_Window.getText()+"Disconnected ", Disconnect) self.irc_Connection.stop() self.statusBar("Connection Failed") self.disconnect("Failed to Connect") #print "leaving file dialogue" def new_nick(self): myText, myOk = QtWidgets.QInputDialog.getText(self, 'Enter New Nickname','Nickname In Use. Enter New Nickname:') if myOk: print (myOk) #self.emit(QtCore.SIGNAL("NickChange"),myText) self.NickChange.emit(myText) #self.raw_sendToServer("NICK "+nick) self.send_to_server("NICK "+myText) #This method simply takes an *already formatted* string #and sends it to the server. It does not processing. #should be renamed raw_sendToServer def send_to_server(self, string_to_send): self.irc_Connection.sendToIrc(string_to_send) #This method is used for the *status* window. #It is essentially depreicated, and will be cleaned up #and only send data without the addition of a channel in later #versions. def sendToServer(self): originalString = self.ui.text_Input.text() textToSend = originalString displayText = textToSend myTextToSwitch = textToSend.split(" ") if myTextToSwitch[0][0:1] == "/": if myTextToSwitch[0] == "/msg": remainderIndex = string.find(textToSend,myTextToSwitch[1]) textToSend = "PRIVMSG "+myTextToSwitch[1]+textToSend[remainderIndex:] displayText = "**Messaging "+myTextToSwitch[1]+textToSend[remainderIndex:] else: textToSend = str(textToSend[1:]) displayText = "---"+str(textToSend) #remainderIndex=string.find(strServerOutput,":",2) else: textToSend = "PRIVMSG "+channelName+" :"+textToSend displayText = "["+channelName+"] "+originalString self.irc_Connection.sendToIrc(textToSend) displayText = html.escape(displayText) self.ui.editor_Window.insertHtml(displayText+"<br>") self.ui.text_Input.setText("") def button_disconnect(self): self.disconnect("Button Clicked") def close_channels(self): for chan in self.ui.mdiArea.subWindowList(): print("<DEBUG>Disconnecting: Closing Channel Windows:"+chan.get_channel_name().lower()) if chan.channelType == Channel.CHANNEL: chan.closeChannel() #self.channelArray[chan.get_channel_name().lower()] = None #del self.channelArray[chan.get_channel_name().lower()] #del chan # self.channelArray = dict() def disconnect(self,MyMessage): #print "in disconnect" self.irc_Connection.stop() self.close_channels() self.statusBar("Disconnected :"+MyMessage) def removeChannel(self): closedChannel = self.sender() ts = TextString() print("<DEBUG>removeChannel: Entered method : " + closedChannel.get_channel_name()) #do I need some sanity check for it being OfType Channel? #for chan in channelArray: #if(chan.get_channel_name() == closedChannel.get_channel_name()): if(self.channelArray[closedChannel.get_channel_name().lower()] != None): # print(chan.get_channel_name()+" removed") if closedChannel.channelType == Channel.CHANNEL: textToSend="PART "+self.channelArray[closedChannel.get_channel_name().lower()].get_channel_name() self.send_to_server(textToSend) self.ui.mdiArea.removeSubWindow(closedChannel) self.channelArray[closedChannel.get_channel_name().lower()] = None del self.channelArray[closedChannel.get_channel_name().lower()] def channel_nicklist(self, my_TextString): ts = my_TextString print("<DEBUG:start:channel_nicklist: ts.get_channel:"+ts.get_channel().lower()+" Channel Name:", self.channelArray[ts.get_channel().lower()].get_channel_name()) try: self.channelArray[ts.get_channel().lower()].insert_nick(ts) except KeyError: print("<DEBUG>start.py:channel_nicklist:", KeyError) def nick_mode_change(self, my_TextString): self.channelArray[my_TextString.get_channel().lower()].nick_mode_change(my_TextString) print("<DEBIG> nick change fired :" +my_TextString.get_code()) def remove_nick(self, my_TextString): ts = my_TextString ts.set_nick(ts.get_nick().strip()) found=False #This ensures that a single True response will stop the nick #appearing in the status window, which is desired behaviour foundSwitch=False if ts.get_nick().lower().strip() == self._nick.lower().strip(): print("<DEBUG>Remove Nick: I am leaving a channel!"+ts.get_channel()) #Print a message in the status window that the user has left self.statusWindow.append_channel_text(ts.get_display_string()+"<DEBUG>-From start.remove_nick()" ) else: print("<DEBUG>Remove Nick (Channel):"+ts.get_channel()+" (nick)"+ts.get_nick()) if ts.get_code() == "QUIT": #we now have to cycle through all channels! #we also have to check all channels, incase they are on #more than one for chan in self.channelArray: print("<DEBUG>Remove Nick:QUIT:Trying to remove:"+ts.get_nick()+"- From :"+chan) found=self.channelArray[chan].remove_nick(ts) if found == True: self.channelArray[chan].append_channel_text(ts.get_display_string()) foundSwitch=True else: print("<DEBUG>Remove "+ts.get_nick()+" for:"+ts.get_code()+" from (Channel):"+ts.get_channel()+" (Nick)"+ts.get_nick()) found=self.channelArray[ts.get_channel().lower()].remove_nick(ts) if found==True: self.channelArray[ts.get_channel().lower()].append_channel_text(ts.get_display_string()) foundSwitch=True if foundSwitch: print("<DEBUG>remove_nick:QUIT:Nickname found\n") else: print("<DEBUG>remove_nick:QUIT:Nickname not found\n") self.statusWindow.append_channel_text(ts.get_display_string()) def channel_title_update(self,my_TextString): ts = my_TextString #print ("<DEBUG>Channel_title_update:Channel"+my_TextString.get_channel()) #print("<DEBUG>Channel_title_update:Title"+my_TextString.get_display_string()) self.channelArray[ts.get_channel().lower()].set_channel_title(ts.get_display_string()) def channel_join(self,my_TextString): ts = my_TextString myChannelName= ts.get_channel() print ("Chan Name "+ myChannelName) for char in ' :': myChannelName = myChannelName.replace(char,'') #Create the Channel Window, passing in the Channel Name exists=False #This unusuall series of if's is because of the unusuall case # where by chanName can be ==, which means that it is not None, # and testing them together passes through the if statement. for chanName in self.channelArray: if (chanName is None): print("None Type") if(not chanName==""): #print("Chan Name "+chanName) if not (self.channelArray[chanName] is None): print("Channel Name " + self.channelArray[chanName].get_channel_name().lower()) if self.channelArray[chanName].get_channel_name().lower() == myChannelName.lower(): print("Match Found:"+chanName+"+"+myChannelName.lower()) exists=True if exists: print("Channel "+myChannelName+" exists"); if ts.get_nick() == self._nick and not exists: #print ("<DEBUG:Channel:Join:>Creating " + myChannelName) #Adding @, so that ops notices get their own channel. if str(myChannelName).startswith("#") or str(myChannelName).startswith("@"): channelWindow = Channel(str(myChannelName),self.config,self.plugins) else: channelWindow = Channel(str(myChannelName), self.config,self.plugins,2) #Pass the nickname into the channel. Could be a #Constructer variable. channelWindow.nick_update(self._nick) #Add the Channel to the MDI Area self.ui.mdiArea.addSubWindow(channelWindow) #Missing - Check to see if Channel Already joined. #- This may not be needed as this can only be fired on # JOIN recieved from the server. HOWEVER Channel Window # may still be open from Disconnect. (v0.1) #add the Channel to the ChannelArray. #channelArray.append(channelWindow) ########## #All channel Keys must be lower case! (or the same case, but I've chosen lower case!) ########## #print("<DEBUG:join:Checking Channel Name", channelWindow.get_channel_name()) self.channelArray[channelWindow.get_channel_name().lower()] = channelWindow #Stuff to enable connection to continue to Status Window #self.ui.label_ChanName.setText(str(myChannelName)) channelName = str(myChannelName) #Qt::QueuedConnection=2 #self.connect(channelWindow,QtCore.SIGNAL("UserInput"),self.send_to_server,2) channelWindow.UserInput.connect(self.send_to_server) #self.connect(self.irc_Connection,QtCore.SIGNAL("NickChange"), channelWindow.nick_update,2) self.irc_Connection.NickChange.connect(channelWindow.nick_update) #self.connect(self,QtCore.SIGNAL("NickChange"),channelWindow.nick_update) self.NickChange.connect(channelWindow.nick_update) #self.connect(channelWindow,QtCore.SIGNAL("Channel_Closed"),self.removeChannel,2) channelWindow.Channel_Closed.connect(self.removeChannel) #add a button to the button bar button_bar_layout = self.ui.button_bar.layout() btn_Channel = QtWidgets.QPushButton(channelName) #btn_Channel.set button_bar_layout.addWidget(btn_Channel) btn_Channel.show() #channelWindow.connect(btn_Channel, QtCore.SIGNAL("clicked()"), channelWindow.button_click) btn_Channel.clicked.connect(channelWindow.button_click) channelWindow.set_button(btn_Channel) #Make the Channel Visible channelWindow.show() #print("<DEBUG:start:join "+channelWindow.get_channel_name()+">") else: ts.set_channel(myChannelName) ts.set_message(ts.get_nick()) self.channel_nicklist(ts) def update_statusWindow(self, ircMessage): myQString = "!==!==! " myQString = myQString+str(ircMessage) myQString = QString(myQString) myQString = html.escape(myQString) self.statusWindow.append_channel_text(myQString+"<br>") def show_about(self): self.about = About() self.ui.mdiArea.addSubWindow(self.about) self.about.show_window() def update_editorWindow(self, ircMessage): #global server_outputSorter ts = self.server_OutputSorter.sortOutput(ircMessage) found = False #Quite messages are sorted elsewhere. #We need to remove the messages here that are added to the window elsewehre. #--- this list might become a long list, and we might need to find a better way of #recording if this should be generalically added. print("<DEBUG>update_editorWindow:Code: "+" "+ts.get_nick()+" "+ts.get_code().lower()+" "+ts.get_channel()) if ts.get_code() != 'QUIT' and ts.get_code() != 'PART' and ts.get_code() != 'KICK': try: if (self.channelArray[ts.get_channel().lower()] != None): #self.channelArray[ts.get_channel().lower()].append_channel_text(ts.get_display_string()) self.channelArray[ts.get_channel().lower()].append_channel_ts(ts) found = True else: if self.channelArray[ts.get_code().lower()] != None: #self.channelArray[ts.get_code().lower()].append_channel_text(ts.get_display_string()) self.channelArray[ts.get_code().lower()].append_channel_ts(ts) found = True except KeyError as e: print("<DEBUG>update_editorWindow:KeyError: "+ts.get_code().lower()+" "+ts.get_channel().lower()+" Error:"+ e.args[0]) pass #NOTE Stauts window access need to be collected into a single method # ircMessage+="\n" if (found == False): myQString = "" myQString = ts.get_display_string() myQString = QString(myQString) self.statusWindow.append_channel_text(myQString) #This should stop the window from updating when scrolling #up and down through the channel! #if not self.ui.editor_Window.isHorizontalSliderPressed(): #self.ui.editor_Window.moveCursor(11,False) del ts def nicklist_update(self, ts): myChannel = ts.get_channel() if myChannel.lower() in self.channelArray: print( myChannel + " exists. Trying to update " + ts.get_nick()) self.channelArray[myChannel.lower()].nicklistupdate(ts) print (myChannel + "Looping through all channels just in case.") for chan in self.channelArray: self.channelArray[chan].nicklist_update(ts) def nick_update(self, myNick) : global _nick_ #if myNick == self._nick_: # #update all the channels with the new nickname # for chan in self.channelArray: # chan.nick_update(myNick) _nick_ = myNick self._nick=myNick self.statusWindow.nick_update(myNick) def process_gui_events(self): global app app.processEvents() def tile(self): self.ui.mdiArea.tilesSubWindows() #The numbers seem to be a bit backwards because it's WIDTH, then HEIGHT def tileHorizontally(self): self._layout = self.const_TILE #self.ui.mdiArea.tileSubWindows() subWindowList = self.ui.mdiArea.subWindowList() windowCount=0 #So the calculation works out properly, and ignores minimised windows. for window in subWindowList: if not window.isMinimized() and not window.isHidden(): windowCount = windowCount+1 #windowHeight = self.ui.mdiArea.height() / len(subWindowList) windowHeight = self.ui.mdiArea.height() / windowCount #print(len(subWindowList), windowHeight, self.ui.mdiArea.width()) x = 0 for window in subWindowList: if not window.isMinimized(): window.resize(self.ui.mdiArea.width(), windowHeight) window.move(0, x) x = x+ windowHeight def getProperties(self): return self.config() def show_properties(self): self.config.show_window() def cascade(self): self.ui.mdiArea.cascadeSubWindows() self._layout=self.const_CASCADE def closeEvent(self, event): try: self.config.saveConfig() self.irc_Connection.disconnect() except IOError as err: print (err) except OSError as err: print (err) except Exception as err: print("Final Error : ") print(err) def resizeEvent(self,event): #if(self._layout==self.const_NONE): #print("Do nothing, layout is empty") if(self._layout==self.const_TILE): #print("Tiling Layout") self.tileHorizontally() if(self._layout == self.const_CASCADE): #print("Cascde Layout") self.cascade()
"A device or piece of media has been inserted and is now available." ) self.dlg.serial_port_refresh() elif msg.wParam == 0x8004: # DBT_DEVICEREMOVECOMPLETE 已删除设备或介质 print("A device or piece of media has been removed.") self.dlg.serial_port_refresh() elif msg.wParam == 0x0007: # DBT_DEVNODES 已在系统中添加或删除设备 pass else: print('nativeEventFilter: %04X %04X' % (msg.message, msg.wParam)) else: print('nativeEventFilter: %s %04X' % (eventType, message)) except Exception as e: print('nativeEventFilter:', e) return False, 0 if __name__ == '__main__': app = QApplication(sys.argv) app.setWindowIcon(QIcon(':/icon/resource/icon/serial256.ico')) dlg = SerialPort() dlg.show() sysMsg = SysEventFilter(dlg) app.installNativeEventFilter(sysMsg) codec = Codec() aboutSoft = About() ret = app.exec_() print('Exit', ret) sys.exit(ret)
def aboutMessage(self): self.sendMailwidget.hide() self.about = About() self.about.show()
def about(self, bCheck): print "mainWindow about..." dlg = About(self) dlg.exec_()
def about( self, bCheck): print "mainWindow about..." dlg = About(self) dlg.exec_()
def build_gui(self): #build the GUI self.mainwindow=MainWindow.MainWindow(app_name,version,branch) try: self.mainwindow.set_icon_from_file(self.default_icon_path) except: pass self.mainwindow.set_textlimit( self.conf.textlimit() ) self.mainwindow.set_ctrl_enter( self.conf.get_bool_option('ctrl_enter') ) self.mainwindow.connect('quit', self.quit_triggered ) self.mainwindow.connect('window-to-tray', self.window_to_tray ) self.mainwindow.connect('update-status',self.update_status) self.mainwindow.connect('get-conversation',self.get_conversation) self.mainwindow.connect('show-user',self.get_user_info) self.mainwindow.connect('show-group',self.get_group_info) self.mainwindow.connect('notebook-page-change',self.page_change) self.mainwindow.connect('follow-user',self.follow_user) self.mainwindow.connect('join-group',self.join_group) self.mainwindow.connect('clear-respond-to-id',self.clear_respond_to_id) #keep track of the window size self.mainwindow.connect('size-allocate', self.window_size_allocate) #self.mainwindow.connect('window-state-event', self.mainwindow_state_event) self.mainwindow.connect('delete-event', self.mainwindow_delete_event) # local function to create a closeable tab label for closeable tabs def closeable_tab_label(caption, tab): tablabel = gtk.HBox(False,2) tablabel.pack_start(gtk.Label(caption),False,False,0) closebutton = gtk.Button() closeicon = gtk.Image() closeicon.set_from_stock(gtk.STOCK_CLOSE,gtk.ICON_SIZE_MENU) closebutton.set_image(closeicon) closebutton.set_relief(gtk.RELIEF_NONE) tinybutton_style = gtk.RcStyle() tinybutton_style.xthickness = 0 tinybutton_style.ythickness = 0 closebutton.modify_style(tinybutton_style) if tab != None: # if this isn't a mock-add closebutton.connect('clicked',tab.close) #don't show a tooltip on maemo if not has_hildon: closebutton.set_tooltip_text(_("Close")) tablabel.pack_start(closebutton,False,False,0) tablabel.show_all() return tablabel # do a mock add of dentspage, with a close label, so as to determine height needed for uncloseable tabs' labels, then break it all down again # this is ridiculously hacky, but it works, and doesn't leave anything behind self.dentspage = ScrollPage() self.mock_label = closeable_tab_label(_("Dents"),None) self.mainwindow.notebook.append_page(self.dentspage,self.mock_label) self.mainwindow.show_all() # we have to do this so the tab gets actualised, and thus gets a height min_tab_height = self.mock_label.allocation.height self.mainwindow.hide_all() self.mainwindow.notebook.remove_page(-1) del self.mock_label # local function to create a label the same height as the closeable tabs' labels def uncloseable_tab_label(caption): tablabel = gtk.Label(caption) tablabel.set_size_request(-1,min_tab_height) tablabel.show() return tablabel # create and add all of the pages self.dentspage = ScrollPage() self.mainwindow.notebook.append_page(self.dentspage,uncloseable_tab_label(_("Dents") ) ) self.mentionspage = ScrollPage() self.mainwindow.notebook.append_page(self.mentionspage,uncloseable_tab_label(_("Mentions")) ) self.favoritespage = ScrollPage() self.mainwindow.notebook.append_page(self.favoritespage,uncloseable_tab_label(_("Favorites")) ) self.directspage = ScrollPage() self.mainwindow.notebook.append_page(self.directspage,uncloseable_tab_label(_("Directs")) ) #make the conversation page self.contextpage=ContextPage() self.contextpage.connect('context-page-hide',self.hide_contextpage) #add the contextpage context_label = closeable_tab_label(_("Context"), self.contextpage) self.mainwindow.notebook.append_page(self.contextpage, context_label) #create a user page self.userpage=UserPage() self.userpage.connect('user-page-hide',self.hide_userpage) self.userpage.connect('follow-user',self.follow_user) self.userpage.connect('direct-clicked',self.direct_clicked) self.userpage.connect('open-link',self.open_link) self.userpage.connect('block-create',self.block_create) self.userpage.connect('block-destroy',self.block_destroy) #add the userpage user_label = closeable_tab_label(_("User"),self.userpage ) self.mainwindow.notebook.append_page(self.userpage, user_label) #create a Group page self.grouppage=GroupPage() self.grouppage.connect('group-page-hide',self.hide_grouppage) self.grouppage.connect('join-group',self.join_group) self.grouppage.connect('open-link',self.open_link) #add the Grouppage group_label = closeable_tab_label(_("Group"),self.grouppage ) self.mainwindow.notebook.append_page(self.grouppage, group_label) #create and add the account page self.settingspage = SettingsPage(has_hildon,has_pynotify) self.settingspage.set_initial_dents( self.initial_dents ) self.settingspage.set_pull_time(self.pull_time) #update the configuration of the settings self.settingspage.connect('update-account',self.update_account) self.options['ctrl_enter'] = self.conf.get_bool_option('ctrl_enter') self.settingspage.set_ctrl_enter( self.options['ctrl_enter'] ) self.options['run_as_tray_app'] = self.conf.get_bool_option('run_as_tray_app') self.settingspage.set_run_as_tray_app( self.options['run_as_tray_app'] ) self.options['context_backwards'] = self.conf.get_bool_option('context_backwards') self.settingspage.set_context_backwards( self.options['context_backwards'] ) self.options['no_avatar']= self.conf.get_bool_option('no_avatars') self.settingspage.set_no_avatars( self.options['no_avatar'] ) self.options['api_retweet'] = self.conf.get_bool_option('api_retweet') self.settingspage.set_api_retweet( self.options['api_retweet'] ) self.options['notifications']= self.conf.get_bool_option('notifications') self.settingspage.set_notifications( self.options['notifications'] ) self.options['notify_replies']= self.conf.get_bool_option('notify_replies') self.settingspage.set_notify_replies( self.options['notify_replies'] ) link_color = self.conf.get('settings','link_color',default='blue') self.settingspage.set_link_color( link_color ) self.theme_link_color(link_color) #connect the setting signals self.settingspage.connect('option-run-as-tray-app', self.option_changed, 'run_as_tray_app') self.settingspage.connect('option-ctrl-enter', self.option_changed, 'ctrl_enter') self.settingspage.connect('option-context-backwards',self.option_changed, 'context_backwards') self.settingspage.connect('option-no-avatars',self.option_changed, 'no_avatars') self.settingspage.connect('option-api-retweet', self.option_changed, 'api_retweet') self.settingspage.connect('option-notifications',self.option_changed, 'notifications') self.settingspage.connect('option-notify-replies',self.option_changed, 'notify_replies') self.settingspage.connect('initial-dents',self.set_initial_dents) self.settingspage.connect('pull-time',self.set_pull_time) self.settingspage.connect('link-color',self.set_link_color) self.settingspage.connect('add-string-filter', self.add_string_filter ) self.settingspage.connect('remove-string-filter', self.remove_string_filter ) self.settingspage.connect('add-user-filter', self.add_user_filter ) self.settingspage.connect('remove-user-filter', self.remove_user_filter ) #add the settings to the mainwindow self.mainwindow.add_notebook_page(self.settingspage,uncloseable_tab_label(_("Settings") ) ) #create and add the about page about = About(version,branch,self.standard_icon_path,self.readme_file) about.connect('open-link',self.open_link) self.mainwindow.add_notebook_page( about, uncloseable_tab_label(_("About") ) ) self.mainwindow.show_some() #hide some stuff self.grouppage.hide_all() self.userpage.hide_all() self.contextpage.hide_all()
def About(self): self.about = About(None) self.about.exec_()
def setupUi(self, main_window, username, perm_mask, app): main_window.setObjectName("main_window") main_window.setFixedSize(1031, 748) main_window.setWindowIcon(QtGui.QIcon("static/icono_CEIC.png")) main_window.setStyleSheet("background-color: rgb(235, 235, 235);\n" "") self.centralwidget = QtWidgets.QWidget(main_window) self.centralwidget.setObjectName("centralwidget") # Font: Para los botones font = QtGui.QFont() font.setPointSize(10) font.setBold(True) font.setWeight(75) # Button (push_button_1): Inicio self.push_button_1 = QtWidgets.QPushButton(self.centralwidget) self.push_button_1.setGeometry(QtCore.QRect(0, 10, 191, 60)) self.push_button_1.setFont(font) self.push_button_1.setCursor( QtGui.QCursor(QtCore.Qt.PointingHandCursor)) self.setButtonStyleSheet(1, "#6aadc6", "#74b7d0") icon7 = QtGui.QIcon() icon7.addPixmap(QtGui.QPixmap("static/home-page-CAD3C8.png"), QtGui.QIcon.Normal, QtGui.QIcon.Off) self.push_button_1.setIcon(icon7) self.push_button_1.setIconSize(QtCore.QSize(50, 50)) self.push_button_1.setFlat(True) self.push_button_1.setObjectName("push_button_1") # Button (push_button_2): Gestión de Libros self.push_button_2 = QtWidgets.QPushButton(self.centralwidget) self.push_button_2.setGeometry(QtCore.QRect(0, 70, 191, 60)) self.push_button_2.setFont(font) self.push_button_2.setCursor( QtGui.QCursor(QtCore.Qt.PointingHandCursor)) self.setButtonStyleSheet(2, "#60a3bc", "#6aadc6") icon = QtGui.QIcon() icon.addPixmap(QtGui.QPixmap("static/books-CAD3C8.png"), QtGui.QIcon.Normal, QtGui.QIcon.Off) self.push_button_2.setIcon(icon) self.push_button_2.setIconSize(QtCore.QSize(45, 40)) self.push_button_2.setFlat(True) self.push_button_2.setObjectName("push_button_2") # Button (push_button_3): Gestión de Estudiantes self.push_button_3 = QtWidgets.QPushButton(self.centralwidget) self.push_button_3.setGeometry(QtCore.QRect(0, 130, 191, 60)) self.push_button_3.setFont(font) self.push_button_3.setCursor( QtGui.QCursor(QtCore.Qt.PointingHandCursor)) self.setButtonStyleSheet(3, "#60a3bc", "#6aadc6") icon1 = QtGui.QIcon() icon1.addPixmap(QtGui.QPixmap("static/students-CAD3C8.png"), QtGui.QIcon.Normal, QtGui.QIcon.Off) self.push_button_3.setIcon(icon1) self.push_button_3.setIconSize(QtCore.QSize(50, 50)) self.push_button_3.setFlat(True) self.push_button_3.setObjectName("push_button_3") # Button (push_button_4): Préstamos self.push_button_4 = QtWidgets.QPushButton(self.centralwidget) self.push_button_4.setGeometry(QtCore.QRect(0, 190, 191, 60)) self.push_button_4.setFont(font) self.push_button_4.setCursor( QtGui.QCursor(QtCore.Qt.PointingHandCursor)) self.setButtonStyleSheet(4, "#5699b2", "#60a3bc") icon2 = QtGui.QIcon() icon2.addPixmap(QtGui.QPixmap("static/préstamos-CAD3C8.png"), QtGui.QIcon.Normal, QtGui.QIcon.Off) self.push_button_4.setIcon(icon2) self.push_button_4.setIconSize(QtCore.QSize(45, 45)) self.push_button_4.setFlat(True) self.push_button_4.setObjectName("push_button_4") # Button (push_button_5): Multas self.push_button_5 = QtWidgets.QPushButton(self.centralwidget) self.push_button_5.setGeometry(QtCore.QRect(0, 250, 191, 60)) self.push_button_5.setFont(font) self.push_button_5.setCursor( QtGui.QCursor(QtCore.Qt.PointingHandCursor)) self.setButtonStyleSheet(5, "#5699b2", "#60a3bc") icon3 = QtGui.QIcon() icon3.addPixmap(QtGui.QPixmap("static/fines-CAD3C8.png"), QtGui.QIcon.Normal, QtGui.QIcon.Off) self.push_button_5.setIcon(icon3) self.push_button_5.setIconSize(QtCore.QSize(50, 50)) self.push_button_5.setFlat(True) self.push_button_5.setObjectName("push_button_5") # Button (push_button_6): Sanciones self.push_button_6 = QtWidgets.QPushButton(self.centralwidget) self.push_button_6.setGeometry(QtCore.QRect(0, 310, 191, 60)) self.push_button_6.setFont(font) self.push_button_6.setCursor( QtGui.QCursor(QtCore.Qt.PointingHandCursor)) self.setButtonStyleSheet(6, "#4c8fa8", "#5699b2") icon4 = QtGui.QIcon() icon4.addPixmap(QtGui.QPixmap("static/banned-CAD3C8.png"), QtGui.QIcon.Normal, QtGui.QIcon.Off) self.push_button_6.setIcon(icon4) self.push_button_6.setIconSize(QtCore.QSize(45, 45)) self.push_button_6.setFlat(True) self.push_button_6.setObjectName("push_button_6") # Button (push_button_7): Administracion self.push_button_7 = QtWidgets.QPushButton(self.centralwidget) self.push_button_7.setGeometry(QtCore.QRect(0, 370, 191, 60)) self.push_button_7.setFont(font) self.push_button_7.setCursor( QtGui.QCursor(QtCore.Qt.PointingHandCursor)) self.setButtonStyleSheet(7, "#4c8fa8", "#5699b2") icon5 = QtGui.QIcon() icon5.addPixmap(QtGui.QPixmap("static/admin-CAD3C8.png"), QtGui.QIcon.Normal, QtGui.QIcon.Off) self.push_button_7.setIcon(icon5) self.push_button_7.setIconSize(QtCore.QSize(40, 40)) self.push_button_7.setFlat(True) self.push_button_7.setObjectName("push_button_7") # Button (push_button_8): About self.push_button_8 = QtWidgets.QPushButton(self.centralwidget) self.push_button_8.setGeometry(QtCore.QRect(0, 430, 191, 60)) self.push_button_8.setFont(font) self.push_button_8.setCursor( QtGui.QCursor(QtCore.Qt.PointingHandCursor)) self.setButtonStyleSheet(8, "#42859e", "#4c8fa8") icon6 = QtGui.QIcon() icon6.addPixmap(QtGui.QPixmap("static/about-CAD3C8.png"), QtGui.QIcon.Normal, QtGui.QIcon.Off) self.push_button_8.setIcon(icon6) self.push_button_8.setIconSize(QtCore.QSize(45, 45)) self.push_button_8.setFlat(True) self.push_button_8.setObjectName("push_button_8") # Button (push_button_9): Gestión de libros self.push_button_9 = QtWidgets.QPushButton(self.centralwidget) self.push_button_9.setGeometry(QtCore.QRect(190, 70, 191, 60)) self.push_button_9.setFont(font) self.push_button_9.setCursor( QtGui.QCursor(QtCore.Qt.PointingHandCursor)) self.setButtonStyleSheet(9, "#6aadc6", "#74b7d0") icon7 = QtGui.QIcon() icon7.addPixmap(QtGui.QPixmap("static/books-CAD3C8.png"), QtGui.QIcon.Normal, QtGui.QIcon.Off) self.push_button_9.setIcon(icon7) self.push_button_9.setIconSize(QtCore.QSize(45, 40)) self.push_button_9.setFlat(True) self.push_button_9.setObjectName("push_button_9") # Button (push_button_10): Agregar libro self.push_button_10 = QtWidgets.QPushButton(self.centralwidget) self.push_button_10.setGeometry(QtCore.QRect(190, 130, 191, 60)) self.push_button_10.setFont(font) self.push_button_10.setCursor( QtGui.QCursor(QtCore.Qt.PointingHandCursor)) self.setButtonStyleSheet(10, "#6aadc6", "#74b7d0") icon8 = QtGui.QIcon() icon8.addPixmap(QtGui.QPixmap("static/add-book-CAD3C8.png"), QtGui.QIcon.Normal, QtGui.QIcon.Off) self.push_button_10.setIcon(icon8) self.push_button_10.setIconSize(QtCore.QSize(35, 35)) self.push_button_10.setFlat(True) self.push_button_10.setObjectName("push_button_10") # Button (push_button_11): Inventario self.push_button_11 = QtWidgets.QPushButton(self.centralwidget) self.push_button_11.setGeometry(QtCore.QRect(190, 190, 191, 60)) self.push_button_11.setFont(font) self.push_button_11.setCursor( QtGui.QCursor(QtCore.Qt.PointingHandCursor)) self.setButtonStyleSheet(11, "#6aadc6", "#74b7d0") icon9 = QtGui.QIcon() icon9.addPixmap(QtGui.QPixmap("static/library-CAD3C8.png"), QtGui.QIcon.Normal, QtGui.QIcon.Off) self.push_button_11.setIcon(icon9) self.push_button_11.setIconSize(QtCore.QSize(40, 40)) self.push_button_11.setFlat(True) self.push_button_11.setObjectName("push_button_11") # Button (push_button_12): Gestión de estudiantes self.push_button_12 = QtWidgets.QPushButton(self.centralwidget) self.push_button_12.setGeometry(QtCore.QRect(190, 130, 191, 60)) self.push_button_12.setFont(font) self.push_button_12.setCursor( QtGui.QCursor(QtCore.Qt.PointingHandCursor)) self.setButtonStyleSheet(12, "#60a3bc", "#6aadc6") icon10 = QtGui.QIcon() icon10.addPixmap(QtGui.QPixmap("static/students-CAD3C8.png"), QtGui.QIcon.Normal, QtGui.QIcon.Off) self.push_button_12.setIcon(icon10) self.push_button_12.setIconSize(QtCore.QSize(50, 50)) self.push_button_12.setFlat(True) self.push_button_12.setObjectName("push_button_12") # Button (push_button_13): Agregar estudiante self.push_button_13 = QtWidgets.QPushButton(self.centralwidget) self.push_button_13.setGeometry(QtCore.QRect(190, 190, 191, 60)) self.push_button_13.setFont(font) self.push_button_13.setCursor( QtGui.QCursor(QtCore.Qt.PointingHandCursor)) self.setButtonStyleSheet(13, "#5699b2", "#60a3bc") icon11 = QtGui.QIcon() icon11.addPixmap(QtGui.QPixmap("static/add-user-CAD3C8.png"), QtGui.QIcon.Normal, QtGui.QIcon.Off) self.push_button_13.setIcon(icon11) self.push_button_13.setIconSize(QtCore.QSize(40, 40)) self.push_button_13.setFlat(True) self.push_button_13.setObjectName("push_button_13") # Button (push_button_14): Gestión de usuarios self.push_button_14 = QtWidgets.QPushButton(self.centralwidget) self.push_button_14.setGeometry(QtCore.QRect(190, 370, 191, 60)) self.push_button_14.setFont(font) self.push_button_14.setCursor( QtGui.QCursor(QtCore.Qt.PointingHandCursor)) self.setButtonStyleSheet(14, "#4c8fa8", "#5699b2") icon12 = QtGui.QIcon() icon12.addPixmap(QtGui.QPixmap("static/students-CAD3C8.png"), QtGui.QIcon.Normal, QtGui.QIcon.Off) self.push_button_14.setIcon(icon12) self.push_button_14.setIconSize(QtCore.QSize(50, 50)) self.push_button_14.setFlat(True) self.push_button_14.setObjectName("push_button_14") # Button (push_button_15): Agregar usuario self.push_button_15 = QtWidgets.QPushButton(self.centralwidget) self.push_button_15.setGeometry(QtCore.QRect(190, 430, 191, 60)) self.push_button_15.setFont(font) self.push_button_15.setCursor( QtGui.QCursor(QtCore.Qt.PointingHandCursor)) self.setButtonStyleSheet(15, "#42859e", "#4c8fa8") icon13 = QtGui.QIcon() icon13.addPixmap(QtGui.QPixmap("static/add-ceic-user-CAD3C8.png"), QtGui.QIcon.Normal, QtGui.QIcon.Off) self.push_button_15.setIcon(icon13) self.push_button_15.setIconSize(QtCore.QSize(32, 32)) self.push_button_15.setFlat(True) self.push_button_15.setObjectName("push_button_15") # Button (push_button_22): Cerrar sesión self.push_button_22 = QtWidgets.QPushButton(self.centralwidget) self.push_button_22.setGeometry(QtCore.QRect(0, 672, 191, 51)) self.push_button_22.setFont(font) self.push_button_22.setCursor( QtGui.QCursor(QtCore.Qt.PointingHandCursor)) self.push_button_22.setAutoFillBackground(False) self.push_button_22.setStyleSheet( "QPushButton:hover#push_button_22\n" "{\n" " border-radius: 0px;\n" " background-color: #C20000;\n" "}\n" "\n" "QPushButton:pressed#push_button_22\n" "{\n" " border-radius: 0px;\n" " background-color: #C20000;\n" "}\n" "\n" "QPushButton\n" "{\n" " border-radius: 0px;\n" " background-color: #F10000;\n" " color: #FFFFFF; " "}") self.push_button_22.setFlat(True) self.push_button_22.setObjectName("push_button_22") # Menú lateral: grid_frame self.grid_frame = QtWidgets.QFrame(self.centralwidget) self.grid_frame.setGeometry(QtCore.QRect(0, 0, 191, 748)) self.grid_frame.setAutoFillBackground(False) self.grid_frame.setStyleSheet( "background-color: qlineargradient(spread:pad, x1:0, y1:1, x2:0, y2:0, stop:0 \ rgba(14, 8, 73, 255), stop:0.0795455 rgba(22, 17, 73, 255), stop:0.409091 \ rgba(22, 45, 97, 255), stop:1 rgba(77, 174, 193, 255));" ) self.grid_frame.setFrameShadow(QtWidgets.QFrame.Plain) self.grid_frame.setObjectName("grid_frame") self.grid_layout = QtWidgets.QGridLayout(self.grid_frame) self.grid_layout.setObjectName("grid_layout") # Menú de libros: verticalFrame_1 self.verticalFrame_1 = QtWidgets.QFrame(self.centralwidget) self.verticalFrame_1.setGeometry(QtCore.QRect(180, 60, 201, 201)) self.verticalFrame_1.setStyleSheet( "background-color: qlineargradient(spread:pad, x1:0, y1:1, x2:0, y2:0, stop:0 \ rgba(43, 95, 135, 255), stop:0.727273 rgba(61, 136, 165, 255), stop:0.982955 \ rgba(68, 170, 185, 255));\n" "border-radius: 10px;") self.verticalFrame_1.setObjectName("verticalFrame_1") # Menú de estudiantes: verticalFrame_2 self.verticalFrame_2 = QtWidgets.QFrame(self.centralwidget) self.verticalFrame_2.setGeometry(QtCore.QRect(180, 120, 201, 141)) self.verticalFrame_2.setStyleSheet( "background-color: qlineargradient(spread:pad, x1:0, y1:1, x2:0, y2:0, stop:0.107955 \ rgba(43, 95, 135, 255), stop:1 rgba(61, 136, 165, 255)); border-radius: 10px;" ) self.verticalFrame_2.setObjectName("verticalFrame_2") # Menú de usuarios: verticalFrame_3 (Administración) self.verticalFrame_3 = QtWidgets.QFrame(self.centralwidget) self.verticalFrame_3.setGeometry(QtCore.QRect(180, 360, 201, 141)) self.verticalFrame_3.setStyleSheet( "background-color: qlineargradient(spread:pad, x1:0, y1:1, x2:0, y2:0, stop:0.210227 \ rgba(20, 39, 90, 255), stop:0.681818 rgba(21, 49, 97, 255), stop:1 \ rgba(23, 76, 115, 255)); border-radius: 10px;" ) self.verticalFrame_3.setObjectName("verticalFrame_3") ################# Stacked Widget self.generateLog() self.sendNotification() self.stacked_widget = QtWidgets.QStackedWidget(self.centralwidget) self.stacked_widget.setGeometry(QtCore.QRect(190, -1, 841, 724)) self.stacked_widget.setObjectName("stacked_widget") self.stacked_widget.setStyleSheet( "background-color: rgb(236, 240, 241)") # Index: 0 self.ventana_gestion_libros = gestionLibros(perm_mask) self.stacked_widget.addWidget(self.ventana_gestion_libros) # Index: 1 self.ventana_gestion_estudiante = gestionEstudiante(perm_mask) self.stacked_widget.addWidget(self.ventana_gestion_estudiante) # Index: 2 self.ventana_gestion_usuarios = gestionUsuarios(username) self.stacked_widget.addWidget(self.ventana_gestion_usuarios) # Index: 3 self.ventana_prestamos = prestamos(username) self.stacked_widget.addWidget(self.ventana_prestamos) # Index : 4 self.ventana_multas = multas(username, perm_mask) self.stacked_widget.addWidget(self.ventana_multas) # Index : 5 self.ventana_agregar_libro = AgregarLibro() self.stacked_widget.addWidget(self.ventana_agregar_libro) # Index : 6 self.ventana_inventario = Inventario() self.stacked_widget.addWidget(self.ventana_inventario) # Index : 7 self.ventana_author_search = AuthorSearch() self.stacked_widget.addWidget(self.ventana_author_search) # Index : 8 self.ventana_agregar_estudiante = AgregarEstudiante() self.stacked_widget.addWidget(self.ventana_agregar_estudiante) # Index : 9 self.ventana_agregar_usuario = AgregarUsuario() self.stacked_widget.addWidget(self.ventana_agregar_usuario) # Index : 10 self.ventana_agregar_autor = verificarAutor() self.stacked_widget.addWidget(self.ventana_agregar_autor) # Index : 11 self.ventana_sanciones = sanciones(username, perm_mask) self.stacked_widget.addWidget(self.ventana_sanciones) # Index : 12 self.ventana_inicio = Inicio() self.stacked_widget.addWidget(self.ventana_inicio) # Index : 13 self.ventana_about = About() self.stacked_widget.addWidget(self.ventana_about) # Index : 14 self.ventana_politica = Politica() self.stacked_widget.addWidget(self.ventana_politica) # La aplicacion inicia en el Modulod de Inicio self.stacked_widget.setCurrentIndex(12) # Elementos de la pantalla self.stacked_widget.raise_() self.verticalFrame_1.raise_() self.verticalFrame_2.raise_() self.verticalFrame_3.raise_() self.grid_frame.raise_() self.push_button_1.raise_() self.push_button_2.raise_() self.push_button_3.raise_() self.push_button_4.raise_() self.push_button_5.raise_() self.push_button_6.raise_() self.push_button_7.raise_() self.push_button_8.raise_() self.push_button_9.raise_() self.push_button_10.raise_() self.push_button_11.raise_() self.push_button_12.raise_() self.push_button_13.raise_() self.push_button_14.raise_() self.push_button_15.raise_() self.push_button_22.raise_() # Esconder los menú self.hide_books_menu() self.hide_students_menu() self.hide_users_menu() main_window.setCentralWidget(self.centralwidget) self.retranslateUi(main_window, app) QtCore.QMetaObject.connectSlotsByName(main_window) ###################### Conexiones de Botones self.push_button_2.clicked.connect(self.books_menu) self.push_button_3.clicked.connect(self.students_menu) self.push_button_7.clicked.connect(self.users_menu) self.push_button_9.clicked.connect( lambda: self.stacked_widget.setCurrentIndex(0)) self.push_button_12.clicked.connect( lambda: self.stacked_widget.setCurrentIndex(1)) self.push_button_4.clicked.connect( lambda: self.stacked_widget.setCurrentIndex(3)) self.push_button_5.clicked.connect( lambda: self.stacked_widget.setCurrentIndex(4)) self.push_button_14.clicked.connect( lambda: self.stacked_widget.setCurrentIndex(2)) self.push_button_22.clicked.connect(lambda: sys.exit(app.exec_())) self.push_button_10.clicked.connect( lambda: self.stacked_widget.setCurrentIndex(5)) self.push_button_11.clicked.connect( lambda: self.stacked_widget.setCurrentIndex(6)) self.ventana_gestion_libros.author.clicked.connect( lambda: self.stacked_widget.setCurrentIndex(7)) self.ventana_author_search.back.clicked.connect( lambda: self.stacked_widget.setCurrentIndex(0)) self.push_button_13.clicked.connect( lambda: self.stacked_widget.setCurrentIndex(8)) self.push_button_15.clicked.connect( lambda: self.stacked_widget.setCurrentIndex(9)) self.ventana_agregar_autor.seguir.clicked.connect( lambda: self.stacked_widget.setCurrentIndex(5)) self.ventana_agregar_autor.cancelar.clicked.connect( lambda: self.stacked_widget.setCurrentIndex(5)) self.ventana_agregar_libro.agregarAutor.clicked.connect( lambda: self.stacked_widget.setCurrentIndex(10)) self.push_button_6.clicked.connect( lambda: self.stacked_widget.setCurrentIndex(11)) self.ventana_agregar_autor.seguir.clicked.connect( lambda: self.ventana_agregar_libro.authorsInput.clear()) self.ventana_agregar_autor.seguir.clicked.connect( lambda: self.ventana_agregar_libro.mostrarAutores()) self.push_button_1.clicked.connect(self.actInicio) self.push_button_8.clicked.connect( lambda: self.stacked_widget.setCurrentIndex(13)) self.ventana_about.politica_prestamos.clicked.connect( lambda: self.stacked_widget.setCurrentIndex(14)) self.ventana_politica.entendido.clicked.connect( lambda: self.stacked_widget.setCurrentIndex(13)) ##################### Esconde los menú for i in range(16): if i == 0 or i == 2 or i == 3 or i == 7: continue button = getattr(self, 'push_button_%s' % i) button.clicked.connect(self.hide_books_menu) button.clicked.connect(self.hide_students_menu) button.clicked.connect(self.hide_users_menu) ##################### Permisos if (perm_mask == 0): self.push_button_7.setEnabled(False) self.push_button_7.setStyleSheet("QPushButton\n" "{\n" " color: #B5B5B5\n" "}")
def OnMenuHelpAbout(self, event): # wxGlade: Home.<event_handler> dlg = About(self) dlg.ShowModal() dlg.Destroy()
def about(self): dialog = About(self) dialog.exec_()