def initUI(self): QToolTip.setFont(QFont('SansSerif', 10)) btNewChecklist = QPushButton('Criar', self) btNewChecklist.clicked.connect(self.salvarChecklist) nomeLabel = QLabel('Nome') self._nome = QLineEdit() grid = QGridLayout() grid.setSpacing(10) grid.addWidget(nomeLabel, 1, 0) grid.addWidget(self._nome, 1, 1) grid.addWidget(btNewChecklist, 3, 1) self.setLayout(grid) self.setGeometry(300, 300, 350, 300) self.center() self.setWindowTitle('CheckList') self.show()
def initUI(self): QToolTip.setFont(QFont('SansSerif', 10)) self.setToolTip('This is a <b>QWidget</b> widget.') exitAction = QAction(QIcon('application-exit-4.png'), '&Exit', self) exitAction.setShortcut('Alt+F4') exitAction.setStatusTip('Exit Application') exitAction.triggered.connect(qApp.quit) menuBar = self.menuBar() fileMenu = menuBar.addMenu('&File') fileMenu.addAction(exitAction) self.toolbar = self.addToolBar('Exit') self.toolbar.addAction(exitAction) grid = QGridLayout() lbl_1 = QLabel('1,1') lbl_2 = QLabel('1,2') lbl_3 = QLabel('2,1') lbl_4 = QLabel('2,2') grid.addWidget(lbl_1, 1, 1) grid.addWidget(lbl_2, 1, 2) grid.addWidget(lbl_3, 2, 1) grid.addWidget(lbl_4, 2, 2) mainW = QWidget() mainW.setLayout(grid) self.setCentralWidget(mainW) self.statusBar().showMessage('Ready') self.setGeometry(300, 300, 500, 500) self.setWindowTitle('Photos') self.setWindowIcon(QIcon('camera-photo-5.png')) self.center() self.show()
def __init__(self,parent=None): QWidget.__init__(self, parent) self.setGeometry(300,300,250,150) self.setWindowTitle('Tooltip') self.setToolTip('This is a <b> QWidget </b>widget') QToolTip.setFont(QFont('oldEnglish',10))
def initUI(self): """On definit une methode pour definir la fenetre graphique""" #On definit la police et la taille du texte dans les bulles d'aide QToolTip.setFont(QFont('SansSerif', 10)) #On definit le texte a afficher lors du passage sur la fenetre self.setToolTip("Exemple de creation d'une <b>bulle</b> d'aide pour la fenetre") #Creation d'un bouton btn = QPushButton('Bouton', self) #On met en place une bulle d'aide btn.setToolTip("Voici un bouton inutile !") #On redefinit la taille sur le texte, ici on applique une taille recommandée btn.resize(btn.sizeHint()) btn.move(50, 50) #Creation du bouton pour quitter la fenetre qbtn = QPushButton('Quit', self) #On connecte une action au clique qbtn.clicked.connect(QCoreApplication.instance().quit) #On met en place une bulle d'aide btn.setToolTip("Ce bouton sert à quitter la fenetre !") qbtn.resize(qbtn.sizeHint()) #Positionnement du bouton qbtn.move(150, 150) #Definition des attributs de la fenetre self.setGeometry(300, 300, 300, 220) self.setWindowTitle('PC2') self.setWindowIcon(QIcon('PC2.png'))
def gui_choise_server_client(self): self.hide_last_objects() QToolTip.setFont(QFont('SansSerif', 10)) btn_server = QPushButton('Server', self) btn_server.clicked.connect(self.server_set_socket_settings_gui) # from server.ServerMixin TODO аналогично btn_server.resize(btn_server.sizeHint()) btn_server.move(50, 50) btn_client = QPushButton('Client', self) btn_client.clicked.connect(self.client_set_socket_settings_gui) # from client.ClientMixin btn_client.resize(btn_client.sizeHint()) btn_client.move(150, 50) btn_exit = QPushButton('Quit', self) btn_exit.clicked.connect(QCoreApplication.instance().quit) btn_exit.resize(btn_exit.sizeHint()) btn_exit.move(200, 170) self.setGeometry(450, 300, 300, 200) self.setWindowTitle('Client_Server') self.show() self.objects_to_hide = (btn_exit, btn_client, btn_server) self.show_current_objects()
def __init__(self, title): super().__init__() self.setWindowTitle(title) QToolTip.setFont(QFont('SansSerif', 10)) self.setGeometry(400, 400, 300, 200) self.build_buttons() self.show()
def initUI(self): QToolTip.setFont(QFont('SansSerif', 10)) self.setToolTip('This is a <b>QWidget</b> widget.') #quitBtn = QPushButton('Quit', self) #quitBtn.clicked.connect(self.quitBtnEvent()) #quitBtn.clicked.connect(QCoreApplication.instance().quit) #quitBtn.setToolTip('This is a <b>QPushButton</b> widget.') #quitBtn.resize(quitBtn.sizeHint()) exitAction = QAction(QIcon('application-exit-4.png'), '&Exit', self) exitAction.setShortcut('Alt+F4') exitAction.setStatusTip('Exit Application') exitAction.triggered.connect(qApp.quit) menuBar = QMenuBar() fileMenu = menuBar.addMenu('&File') fileMenu.addAction(exitAction) fileMenu.resize(fileMenu.sizeHint()) toolBar = QToolBar(self) toolBar.addAction(exitAction) #toolBar.resize(toolBar.sizeHint()) toolBar.setFixedHeight(60) hozLine = QFrame() hozLine.setFrameStyle(QFrame.HLine) #hozLine.setSizePolicy(QSizePolicy.Minimum,QSizePolicy.Expanding) statusBar = QStatusBar(self) statusBar.showMessage('Ready') grid = QGridLayout() lbl_1 = QLabel('1,1') lbl_2 = QLabel('1,2') lbl_3 = QLabel('2,1') lbl_4 = QLabel('2,2') grid.addWidget(lbl_1, 1, 1) grid.addWidget(lbl_2, 1, 2) grid.addWidget(lbl_3, 2, 1) grid.addWidget(lbl_4, 2, 2) vbox = QVBoxLayout() vbox.addWidget(menuBar) vbox.addWidget(hozLine) vbox.addWidget(toolBar) # vbox.addWidget(hozLine) vbox.addLayout(grid) vbox.addStretch(1) vbox.addWidget(statusBar) self.setLayout(vbox) self.setGeometry(300, 300, 500, 500) self.setWindowTitle('Photos') self.setWindowIcon(QIcon('camera-photo-5.png')) self.center() self.show()
def initUI(self): QToolTip.setFont(QFont('SansSerif', 10)) self.setToolTip('This is my widget') btn = QPushButton('Push me', self) btn.setToolTip('This is a button') btn.resize(btn.sizeHint()) btn.move(50, 50) self.setGeometry(300, 300, 300, 300) self.setWindowTitle('Tooltip test') self.show()
def initUI(self): QToolTip.setFont(QFont('SansSerif',10)) self.setToolTip('This is a <b>widget</b>') btn=QPushButton('push',self) btn.setToolTip('press and push') btn.resize(btn.sizeHint()) btn.move(40,50) self.setGeometry(200,300,400,500) self.setWindowTitle('setToolTip') self.show()
def initUI(self): """Draw the UI.""" QToolTip.setFont(QFont('SansSerif', 12)) grid = QGridLayout() self.setLayout(grid) lbl_source = QLabel('Source:', self) lbl_source.setAlignment(Qt.AlignCenter) lbl_destination = QLabel('Destination:', self) lbl_destination.setAlignment(Qt.AlignCenter) self.cmb_source = QComboBox(self) self.populate_cmb_source() self.cmb_source.activated.connect(self.source_activated) self.cmb_source.setToolTip("Select either a source USB device " "or a source 'nb' backup directory") self.cmb_destination = QComboBox(self) self.populate_cmb_destination() self.cmb_destination.activated.connect(self.destination_activated) self.cmb_destination.setToolTip('Select a destination USB device') self.lbl_status = QLabel('', self) self.lbl_status.setAlignment(Qt.AlignLeft) self.btn_copy = QPushButton('Copy', self) # self.btn_copy.setFixedWidth(80) self.btn_copy.setFixedWidth(self.btn_copy.width()) self.btn_copy.clicked.connect(self.start_copy) self.btn_copy.setEnabled(False) hbox = QHBoxLayout() hbox.addWidget(self.lbl_status, Qt.AlignLeft) hbox.addStretch(1) hbox.addWidget(self.btn_copy, Qt.AlignRight) hbox.maximumSize() grid.addWidget(lbl_source, 0, 0, Qt.AlignRight) grid.addWidget(self.cmb_source, 0, 1) grid.addWidget(lbl_destination, 1, 0, Qt.AlignRight) grid.addWidget(self.cmb_destination, 1, 1) grid.addLayout(hbox, 2, 1) grid.setColumnStretch(0, 0) grid.setColumnStretch(1, 1) self.setWindowTitle('%s %s' % (ProgName, ProgVersion)) self.setMinimumWidth(MinimumWidth) self.show() self.setFixedHeight(self.height())
def initUI(self): QToolTip.setFont(QFont('SanSerif', 10)) self.setToolTip('This is a <b>QWidget</b> widget') btn = QPushButton('Button', self) btn.setToolTip('This is a <b>QPushButton</b> widget') btn.resize(btn.sizeHint()) btn.move(50, 50) self.setGeometry(300, 300, 300, 200) self.setWindowTitle('Tooltips') self.show()
def initUI(self): QToolTip.setFont(QFont('SansSerif', 40)) self.setGeometry(300,250,360,400) self.setWindowTitle('Instructions') self.toshow = QTextBrowser(self) self.toshow.resize(270,300) self.toshow.move(30,20) self.toshow.setText('good') # self.toshow.setText('\n'.join(self.s)) self.show()
def initUI(self): QToolTip.setFont(QFont('tahoma', 16)) self.setToolTip('This is a <b>QWidget</b> widget') btn = QPushButton('Button', self) btn.setToolTip('this is a <b>QPushButton</b>') btn.resize(btn.sizeHint()) btn.move(50,50) self.setGeometry(300,300, 300, 220) self.setWindowTitle('Icon') self.setWindowIcon(QIcon('web.jpg')) self.show()
def init_ui(self): QToolTip.setFont(QFont("SansSerif", 10)) self.setToolTip("This is a <b>QWidget</b> widget") btn = QPushButton("ЙА КНОПКО!!!", self) btn.setToolTip("Это <b>КНОПКО</b>, причем даже на русском языке, " "запиленное 1го января 2016года") btn.resize(btn.sizeHint()) btn.move(50, 50) self.setGeometry(300, 300, 300, 200) self.setWindowTitle("Тестовое приложенько") self.show()
def initUI(self): hbox = QHBoxLayout(self) pixmap = QPixmap('owi_robot_hand_2.2.png') lbl = QLabel(self) lbl.setPixmap(pixmap) hbox.addWidget(lbl) self.setLayout(hbox) QToolTip.setFont(QFont('SansSerif',14)) self.setToolTip('') self.setGeometry(300, 300,1280, 720) self.setWindowTitle('Owi Robot Hand Controler _v4') self.setWindowIcon(QIcon('python.png')) self.show()
def initUI(self): QToolTip.setFont(QFont('SansSerif', 10)) self.setToolTip('This is a widget') btn = QPushButton('Button', self) btn.setToolTip('This is a button') btn.resize(btn.sizeHint()) btn.move(50, 50) self.setGeometry(700, 300, 500, 200) self.setWindowTitle('Lilya\'s first widget') self.show()
def initUI(self): QToolTip.setFont(QFont("SanSerif", 10)) self.setToolTip("This is a <b>Qwidget</b> widget!") btn = QPushButton("Button", self) btn.setToolTip("This is a <b>QPushButton</b> widget!") btn.resize(btn.sizeHint()) btn.move(50,50) self.setGeometry(300,300,300,180) self.setWindowTitle("ToolTips") self.show()
def initUI(self): QToolTip.setFont(QFont('tahoma', 16)) self.setToolTip('This is a <b>QWidget</b> widget') btn = QPushButton('Quit', self) btn.clicked.connect(QCoreApplication.instance().quit) btn.setToolTip('this is a <b>QPushButton</b>') btn.resize(btn.sizeHint()) btn.move(50,50) self.setGeometry(300,300, 300, 220) self.setWindowTitle('Icon') self.setWindowIcon(QIcon('web.jpg')) self.show()
def initUI(self, debug): QToolTip.setFont(QFont('SansSerif', 10)) self.setToolTip('This is a <b>QWidget</b> widget') qbtn = QPushButton('Quit', self) qbtn.setToolTip('This is a <b>QPushButton</b> widget') qbtn.clicked.connect(QCoreApplication.instance().quit) qbtn.resize(qbtn.sizeHint()) qbtn.move(50, 50) label = QLabel('debug = %s' % str(debug), self) label.setFixedWidth(WidgetWidth) label.setAlignment(Qt.AlignCenter) self.setGeometry(300, 300, WidgetWidth, WidgetHeight) self.setWindowTitle('%s %s' % (TemplateName, TemplateVersion)) self.show()
def initUI(self): QToolTip.setFont(QFont('SansSerif', 10)) self.setToolTip('This is <b>Pyganizer</b>.') self.prepare_tasks_UI() self.prepare_events_UI() self.prepare_geometry() self.center() self.load_tasks() self.load_events() self.show()
def initUI(self): # 设置字体,用10px大小的SansSerif字体 QToolTip.setFont(QFont('ansserif', 10)) # 调用此方法创建提示框,并使用富文本格式 self.setToolTip('This is a <b>QWidget</b> widget') # 创建一个按钮,并设置一个提示框 btn = QPushButton('Button',self) btn.setToolTip('This is a <b>QPushButton</b> widget') # 改变按钮的大小和位置,sizehint给了按钮一个推荐的大小 btn.resize(btn.sizeHint()) btn.move(50,50) self.setGeometry(300,300,300,200) self.setWindowTitle('Tooltips') self.show()
def initUI(self): QToolTip.setFont(QFont('SansSerif', 10)) qbtn = QPushButton('Quit', self) qbtn.setToolTip('This is a <b>QPushButton</b> widget') qbtn.clicked.connect(QCoreApplication.instance().quit) qbtn.resize(qbtn.sizeHint()) qbtn.move(50, 50) self.setWindowIcon(QIcon('web.png')) self.setToolTip('This is a <b>QWidget</b> widget') self.setGeometry(300, 300, 250, 150) self.resize(250, 150) self.center() self.setWindowTitle('Center') self.show()
def initUI(self): QToolTip.setFont(QFont('SansSerif', 13)) self.setToolTip('This is a <b>QWidget</b> widget') btn = QPushButton('Button', self) btn.setToolTip('this is a <b>QPushButton</b> widget') btn.resize(btn.sizeHint()) btn.move(50, 50) qbtn = QPushButton('Quit',self) qbtn.clicked.connect(QCoreApplication.instance().quit) qbtn.resize(qbtn.sizeHint()) qbtn.move(50, 100) self.setGeometry(300,300, 300, 320) self.setWindowTitle('Tooltips') # self.setWindowIcon(QIcon('20070420141711640.png')) self.show()
def initUI(self): # 静的メソッドでフォントを設定 QToolTip.setFont(QFont('SansSerif', 10)) # Widgetにツールチップを設定 self.setToolTip('This is a <b>QWidget</b> widget') # ボタンを生成 btn = QPushButton('Button', self) btn.setToolTip('This is a <b>QPushButton</b> widget') btn.resize(btn.sizeHint()) # 推奨サイズに設定 btn.move(50, 50) self.setGeometry(300, 300, 300, 200) self.setWindowTitle('Tooltips') self.show()
def initUI(self): QToolTip.setFont(QFont('tahoma', 16)) self.setToolTip('This is a <b>QWidget</b> widget') self.addMenu() qr = self.frameGeometry() print( " qr " , str(qr)) cp = QDesktopWidget().availableGeometry().center() print (" cp ", str(cp)) qr.moveCenter(cp) print( " cp " , str(cp)) self.move(qr.topLeft()) self.setGeometry(300,300, 300, 220) self.setWindowTitle('Icon') self.setWindowIcon(QIcon('web.jpg')) self.show()
def initUI(self): QToolTip.setFont(QFont('SansSerif', 10)) self.setToolTip('This is <b>MY</b> QWidget') btn = QPushButton("Button", self) btn.clicked.connect(QCoreApplication.instance().quit) btn.setToolTip('This is a <U>QButton</U> Widget') btn.resize(btn.sizeHint()) btn.move(50,50) self.setGeometry(300,300,2000,1000) self.setWindowTitle('Dark') self.setWindowIcon(QIcon('www.png')) self.centr() self.show()
def initUI(self): QToolTip.setFont(QFont('SansSerif', 10)) self.setToolTip('This is a <b>QWidget</b> widget') self.tray_icon = SystemTrayIcon.SystemTrayIcon(QIcon('idea.png'), self) self.tray_icon.show() # self.setStylesheet("border-radius: 10px") # self.autoFillBackground(True) btn = QPushButton('Кнопка', self) btn.setToolTip('This is a <b>QPushButton</b> widget') btn.resize(btn.sizeHint()) btn.move(100, 10) btn.clicked.connect(Windows.notif) exit = QPushButton('Выход', self) exit.resize(btn.sizeHint()) exit.move(10, 10) exit.clicked.connect(QCoreApplication.instance().quit) textSearch = QLineEdit(self) textSearch.move(200, 10) textSearch.resize(470, 26) hbox = QHBoxLayout() hbox.addStretch(1) hbox.addWidget(btn) hbox.addWidget(exit) hbox.addWidget(textSearch) self.setGeometry(1500, 400, 700, 47) self.setWindowTitle('Tooltips') self.setWindowFlags(Qt.FramelessWindowHint) # self.tray_icon.showMessage( # "Tray Program", # "Application was minimized to Tray", # QSystemTrayIcon.Information, # 2000 # ) self.show()
def load_ui(self, centralWidget): #Set Application Font for ToolTips QToolTip.setFont(QFont(settings.FONT_FAMILY, 10)) #Create Main Container to manage Tabs self.mainContainer = main_container.MainContainer(self) self.mainContainer.currentTabChanged[str].connect(self.change_window_title) self.mainContainer.locateFunction[str, str, bool].connect(self.actions.locate_function) self.mainContainer.navigateCode[bool, int].connect(self.actions.navigate_code_history) self.mainContainer.addBackItemNavigation.connect(self.actions.add_back_item_navigation) self.mainContainer.updateFileMetadata.connect(self.actions.update_explorer) self.mainContainer.updateLocator[str].connect(self.actions.update_explorer) self.mainContainer.openPreferences.connect(self._show_preferences) self.mainContainer.dontOpenStartPage.connect(self._dont_show_start_page_again) self.mainContainer.currentTabChanged[str].connect(self.status.handle_tab_changed) # When close the last tab cleanup self.mainContainer.allTabsClosed.connect(self._last_tab_closed) # Update symbols self.mainContainer.updateLocator[str].connect(self.status.explore_file_code) #Create Explorer Panel self.explorer = explorer_container.ExplorerContainer(self) self.central.splitterCentralRotated.connect(self.explorer.rotate_tab_position) self.explorer.updateLocator.connect(self.status.explore_code) self.explorer.goToDefinition[int].connect(self.actions.editor_go_to_line) self.explorer.projectClosed[str].connect(self.actions.close_files_from_project) #Create Misc Bottom Container self.misc = misc_container.MiscContainer(self) self.mainContainer.findOcurrences[str].connect(self.misc.show_find_occurrences) centralWidget.insert_central_container(self.mainContainer) centralWidget.insert_lateral_container(self.explorer) centralWidget.insert_bottom_container(self.misc) if self.explorer.count() == 0: centralWidget.change_explorer_visibility(force_hide=True) self.mainContainer.cursorPositionChange[int, int].connect(self.central.lateralPanel.update_line_col) # TODO: Change current symbol on move #self.connect(self.mainContainer, #SIGNAL("cursorPositionChange(int, int)"), #self.explorer.update_current_symbol) self.mainContainer.enabledFollowMode[bool].connect(self.central.enable_follow_mode_scrollbar) if settings.SHOW_START_PAGE: self.mainContainer.show_start_page()
def initWindow(self, width, height, title, version, isDark): self.window.setWindowTitle(title + " " + version) self.sizeWindow(width, height) self.window.statusBar().setSizeGripEnabled(False) self.centerWindow(); self.window.setAutoFillBackground(True) self.window.setBackgroundRole(QPalette.AlternateBase if isDark else QPalette.Dark) self.window.setWindowIcon(QIcon('../assets/favicon.png')) QToolTip.setFont(QFont('SansSerif', 10)) self.initCentralWidget(isDark); self.window.show()
def initUI(self): QToolTip.setFont(QFont('tahoma', 16)) self.setToolTip('This is a <b>QWidget</b> widget') qr = self.frameGeometry() print( " qr " , str(qr)) cp = QDesktopWidget().availableGeometry().center() print (" cp ", str(cp)) qr.moveCenter(cp) print( " cp " , str(cp)) self.move(qr.topLeft()) btn = QPushButton('Quit', self) btn.clicked.connect(QCoreApplication.instance().quit) btn.setToolTip('this is a <b>QPushButton</b>') btn.resize(btn.sizeHint()) self.setGeometry(300,300, 300, 220) self.setWindowTitle('Icon') self.setWindowIcon(QIcon('web.jpg')) self.show()
def __init__(self, start_server=False): QMainWindow.__init__(self) self.setWindowTitle('NINJA-IDE {Ninja-IDE Is Not Just Another IDE}') self.setMinimumSize(750, 500) QToolTip.setFont(QFont(settings.FONT.family(), 10)) # Load the size and the position of the main window self.load_window_geometry() # self.__project_to_open = 0 # Editables self.__neditables = {} # Filesystem self.filesystem = nfilesystem.NVirtualFileSystem() # Sessions handler self._session = None # Opacity self.opacity = settings.MAX_OPACITY # ToolBar self.toolbar = QToolBar(self) if settings.IS_MAC_OS: self.toolbar.setIconSize(QSize(36, 36)) else: self.toolbar.setIconSize(QSize(24, 24)) self.toolbar.setToolTip(translations.TR_IDE_TOOLBAR_TOOLTIP) self.toolbar.setToolButtonStyle(Qt.ToolButtonIconOnly) # Set toggleViewAction text and tooltip self.toggleView = self.toolbar.toggleViewAction() self.toggleView.setText(translations.TR_TOOLBAR_VISIBILITY) self.toggleView.setToolTip(translations.TR_TOOLBAR_VISIBILITY) self.addToolBar(settings.TOOLBAR_AREA, self.toolbar) if settings.HIDE_TOOLBAR: self.toolbar.hide() # Notificator self.notification = notification.Notification(self) # Plugin Manager # CHECK ACTIVATE PLUGINS SETTING # services = { # 'editor': plugin_services.MainService(), # 'toolbar': plugin_services.ToolbarService(self.toolbar), # 'menuApp': plugin_services.MenuAppService(self.pluginsMenu), # 'menuApp': plugin_services.MenuAppService(None), # 'explorer': plugin_services.ExplorerService(), # 'misc': plugin_services.MiscContainerService(self.misc)} # serviceLocator = plugin_manager.ServiceLocator(services) # serviceLocator = plugin_manager.ServiceLocator(None) # self.plugin_manager = plugin_manager.PluginManager(resources.PLUGINS, # serviceLocator) # self.plugin_manager.discover() # load all plugins! # self.plugin_manager.load_all() # Tray Icon # self.trayIcon = updates.TrayIconUpdates(self) # self.trayIcon.closeTrayIcon.connect(self._close_tray_icon) # self.trayIcon.show() # TODO: # key = Qt.Key_1 # for i in range(10): # if settings.IS_MAC_OS: # short = ui_tools.TabShortcuts( # QKeySequence(Qt.CTRL + Qt.ALT + key), self, i) # else: # short = ui_tools.TabShortcuts( # QKeySequence(Qt.ALT + key), self, i) # key += 1 # short.activated.connect(self._change_tab_index) # short = ui_tools.TabShortcuts( # QKeySequence(Qt.ALT + Qt.Key_0), self, 10) # short.activated.connect(self._change_tab_index) # Register menu categories IDE.register_bar_category(translations.TR_MENU_FILE, 100) IDE.register_bar_category(translations.TR_MENU_EDIT, 110) IDE.register_bar_category(translations.TR_MENU_VIEW, 120) IDE.register_bar_category(translations.TR_MENU_SOURCE, 130) IDE.register_bar_category(translations.TR_MENU_PROJECT, 140) IDE.register_bar_category(translations.TR_MENU_EXTENSIONS, 150) IDE.register_bar_category(translations.TR_MENU_ABOUT, 160) # Register General Menu Items ui_tools.install_shortcuts(self, actions.ACTIONS_GENERAL, self) self.register_service('ide', self) self.register_service('toolbar', self.toolbar) self.register_service('filesystem', self.filesystem) # Register signals connections connections = ({ "target": "main_container", "signal_name": "fileSaved", "slot": self.show_message }, { "target": "main_container", "signal_name": "currentEditorChanged", "slot": self.change_window_title }, { "target": "main_container", "signal_name": "openPreferences", "slot": self.show_preferences }, { "target": "main_container", "signal_name": "currentEditorChanged", "slot": self._change_item_in_project }, { "target": "main_container", "signal_name": "allFilesClosed", "slot": self.change_window_title }, { "target": "projects_explorer", "signal_name": "activeProjectChanged", "slot": self.change_window_title }) self.register_signals('ide', connections) # connections = ( # {'target': 'main_container', # 'signal_name': 'openPreferences()', # 'slot': self.show_preferences}, # {'target': 'main_container', # 'signal_name': 'allTabsClosed()', # 'slot': self._last_tab_closed}, # {'target': 'explorer_container', # 'signal_name': 'changeWindowTitle(QString)', # 'slot': self.change_window_title}, # {'target': 'explorer_container', # 'signal_name': 'projectClosed(QString)', # 'slot': self.close_project}, # ) # Central Widget MUST always exists self.central = IDE.get_service('central_container') self.setCentralWidget(self.central) # Install Services for service_name in self.__IDESERVICES: self.install_service(service_name) IDE.__created = True # Place Status Bar main_container = IDE.get_service('main_container') status_bar = IDE.get_service('status_bar') main_container.add_status_bar(status_bar) # Load Menu Bar menu_bar = IDE.get_service('menu_bar') if menu_bar: # These two are the same service, I think that's ok menu_bar.load_menu(self) menu_bar.load_toolbar(self) # Start server if needed self.s_listener = None if start_server: self.s_listener = QLocalServer() self.s_listener.listen("ninja-ide") self.s_listener.newConnection.connect(self._process_connection) IDE.__instance = self
def build_inter(self): with open("choose.qss") as f: self.setStyleSheet(f.read()) self.setObjectName("choose") QToolTip.setFont(QFont("苹方-简", 16)) self.main_vbox = QVBoxLayout() self.setLayout(self.main_vbox) temp = QPixmap(os.path.join(paths.IMAGE, "exit.png")) self.exit_icon = temp.scaled(40, 40, Qt.KeepAspectRatio) self.exit_btn = QPushLabel(self.exit_icon, CANCEL, master=self) self.exit_btn.clicked.connect(self.choose) self.exit_btn.move(15, 15) self.ch_prompt = QLabel("请选择{}".format(self.ch_type), self) self.ch_prompt.setFont(QFont("苹方-简", 30)) self.ch_prompt.setObjectName("ch_title") self.hbox_top = QHBoxLayout() self.hbox_top.addStretch(1) self.hbox_top.addWidget(self.ch_prompt) self.hbox_top.addStretch(1) self.ch_prompt2 = QLabel("您不能选择未开放的{}".format(self.ch_type), self) self.ch_prompt2.setFont(QFont("苹方-简", 24)) self.ch_prompt2.setObjectName("ch_title") self.hbox_top2 = QHBoxLayout() self.hbox_top2.addStretch(1) self.hbox_top2.addWidget(self.ch_prompt2) self.hbox_top2.addStretch(1) self._btn_layout = [] for ch, choosable in self.ch_list: btn = QPushButton(ch, self) btn_font = QFont("苹方-简", 18) btn_font.setBold(True) btn.setFont(btn_font) btn.setFixedWidth(280) btn.setFixedHeight(52) if choosable: btn.setObjectName("choosable_btn") btn.clicked.connect(self.choose) else: btn.setObjectName("unchoosable_btn") btn.setToolTip("请先尝试完成之前的内容") hbox = QHBoxLayout() hbox.addStretch(1) hbox.addWidget(btn) hbox.addStretch(1) self._btn_layout.append(hbox) self.main_vbox.addStretch(6) self.main_vbox.addLayout(self.hbox_top) self.main_vbox.addStretch(1) self.main_vbox.addLayout(self.hbox_top2) self.main_vbox.addStretch(15) for layout in self._btn_layout: self.main_vbox.addLayout(layout) self.main_vbox.addStretch(1) self.main_vbox.addStretch(5) self.show()
def initUI(self): self.statusBar() # menu menubar = self.menuBar() fileMenu = menubar.addMenu('&File') fileMenu.addAction(self.impAct()) fileMenu.addAction(self.exitAct()) fileMenu = menubar.addMenu('&Perference') fileMenu.addAction(self.setAct()) fileMenu = menubar.addMenu('&Help') fileMenu.addAction(self.helpAct()) QToolTip.setFont(QFont('SansSerif', 14)) self.setToolTip('This is a <b>QWidget</b> widget') #--------- items ----------------- title = QLabel('Title') author = QLabel('Author') review = QLabel('Review') titleEdit = QLineEdit() authorEdit = QLineEdit() reviewEdit = QTextEdit() #--------- Layout ---------------- grid = QGridLayout() self.setLayout(grid) grid.setSpacing(10) grid.addWidget(title, 1, 0) grid.addWidget(titleEdit, 1, 1) grid.addWidget(author, 2, 0) grid.addWidget(authorEdit, 2, 1) grid.addWidget(review, 3, 0) grid.addWidget(reviewEdit, 3, 1, 5, 1) self.setLayout(grid) #--------- Button ---------------- okButton = QPushButton('Confirm', self) okButton.setToolTip('This is a button') okButton.resize(okButton.sizeHint()) okButton.move(50, 100) cancelButton = QPushButton('Quit', self) # bind event cancelButton.clicked.connect(QCoreApplication.instance().quit) cancelButton.resize(cancelButton.sizeHint()) cancelButton.move(50, 50) importButton = QPushButton('Import', self) importButton.clicked.connect(self.importFile) importButton.resize(importButton.sizeHint()) importButton.move(50, 100) # --------- Layout ------------- # hbox = QHBoxLayout() # hbox.addStretch(1) # hbox.addWidget(okButton) # hbox.addWidget(cancelButton) # vbox = QVBoxLayout() # vbox.addStretch(1) # vbox.addLayout(hbox) # self.setLayout(vbox) self.setGeometry(1600, 960, 300, 220) self.resize(1600, 960) self.center() self.setWindowTitle('Kindle Notes Tool') self.setWindowIcon(QIcon('web.png')) self.show()
def mouseMoveEvent(self, QMouseEvent): # font = textCursor.block().charFormat().font() # metrics = QFontMetrics(font) # # b = self.document().findBlockByLineNumber(0) # # cursor = QTextCursor(b) # # cursor.select(QTextCursor.BlockUnderCursor) # # cursor.removeSelectedText() # # height = metrics.height() + 2 # y = QMouseEvent.pos().y() #print(y, height) #print(y/height) cursor_main = self.cursorForPosition(QMouseEvent.pos()) if QApplication.queryKeyboardModifiers() == Qt.ControlModifier: cursor_main.select(QTextCursor.WordUnderCursor) text = cursor_main.selectedText() self.text = text if self.text is not None: url = "https://docs.python.org/3/library/functions.html#" + self.text word = self.text # self.parent.parent.showBrowser(url, word) if self.check_func(word): extraSelections = self.highlightCurrentLine() selection = QTextEdit.ExtraSelection() selection.format.setFontUnderline(True) selection.format.setUnderlineColor(QColor("#00d2ff")) selection.format.setForeground(QColor("#00d2ff")) selection.format.setProperty( QTextFormat.FullWidthSelection, True) selection.cursor = self.cursorForPosition( QMouseEvent.pos()) selection.cursor.select(QTextCursor.WordUnderCursor) extraSelections.append(selection) self.setExtraSelections(extraSelections) cursor = QCursor(Qt.PointingHandCursor) # tooltip = QToolTip() QToolTip.setFont( QFont(editor["ToolTipFont"], editor["ToolTipFontSize"])) word_shown = eval(word).__doc__ if len(word_shown) > 2000: word_shown = word_shown[:2000] QToolTip.showText(QCursor.pos(), "{}".format(word_shown)) QApplication.setOverrideCursor(cursor) QApplication.changeOverrideCursor(cursor) else: self.returnCursorToNormal() else: pass else: self.returnCursorToNormal() extraSelections = self.highlightCurrentLine() self.setExtraSelections(extraSelections) super().mouseMoveEvent(QMouseEvent)
def retranslateUi(self): _translate = QCoreApplication.translate self.setWindowTitle(_translate("MainWindow", "PyDebloatX")) self.label_info.setText( _translate("MainWindow", "Refreshing list of installed apps...")) self.checkBox.setText(_translate("MainWindow", "3D Builder")) self.checkBox_2.setText(_translate("MainWindow", "3D Viewer")) self.checkBox_3.setText(_translate("MainWindow", "Alarms and Clock")) self.checkBox_4.setText(_translate("MainWindow", "Calculator")) self.checkBox_5.setText(_translate("MainWindow", "Calendar and Mail")) self.checkBox_6.setText(_translate("MainWindow", "Camera")) self.checkBox_7.setText(_translate("MainWindow", "Get Help")) self.checkBox_8.setText(_translate("MainWindow", "Groove Music")) self.checkBox_9.setText(_translate("MainWindow", "Maps")) self.checkBox_10.setText(_translate("MainWindow", "Messaging")) self.checkBox_11.setText( _translate("MainWindow", "Mixed Reality Portal")) self.checkBox_12.setText(_translate("MainWindow", "Mobile Plans")) self.checkBox_13.setText(_translate("MainWindow", "Money")) self.checkBox_14.setText(_translate("MainWindow", "Movies && TV")) self.checkBox_15.setText(_translate("MainWindow", "News")) self.checkBox_16.setText(_translate("MainWindow", "Office")) self.checkBox_17.setText(_translate("MainWindow", "OneNote")) self.checkBox_18.setText(_translate("MainWindow", "Paint 3D")) self.checkBox_19.setText(_translate("MainWindow", "People")) self.checkBox_20.setText(_translate("MainWindow", "Photos")) self.checkBox_21.setText(_translate("MainWindow", "Skype")) self.checkBox_22.setText(_translate("MainWindow", "Solitaire")) self.checkBox_23.setText(_translate("MainWindow", "Sports")) self.checkBox_24.setText(_translate("MainWindow", "Sticky Notes")) self.checkBox_25.setText(_translate("MainWindow", "Tips")) self.checkBox_26.setText(_translate("MainWindow", "Voice Recorder")) self.checkBox_27.setText(_translate("MainWindow", "Weather")) self.checkBox_28.setText(_translate("MainWindow", "Windows Feedback")) self.checkBox_29.setText(_translate("MainWindow", "Xbox")) self.checkBox_30.setText(_translate("MainWindow", "Your Phone")) self.label_note.setText( _translate( "MainWindow", "NOTE: Microsoft Edge and Cortana cannot be uninstalled using this GUI." )) self.label_space.setText( _translate("MainWindow", "Total amount of disk space:")) self.label_size.setText(_translate("MainWindow", "0 MB")) self.button_select_all.setText(_translate("MainWindow", "Select All")) self.button_deselect_all.setText( _translate("MainWindow", "Deselect All")) self.button_uninstall.setText(_translate("MainWindow", "Uninstall")) QToolTip.setFont(self.font) self.checkBox.setToolTip('View, create, and personalize 3D objects.') self.checkBox_2.setToolTip( 'View 3D models and animations in real-time.') self.checkBox_3.setToolTip( 'A combination of alarm clock, world clock, timer, and stopwatch.') self.checkBox_4.setToolTip( 'A calculator that includes standard, scientific, and programmer modes, as well as a unit converter.' ) self.checkBox_5.setToolTip( 'Stay up to date with email and schedule managing.') self.checkBox_6.setToolTip( 'Point and shoot to take pictures on Windows 10.') self.checkBox_7.setToolTip( 'Provide a way to ask a question and get recommended solutions or contact assisted support.' ) self.checkBox_8.setToolTip( 'Listen to music on Windows, iOS, and Android devices.') self.checkBox_9.setToolTip( 'Search for places to get directions, business info, and reviews.') self.checkBox_10.setToolTip( 'Quick, reliable SMS, MMS and RCS messaging from your phone.') self.checkBox_11.setToolTip( 'Discover Windows Mixed Reality and dive into more than 3,000 games and VR experiences from Steam®VR and Microsoft Store.' ) self.checkBox_12.setToolTip( 'Sign up for a data plan and connect with mobile operators in your area. You will need a supported SIM card.' ) self.checkBox_13.setToolTip( 'Finance calculators, currency exchange rates and commodity prices from around the world.' ) self.checkBox_14.setToolTip( 'All your movies and TV shows, all in one place, on all your devices.' ) self.checkBox_15.setToolTip( 'Deliver breaking news and trusted, in-depth reporting from the world\'s best journalists.' ) self.checkBox_16.setToolTip( 'Find all your Office apps and files in one place.') self.checkBox_17.setToolTip( 'Digital notebook for capturing and organizing everything across your devices.' ) self.checkBox_18.setToolTip( 'Make 2D masterpieces or 3D models that you can play with from all angles.' ) self.checkBox_19.setToolTip( 'Connect with all your friends, family, colleagues, and acquaintances in one place.' ) self.checkBox_20.setToolTip( 'View and edit your photos and videos, make movies, and create albums.' ) self.checkBox_21.setToolTip( 'Instant message, voice or video call application.') self.checkBox_22.setToolTip( 'Solitaire is one of the most played computer card games of all time.' ) self.checkBox_23.setToolTip( 'Live scores and in-depth game experiences for more than 150 leagues.' ) self.checkBox_24.setToolTip( 'Create notes, type, ink or add a picture, add text formatting, or stick them to the desktop.' ) self.checkBox_25.setToolTip( 'Provide users with information and tips about operating system features.' ) self.checkBox_26.setToolTip( 'Record sounds, lectures, interviews, and other events.') self.checkBox_27.setToolTip( 'Latest weather conditions, accurate 10-day and hourly forecasts.') self.checkBox_28.setToolTip( 'Provide feedback about Windows and apps by sharing suggestions or problems.' ) self.checkBox_29.setToolTip( 'Browse the catalogue, view recommendations, and discover PC games with Xbox Game Pass.' ) self.checkBox_30.setToolTip( 'Link your Android phone and PC to view and reply to text messages, access mobile apps, and receive notifications.' )
# -*- coding: utf-8 -*- from PyQt5.QtWidgets import QApplication, QToolTip from PyQt5.QtGui import QFont from globalvalue import setMainWidget, DefaultFontList, DefaultFontSize, DefaultFontSizeForToolTip from mainwidget import MainWidget import sys from localelanguage import initLocale if __name__ == '__main__': #init locale initLocale() app = QApplication(sys.argv) #Try to init font with default font list for fontName in DefaultFontList: font = QFont(fontName, DefaultFontSize) if font.exactMatch(): app.setFont(font) tipFont = QFont(fontName, DefaultFontSizeForToolTip) QToolTip.setFont(tipFont) break mainWidget = MainWidget() setMainWidget(mainWidget) sys.exit(app.exec_())
def initWindow(self): QToolTip.setFont(QFont('SansSerif', 10)) # main layout frameWidget = QWidget() mainWidget = QSplitter(Qt.Horizontal) frameLayout = QVBoxLayout() self.settingWidget = QWidget() self.settingWidget.setProperty("class","settingWidget") self.receiveSendWidget = QSplitter(Qt.Vertical) self.functionalWiget = QWidget() settingLayout = QVBoxLayout() sendReceiveLayout = QVBoxLayout() sendFunctionalLayout = QVBoxLayout() mainLayout = QHBoxLayout() self.settingWidget.setLayout(settingLayout) self.receiveSendWidget.setLayout(sendReceiveLayout) self.functionalWiget.setLayout(sendFunctionalLayout) mainLayout.addWidget(self.settingWidget) mainLayout.addWidget(self.receiveSendWidget) mainLayout.addWidget(self.functionalWiget) mainLayout.setStretch(0,2) mainLayout.setStretch(1, 6) mainLayout.setStretch(2, 2) menuLayout = QHBoxLayout() mainWidget.setLayout(mainLayout) frameLayout.addLayout(menuLayout) frameLayout.addWidget(mainWidget) frameWidget.setLayout(frameLayout) self.setCentralWidget(frameWidget) # option layout self.settingsButton = QPushButton() self.skinButton = QPushButton("") # self.waveButton = QPushButton("") self.aboutButton = QPushButton() self.functionalButton = QPushButton() self.encodingCombobox = ComboBox() self.encodingCombobox.addItem("ASCII") self.encodingCombobox.addItem("UTF-8") self.encodingCombobox.addItem("UTF-16") self.encodingCombobox.addItem("GBK") self.encodingCombobox.addItem("GB2312") self.encodingCombobox.addItem("GB18030") self.settingsButton.setProperty("class", "menuItem1") self.skinButton.setProperty("class", "menuItem2") self.aboutButton.setProperty("class", "menuItem3") self.functionalButton.setProperty("class", "menuItem4") # self.waveButton.setProperty("class", "menuItem5") self.settingsButton.setObjectName("menuItem") self.skinButton.setObjectName("menuItem") self.aboutButton.setObjectName("menuItem") self.functionalButton.setObjectName("menuItem") # self.waveButton.setObjectName("menuItem") menuLayout.addWidget(self.settingsButton) menuLayout.addWidget(self.skinButton) # menuLayout.addWidget(self.waveButton) menuLayout.addWidget(self.aboutButton) menuLayout.addStretch(0) menuLayout.addWidget(self.encodingCombobox) menuLayout.addWidget(self.functionalButton) # widgets receive and send area self.receiveArea = QTextEdit() self.sendArea = QTextEdit() self.clearReceiveButtion = QPushButton(parameters.strClearReceive) self.sendButtion = QPushButton(parameters.strSend) self.sendHistory = ComboBox() sendWidget = QWidget() sendAreaWidgetsLayout = QHBoxLayout() sendWidget.setLayout(sendAreaWidgetsLayout) buttonLayout = QVBoxLayout() buttonLayout.addWidget(self.clearReceiveButtion) buttonLayout.addStretch(1) buttonLayout.addWidget(self.sendButtion) sendAreaWidgetsLayout.addWidget(self.sendArea) sendAreaWidgetsLayout.addLayout(buttonLayout) sendReceiveLayout.addWidget(self.receiveArea) sendReceiveLayout.addWidget(sendWidget) sendReceiveLayout.addWidget(self.sendHistory) sendReceiveLayout.setStretch(0, 7) sendReceiveLayout.setStretch(1, 2) sendReceiveLayout.setStretch(2, 1) # widgets serial settings serialSettingsGroupBox = QGroupBox(parameters.strSerialSettings) serialSettingsLayout = QGridLayout() serialReceiveSettingsLayout = QGridLayout() serialSendSettingsLayout = QGridLayout() serialPortLabek = QLabel(parameters.strSerialPort) serailBaudrateLabel = QLabel(parameters.strSerialBaudrate) serailBytesLabel = QLabel(parameters.strSerialBytes) serailParityLabel = QLabel(parameters.strSerialParity) serailStopbitsLabel = QLabel(parameters.strSerialStopbits) self.serialPortCombobox = ComboBox() self.serailBaudrateCombobox = ComboBox() self.serailBaudrateCombobox.addItem("9600") self.serailBaudrateCombobox.addItem("19200") self.serailBaudrateCombobox.addItem("38400") self.serailBaudrateCombobox.addItem("57600") self.serailBaudrateCombobox.addItem("115200") self.serailBaudrateCombobox.setCurrentIndex(4) self.serailBaudrateCombobox.setEditable(True) self.serailBytesCombobox = ComboBox() self.serailBytesCombobox.addItem("5") self.serailBytesCombobox.addItem("6") self.serailBytesCombobox.addItem("7") self.serailBytesCombobox.addItem("8") self.serailBytesCombobox.setCurrentIndex(3) self.serailParityCombobox = ComboBox() self.serailParityCombobox.addItem("None") self.serailParityCombobox.addItem("Odd") self.serailParityCombobox.addItem("Even") self.serailParityCombobox.addItem("Mark") self.serailParityCombobox.addItem("Space") self.serailParityCombobox.setCurrentIndex(0) self.serailStopbitsCombobox = ComboBox() self.serailStopbitsCombobox.addItem("1") self.serailStopbitsCombobox.addItem("1.5") self.serailStopbitsCombobox.addItem("2") self.serailStopbitsCombobox.setCurrentIndex(0) self.checkBoxRts = QCheckBox("rts") self.checkBoxDtr = QCheckBox("dtr") self.serialOpenCloseButton = QPushButton(parameters.strOpen) serialSettingsLayout.addWidget(serialPortLabek,0,0) serialSettingsLayout.addWidget(serailBaudrateLabel, 1, 0) serialSettingsLayout.addWidget(serailBytesLabel, 2, 0) serialSettingsLayout.addWidget(serailParityLabel, 3, 0) serialSettingsLayout.addWidget(serailStopbitsLabel, 4, 0) serialSettingsLayout.addWidget(self.serialPortCombobox, 0, 1) serialSettingsLayout.addWidget(self.serailBaudrateCombobox, 1, 1) serialSettingsLayout.addWidget(self.serailBytesCombobox, 2, 1) serialSettingsLayout.addWidget(self.serailParityCombobox, 3, 1) serialSettingsLayout.addWidget(self.serailStopbitsCombobox, 4, 1) serialSettingsLayout.addWidget(self.checkBoxRts, 5, 0,1,1) serialSettingsLayout.addWidget(self.checkBoxDtr, 5, 1,1,1) serialSettingsLayout.addWidget(self.serialOpenCloseButton, 6, 0,1,2) serialSettingsGroupBox.setLayout(serialSettingsLayout) settingLayout.addWidget(serialSettingsGroupBox) # serial receive settings serialReceiveSettingsGroupBox = QGroupBox(parameters.strSerialReceiveSettings) self.receiveSettingsAscii = QRadioButton(parameters.strAscii) self.receiveSettingsHex = QRadioButton(parameters.strHex) self.receiveSettingsAscii.setChecked(True) self.receiveSettingsAutoLinefeed = QCheckBox(parameters.strAutoLinefeed) self.receiveSettingsAutoLinefeedTime = QLineEdit(parameters.strAutoLinefeedTime) self.receiveSettingsAutoLinefeed.setMaximumWidth(75) self.receiveSettingsAutoLinefeedTime.setMaximumWidth(75) serialReceiveSettingsLayout.addWidget(self.receiveSettingsAscii,1,0,1,1) serialReceiveSettingsLayout.addWidget(self.receiveSettingsHex,1,1,1,1) serialReceiveSettingsLayout.addWidget(self.receiveSettingsAutoLinefeed, 2, 0, 1, 1) serialReceiveSettingsLayout.addWidget(self.receiveSettingsAutoLinefeedTime, 2, 1, 1, 1) serialReceiveSettingsGroupBox.setLayout(serialReceiveSettingsLayout) settingLayout.addWidget(serialReceiveSettingsGroupBox) # serial send settings serialSendSettingsGroupBox = QGroupBox(parameters.strSerialSendSettings) self.sendSettingsAscii = QRadioButton(parameters.strAscii) self.sendSettingsHex = QRadioButton(parameters.strHex) self.sendSettingsAscii.setChecked(True) self.sendSettingsScheduledCheckBox = QCheckBox(parameters.strScheduled) self.sendSettingsScheduled = QLineEdit(parameters.strScheduledTime) self.sendSettingsScheduledCheckBox.setMaximumWidth(75) self.sendSettingsScheduled.setMaximumWidth(75) self.sendSettingsCFLF = QCheckBox(parameters.strCRLF) self.sendSettingsCFLF.setChecked(False) serialSendSettingsLayout.addWidget(self.sendSettingsAscii,1,0,1,1) serialSendSettingsLayout.addWidget(self.sendSettingsHex,1,1,1,1) serialSendSettingsLayout.addWidget(self.sendSettingsScheduledCheckBox, 2, 0, 1, 1) serialSendSettingsLayout.addWidget(self.sendSettingsScheduled, 2, 1, 1, 1) serialSendSettingsLayout.addWidget(self.sendSettingsCFLF, 3, 0, 1, 2) serialSendSettingsGroupBox.setLayout(serialSendSettingsLayout) settingLayout.addWidget(serialSendSettingsGroupBox) settingLayout.setStretch(0, 5) settingLayout.setStretch(1, 2.5) settingLayout.setStretch(2, 2.5) # right functional layout self.addButton = QPushButton(parameters.strAdd) functionalGroupBox = QGroupBox(parameters.strFunctionalSend) functionalGridLayout = QGridLayout() functionalGridLayout.addWidget(self.addButton,0,1) functionalGroupBox.setLayout(functionalGridLayout) sendFunctionalLayout.addWidget(functionalGroupBox) self.isHideFunctinal = True self.hideFunctional() # main window self.statusBarStauts = QLabel() self.statusBarStauts.setMinimumWidth(80) self.statusBarStauts.setText("<font color=%s>%s</font>" %("#008200", parameters.strReady)) self.statusBarSendCount = QLabel(parameters.strSend+"(bytes): "+"0") self.statusBarReceiveCount = QLabel(parameters.strReceive+"(bytes): "+"0") self.statusBar().addWidget(self.statusBarStauts) self.statusBar().addWidget(self.statusBarSendCount,2) self.statusBar().addWidget(self.statusBarReceiveCount,3) # self.statusBar() self.resize(800, 500) self.MoveToCenter() self.setWindowTitle(parameters.appName+" V"+str(helpAbout.versionMajor)+"."+str(helpAbout.versionMinor)) icon = QIcon() print("icon path:"+self.DataPath+"/"+parameters.appIcon) icon.addPixmap(QPixmap(self.DataPath+"/"+parameters.appIcon), QIcon.Normal, QIcon.Off) self.setWindowIcon(icon) if sys.platform == "win32": ctypes.windll.shell32.SetCurrentProcessExplicitAppUserModelID("comtool") self.show() return
def initUI(self): font1 = self.qle.font() font1.setPointSize(10) font1.setBold(True) font2 = self.qle2.font() font2.setPointSize(10) font2.setBold(True) font3 = self.qle3.font() font3.setPointSize(10) font3.setBold(True) self.qle.setFont(font1) self.qle2.setFont(font2) self.qle3.setFont(font3) leftbutton = QPushButton(self) leftbutton.setStyleSheet('background:transparent') leftbutton.setIcon(QIcon('icon\left.png')) leftbutton.setIconSize(QSize(36, 36)) leftbutton.setEnabled(True) rightbutton = QPushButton(self) rightbutton.setStyleSheet('background:transparent') rightbutton.setIcon(QIcon('icon\\right.png')) rightbutton.setIconSize(QSize(36, 36)) rightbutton.setEnabled(True) hbox = QHBoxLayout() hbox.addStretch(1) hbox.addWidget(leftbutton) hbox.addWidget(self.qle3) hbox.addWidget(rightbutton) hbox.addStretch(1) layout = QVBoxLayout() layout.addWidget(self.qle) layout.addWidget(self.qle2) layout.addLayout(hbox) self.setLayout(layout) leftbutton.clicked.connect(self.leftfunc) rightbutton.clicked.connect(self.rightfunc) QToolTip.setFont(QFont('Sanserif', 10)) trayIcon = QSystemTrayIcon(QIcon('icon\\title.png'), self) trayIcon.setToolTip('단어 암기 프로그램') menu = QMenu() exitAction = QAction('Exit', self) exitAction.triggered.connect(qApp.quit) menu.addAction(exitAction) testmenu = menu.addMenu('단어 테스트') hangulAction = QAction('뜻 테스트', self) hangulAction.triggered.connect(self.hangultestfunc) englishAction = QAction('영어 테스트', self) englishAction.triggered.connect(self.Englishtestfunc) testmenu.addAction(hangulAction) testmenu.addAction(englishAction) menu.addSeparator() menu.addAction(exitAction) trayIcon.setContextMenu(menu) trayIcon.show() self.setWindowTitle("Word") #self.setStyleSheet("background-color: #87CEFA;") self.setWindowIcon(QIcon('icon\\title.png')) self.setGeometry(300, 100, 200, 100) self.show()
def initUI(self): db = pymysql.connect( host='localhost', user='******', passwd='ie6lan7', db='STU', port=3306) #选择表 self.option_table = QComboBox(self) #下拉选项 self.option_table.move(50,50) cur_option_table = db.cursor() cur_option_table.execute('SHOW TABLES') table_name = cur_option_table.fetchall() for i in table_name: self.option_table.addItem("{}".format(i[0])) cur_option_table.close() #选表控件 self.option_table.activated[str].connect(self.showtable) #三个提示标签 QToolTip.setFont(QFont('SansSerif', 10)) #增加按钮 btn_add = QPushButton('添加',self) btn_add.move(50,625) btn_add.clicked.connect(self.ADD) btn_add.setToolTip('注意属性个数,类型') #删除按钮 btn_del = QPushButton('删除',self) btn_del.move(50,675) btn_del.clicked.connect(self.DEL) btn_del.setToolTip('写入删除条件即可!') #修改按钮 btn_upd = QPushButton('修改',self) btn_upd.move(50,725) btn_upd.clicked.connect(self.UPD) btn_upd.setToolTip('第一个框写where条件,第二个框写修改内容') #显示属性的文本框 self.showdesc = QTextEdit(self) self.showdesc.move(200,10) self.showdesc.resize(1000,45) self.showdesc.setFont(QFont('SansSerif', 18)) #文本框 self.showtext = QTextEdit(self) self.showtext.move(200,50) self.showtext.resize(1000,550) self.showtext.setFont(QFont('SansSerif', 18)) #增加,和删除的框 self.another = QLineEdit('请严格按照格式填写!',self) self.another.move(200,620) self.another.resize(1000,45) self.another.setFont(QFont('SansSerif', 18)) #修改 self.update = QLineEdit('修改内容',self) self.update.move(200,700) self.update.resize(1000,45) self.update.setFont(QFont('SansSerif',18)) #window self.resize(1200, 800) self.center() #self.setGeometry(300, 300, 250, 150) self.setWindowTitle('管理员')
def initUI(self): QToolTip.setFont(QFont('SansSerif', 10)) self.setGeometry(0, 0, self.mainWidgetWidth, self.mainWidgetHeight) self.setWindowTitle('3dpatrolling') self.mainLayout = QVBoxLayout() self.setLayout(self.mainLayout) # self.btn_patrolling = QPushButton('Launch patrolling', self) self.btn_patrolling.setToolTip('Launch the patrolling system.') self.btn_patrolling_world = QPushButton('Select patrol world', self) self.btn_patrolling_world.setToolTip( 'Select a patrolling world in one of the subfolder of maps. A default world is already set in the script sim_launcher_patrolling.' ) self.checkbtn_patrolling_enable = QCheckBox('Enable patrolling', self) self.checkbtn_patrolling_enable.setToolTip( 'Enable/disable the patrolling agent. Disabling can be useful for building and saving a map in a selected world (please, read the documentation).' ) self.checkbtn_patrolling_enable.toggled.connect( self.slot_patrolling_enable) self.checkbtn_patrolling_enable.setChecked(self.patrolling_enable) self.checkbtn_patrolling_interactive = QCheckBox( 'Build graph on start', self) self.checkbtn_patrolling_interactive.setToolTip( 'Interactively build the patrolling graph on start and save it, instead of loading a pre-built graph.' ) self.checkbtn_patrolling_interactive.toggled.connect( self.slot_patrolling_interactive) self.checkbtn_patrolling_interactive.setChecked( self.patrolling_interactive) # self.btn_path_planner = QPushButton('Launch navigation', self) self.btn_path_planner.setToolTip('Launch path planner system') # hbox_vrep = QGroupBox() hboxlayout_vrep = QHBoxLayout() hbox_vrep.setLayout(hboxlayout_vrep) vrep_mode_help_string = 'normal:0 launch VREP in normal mode (you have to press the button play to start \nheadless:1 launch VREP in headless mode (hidden) and automatically start it \nnormal-autostart:2 launch VREP in normal mode and automatically start it (you will not be able to pause!)' self.label_vrep_mode = QLabel() self.label_vrep_mode.setText("V-REP mode") self.label_vrep_mode.setToolTip(vrep_mode_help_string) self.cb_vrep_mode = QComboBox() self.cb_vrep_mode.setToolTip(vrep_mode_help_string) self.cb_vrep_mode.addItems(["normal", "headless", "normal autostart"]) self.cb_vrep_mode.setCurrentIndex(self.vrep_mode) self.cb_vrep_mode.currentIndexChanged.connect( self.slot_vrep_mode_change) hboxlayout_vrep.addWidget(self.label_vrep_mode) hboxlayout_vrep.addWidget(self.cb_vrep_mode) # self.btn_save_map = QPushButton('Save map', self) self.btn_save_map.setToolTip('Save the built map') # self.btn_load_map = QPushButton('Load map', self) self.btn_load_map.setToolTip('Load the built map') # self.btn_kill = QPushButton('Kill', self) self.btn_kill.setToolTip('Kill all nodes of the system') # set layouts self.createPatrollingLayout() self.createPathPlanningLayout() self.mainLayout.addWidget(hbox_vrep) self.mainLayout.addWidget(self.btn_save_map) self.mainLayout.addWidget(self.btn_load_map) self.mainLayout.addWidget(self.btn_kill) # connections self.btn_patrolling.clicked.connect(self.slot_patrolling) self.btn_patrolling_world.clicked.connect(self.slot_patrolling_world) self.btn_path_planner.clicked.connect(self.slot_path_planner) self.btn_save_map.clicked.connect(self.slot_save_map) self.btn_load_map.clicked.connect(self.slot_load_map) self.btn_kill.clicked.connect(self.slot_kill) # show the widget self.show()
def InitWindow(self): self.headingg = QtWidgets.QLabel('<B> POWER ALERT</B>', self) self.headingg.setGeometry( 300, 0, 300, 50 ) # settingGeometry(x-axis, y-axis, width of widget, height of widget) self.headingg.setFont(QFont('SansSerif', 15)) QToolTip.setFont(QFont('SansSerif', 10)) self.l_bat = QtWidgets.QLabel('<B> Set Low Power % </B>', self) self.l_bat.setFont(QFont('SansSerif', 9)) self.l_bat.setGeometry(3, 80, 220, 50) self.l_bat.setToolTip( 'Set the battery % for which you want to get <B> low battery notification. </B>' ) self.h_bat = QtWidgets.QLabel('<B> Set High Power % </B>', self) self.h_bat.setFont(QFont('SansSerif', 9)) self.h_bat.setGeometry(3, 120, 240, 50) self.h_bat.setToolTip( 'Set the battery % for which you want to get <B> high battery notification.</B>' ) self.l_set = QSlider(Qt.Horizontal, self) self.l_set.setGeometry(170, 100, 150, 20) self.l_set.setMinimum(1) self.l_set.setMaximum(100) self.l_set.setValue(20) self.l_set.setTickPosition(QSlider.TicksAbove) self.l_spin = QSpinBox(self) self.l_spin.setGeometry(335, 100, 50, 20) self.l_spin.setValue(20) self.l_set.valueChanged.connect(self.l_spin.setValue) self.l_spin.valueChanged.connect(self.l_set.setValue) self.h_set = QSlider(Qt.Horizontal, self) self.h_set.setGeometry(170, 140, 150, 20) self.h_set.setMinimum(10) self.h_set.setMaximum(100) self.h_set.setValue(95) self.h_set.setTickPosition(QSlider.TicksAbove) self.h_spin = QSpinBox(self) self.h_spin.setGeometry(335, 140, 50, 20) self.h_spin.setValue(95) self.h_set.valueChanged.connect(self.h_spin.setValue) self.h_spin.valueChanged.connect(self.h_set.setValue) self.tl_txt = QtWidgets.QLabel('<B> Time Left: </B>', self) self.tl_txt.setFont(QFont('SansSerif', 9)) self.tl_txt.setGeometry(3, 160, 240, 50) self.ni_txt = QtWidgets.QLabel('<B> ALERT Interval: </B>', self) self.ni_txt.setFont(QFont('SansSerif', 9)) self.ni_txt.setGeometry(3, 200, 240, 50) self.n_interval = QtWidgets.QLineEdit("10", self) # self.n_interval.setText("10") self.n_interval.setGeometry(180, 210, 40, 30) self.sec = QtWidgets.QLabel('(seconds)', self) self.sec.setFont(QFont('SansSerif', 9)) self.sec.setGeometry(230, 210, 80, 30) self.runn = QPushButton("RUN", self) self.runn.setFont(QFont('SansSerif', 9, weight=QFont.Bold)) self.runn.setGeometry(100, 260, 80, 50) self.runn.clicked.connect(self.notification) self.bat_display = QProgressBar(self) self.bat_display.setGeometry(230, 370, 400, 80) self.bat_display.setFont(QFont('SansSerif', 20, weight=QFont.Bold)) self.created_by = QtWidgets.QLabel( '<B> Created by- Manvir Singh Channa</B>', self) self.created_by.setGeometry(620, 440, 300, 50) self.to_contact = QtWidgets.QLabel( '<B> Contact for feedback- [email protected]</B>', self) self.to_contact.setGeometry(500, 460, 570, 50) self.setWindowTitle('Power Alert') self.setWindowIcon(QIcon('Icon.png')) self.setGeometry(self.top, self.bottom, self.height, self.width) self.show()
def insertRow(self, val: list): itemBID = QTableWidgetItem(val[0]) itemBID.setTextAlignment(Qt.AlignCenter) itemNAME = QTableWidgetItem('《' + val[1] + '》') itemNAME.setTextAlignment(Qt.AlignCenter) itemAUTHOR = QTableWidgetItem(val[2]) itemAUTHOR.setTextAlignment(Qt.AlignCenter) itemDATE = QTableWidgetItem(val[3]) itemDATE.setTextAlignment(Qt.AlignCenter) itemPRESS = QTableWidgetItem(val[4]) itemPRESS.setTextAlignment(Qt.AlignCenter) itemPOSITION = QTableWidgetItem(val[5]) itemPOSITION.setTextAlignment(Qt.AlignCenter) itemSUM = QTableWidgetItem(str(val[6]) + '/' + str(val[7])) itemSUM.setTextAlignment(Qt.AlignCenter) itemOPERATE = QToolButton(self.table) itemOPERATE.setFixedSize(70, 25) if val[-1] == '借书': itemOPERATE.setText('借书') itemOPERATE.clicked.connect(lambda: self.borrowBook(val[0])) itemOPERATE.setStyleSheet(''' *{ color: white; font-family: 微软雅黑; background: rgba(38, 175, 217, 1); border: 0; border-radius: 10px; font-size:18px; } ''') else: itemOPERATE.setText('不可借') itemOPERATE.setEnabled(False) itemOPERATE.setToolTip(val[-1]) QToolTip.setFont(QFont('微软雅黑', 15)) itemOPERATE.setStyleSheet(''' QToolButton{ color: white; font-family: 微软雅黑; background: rgba(200, 200, 200, 1); border: 0; border-radius: 10px; font-size:18px; } QToolTip{ color: black; border: 1px solid rgba(200, 200, 200, 1); } ''') itemLayout = QHBoxLayout() itemLayout.setContentsMargins(0, 0, 0, 0) itemLayout.addWidget(itemOPERATE) itemWidget = QWidget() itemWidget.setLayout(itemLayout) self.table.insertRow(1) self.table.setItem(1, 0, itemBID) self.table.setItem(1, 1, itemNAME) self.table.setItem(1, 2, itemAUTHOR) self.table.setItem(1, 3, itemDATE) self.table.setItem(1, 4, itemPRESS) self.table.setItem(1, 5, itemPOSITION) self.table.setItem(1, 6, itemSUM) self.table.setCellWidget(1, 7, itemWidget)
def __init__(self): super(MainWindow, self).__init__() QToolTip.setFont(QFont('SansSerif', 10)) # Set up the user interface from Designer. self.setupUi(self) # Make some local modifications. self.btnSearch.setToolTip("Click to start the program \u03B4 \u03B8") self.cmbVariables.setCurrentIndex(1) self.cmbPowellEpsilon.setCurrentIndex(3) self.cmbGoldenSearchEpsilon.setCurrentIndex(6) # Set lbl for sigma (\u03B4) and theta (\u03B8) self.lblConstrDelta1.setText("\u03B41") self.lblConstrDelta2.setText("\u03B42") self.lblConstrDelta3.setText("\u03B43") self.lblConstrDelta4.setText("\u03B44") self.lblConstrDelta5.setText("\u03B45") self.lblConstrTheta1.setText("\u03B81") self.lblConstrTheta2.setText("\u03B82") self.lblConstrTheta3.setText("\u03B83") self.lblConstrTheta4.setText("\u03B84") self.lblConstrTheta5.setText("\u03B85") # Connect up the buttons and combo boxes. self.cmbConstraints.activated.connect(self.nbConstrChanged) self.cmbVariables.activated.connect(self.nbVarChanged) self.cmbObjFun.activated.connect(self.setMeritum) self.cmbMaxIterations.activated.connect(self.maxIterationsChanged) self.cmbPowellEpsilon.activated.connect(self.powellEpsilonChanged) self.btnSearch.clicked.connect(self.startSearch) self.btnSearch2.clicked.connect(self.startSearch) self.btnClearLog.clicked.connect(self.logResults.clear) # Connect x0 inputs: self.inputX0_1.editingFinished.connect(self.x0Changed) self.inputX0_2.editingFinished.connect(self.x0Changed) self.inputX0_3.editingFinished.connect(self.x0Changed) self.inputX0_4.editingFinished.connect(self.x0Changed) self.inputX0_5.editingFinished.connect(self.x0Changed) # Connect constraints equations inputs: self.inputConstraint1.editingFinished.connect(self.constraintsChanged) self.inputConstraint2.editingFinished.connect(self.constraintsChanged) self.inputConstraint3.editingFinished.connect(self.constraintsChanged) self.inputConstraint4.editingFinished.connect(self.constraintsChanged) self.inputConstraint5.editingFinished.connect(self.constraintsChanged) # Connect constraints parameters: self.dsbConstrDelta1.valueChanged.connect(self.constraintsChanged) self.dsbConstrDelta2.valueChanged.connect(self.constraintsChanged) self.dsbConstrDelta3.valueChanged.connect(self.constraintsChanged) self.dsbConstrDelta4.valueChanged.connect(self.constraintsChanged) self.dsbConstrDelta5.valueChanged.connect(self.constraintsChanged) self.dsbConstrTheta1.valueChanged.connect(self.constraintsChanged) self.dsbConstrTheta2.valueChanged.connect(self.constraintsChanged) self.dsbConstrTheta3.valueChanged.connect(self.constraintsChanged) self.dsbConstrTheta4.valueChanged.connect(self.constraintsChanged) self.dsbConstrTheta5.valueChanged.connect(self.constraintsChanged) # Connect Powell parameters: self.dSBM1.valueChanged.connect(self.m1ChangedDSBox) self.hSldM1.valueChanged.connect(self.m1ChangedHSld) self.dSBM2.valueChanged.connect(self.m2ChangedDSBox) self.hSldM2.valueChanged.connect(self.m2ChangedHSld) self.inputcMin.editingFinished.connect(self.cMinChangedInputLine) self.hSldcMin.valueChanged.connect(self.cMinChangedHSld) # Connect searching in direction parameters: self.dsbBracketStep.valueChanged.connect(self.bracketStepChanged) self.dsbGoldenSearchWindow.valueChanged.connect( self.goldenSearchWindowChanged) self.checkBoxBracketing.stateChanged.connect( self.bracketingOptionChanged) self.cmbGoldenSearchEpsilon.activated.connect( self.goldenSearchEpsilonChanged) # Set up variables and constrains inputs: self.setActiveConstrainInputs(self.numberOfConstraints) self.setActiveVariableInputs(int(self.cmbVariables.currentText())) self.meritum = str2fun(self.cmbObjFun.currentText()) self.setXStart(self.numberOfVariables) self.setMaxInterations(int(self.cmbMaxIterations.currentText())) self.setPowellEpsilon(float(self.cmbPowellEpsilon.currentText())) self.setcMin(self.cMin) # Set up states for searching in direction self.dsbBracketStep.setDisabled(False) self.lblBracketStep.setDisabled(False) self.dsbGoldenSearchWindow.setDisabled(True) self.lblGoldenSearchWindow.setDisabled(True) # Connect plot and parameters inputs self.btnPlot.clicked.connect(self.startPlot) self.inputResolution.editingFinished.connect( self.plotResolutionChanged) self.inputX1RangeL.editingFinished.connect(self.plotRangesChanged) self.inputX1RangeR.editingFinished.connect(self.plotRangesChanged) self.inputX2RangeL.editingFinished.connect(self.plotRangesChanged) self.inputX2RangeR.editingFinished.connect(self.plotRangesChanged) # Show the window at the end self.show()
def init(self): QToolTip.setFont(QFont('微软雅黑',18)) self.setWindowTitle('窗口') self.setWindowIcon(QIcon('./图标/cat.svg')) self.resize(400,300) self.setToolTip('这是文本区') self.status=self.statusBar() self.status.showMessage('欢迎使用',5000) textedit=QTextEdit(self) self.setCentralWidget(textedit) menubar=self.menuBar() menubar.setFont(QFont('宋体',12)) menu1=menubar.addMenu('文件') menu2=menubar.addMenu('编辑') menu3=menubar.addMenu('选择') menu4=menubar.addMenu('查看') menu5=menubar.addMenu('转到') menu6=menubar.addMenu('调试') menu7=menubar.addMenu('终端') menu8=menubar.addMenu('帮助') menu1.setStatusTip('文件') act11=QAction('新建文件',self) act12=QAction('新建窗口',self) act13=QAction('关闭文件夹',self) act14=QAction('退出',self) act14.setStatusTip('退出') act14.setShortcut('Ctrl+Q') act14.triggered.connect(self.close) menu1.addActions([act11,act12,act13,act14]) act21=QAction('撤销',self) act22=QAction('恢复',self) act23=QAction('剪切',self) act24=QAction('查找',self) menu2.addActions([act21,act22]) menu2.addSeparator() menu2.addActions([act23,act24]) menu2.setToolTip('编辑') act31=QAction('全选',self) act31.setCheckable(True) act31.setChecked(True) act31.setStatusTip('选中') act31.setShortcut('Ctrl+A') act31.triggered.connect(self.togglemenu) act32=QAction('展开选定内容',self) act32.setStatusTip('展开') act33=QAction('缩小选定范围',self) act34=QAction('向上复制一行',self) act35=QAction('向下复制一行',self) menu3.addActions([act31,act32,act33,act34,act35]) toolbar=self.addToolBar('工具栏') act=QAction(QIcon('./图标/tigger.jpg'),'退出',self) act.triggered.connect(self.close) toolbar.addAction(act) self.center()
def __init__(self, start_server=False): QMainWindow.__init__(self) self.setWindowTitle('NINJA-IDE {Ninja-IDE Is Not Just Another IDE}') self.setMinimumSize(750, 500) QToolTip.setFont(QFont(settings.FONT.family(), 10)) # Load the size and the position of the main window self.load_window_geometry() # Editables self.__neditables = {} # Filesystem self.filesystem = nfilesystem.NVirtualFileSystem() # Interpreter service self.interpreter = interpreter_service.InterpreterService() # Sessions handler self._session_manager = session_manager.SessionsManager(self) IDE.register_service("session_manager", self._session_manager) self._session = None # Opacity self.opacity = settings.MAX_OPACITY # ToolBar # # Set toggleViewAction text and tooltip # Notificator self.notification = notification.Notification(self) # Plugin Manager # CHECK ACTIVATE PLUGINS SETTING # 'misc': plugin_services.MiscContainerService(self.misc)} # self.plugin_manager = plugin_manager.PluginManager(resources.PLUGINS, # serviceLocator) # load all plugins! # Tray Icon # TODO: # QKeySequence(Qt.CTRL + Qt.ALT + key), self, i) # QKeySequence(Qt.ALT + key), self, i) # QKeySequence(Qt.ALT + Qt.Key_0), self, 10) # Register menu categories IDE.register_bar_category(translations.TR_MENU_FILE, 100) IDE.register_bar_category(translations.TR_MENU_EDIT, 110) IDE.register_bar_category(translations.TR_MENU_VIEW, 120) IDE.register_bar_category(translations.TR_MENU_SOURCE, 130) IDE.register_bar_category(translations.TR_MENU_PROJECT, 140) IDE.register_bar_category(translations.TR_MENU_EXTENSIONS, 150) IDE.register_bar_category(translations.TR_MENU_ABOUT, 160) # Register General Menu Items ui_tools.install_shortcuts(self, actions.ACTIONS_GENERAL, self) self.register_service("ide", self) self.register_service("interpreter", self.interpreter) self.register_service("filesystem", self.filesystem) self.toolbar = IDE.get_service("toolbar") # Register signals connections connections = ( { "target": "main_container", "signal_name": "fileSaved", "slot": self.show_message }, { "target": "main_container", "signal_name": "currentEditorChanged", "slot": self.change_window_title }, { "target": "main_container", "signal_name": "openPreferences", "slot": self.show_preferences }, { "target": "main_container", "signal_name": "currentEditorChanged", "slot": self._change_item_in_project }, { "target": "main_container", "signal_name": "allFilesClosed", "slot": self.change_window_title }, { "target": "projects_explorer", "signal_name": "activeProjectChanged", "slot": self.change_window_title } ) self.register_signals('ide', connections) # {'target': 'main_container', # {'target': 'main_container', # {'target': 'explorer_container', # {'target': 'explorer_container', # Central Widget MUST always exists self.central = IDE.get_service('central_container') self.setCentralWidget(self.central) # Install Services for service_name in self.__IDESERVICES: self.install_service(service_name) IDE.__created = True # Place Status Bar main_container = IDE.get_service('main_container') status_bar = IDE.get_service('status_bar') main_container.add_status_bar(status_bar) # Load Menu Bar menu_bar = IDE.get_service('menu_bar') if menu_bar: # These two are the same service, I think that's ok menu_bar.load_menu(self) menu_bar.load_toolbar(self) # Start server if needed self.s_listener = None if start_server: self.s_listener = QLocalServer() self.s_listener.listen("ninja_ide") self.s_listener.newConnection.connect(self._process_connection) # Load interpreters self.load_interpreters() IDE.__instance = self
def initUI(self): font = QFont() font.setPointSize(12) QToolTip.setFont(font) addBtn = QPushButton(" Додати зображення ", self) addBtn.setFont(font) addBtn.setFixedSize(210, 40) addBtn.clicked.connect(self.showDialog) recognBtn = QPushButton("Розпізнати", self) recognBtn.setFont(font) recognBtn.setFixedSize(210, 40) recognBtn.clicked.connect(self.recognize) delBtn = QPushButton(self) delBtn.setFixedSize(50, 50) delBtn.setIcon(QIcon("images/delete.png")) delBtn.clicked.connect(self.deleteImg) delBtn.setToolTip("Видалити зображення з набору") rotateBtn = QPushButton(self) rotateBtn.setFixedSize(50, 50) rotateBtn.setIcon(QIcon("images/rotate.png")) rotateBtn.clicked.connect(self.rotateImg) rotateBtn.setToolTip("Повернути зображення") self.pic = QLabel("", self) self.pic.setFixedSize(330, 580) self.pic.setFrameShape(QFrame.Panel) lbl = QLabel(" Список зображень: ") lbl.setFont(font) lbl.setFixedSize(300, 40) self.picList = QListView(self) self.picList.setFixedSize(300, 300) self.picList.clicked.connect(self.itemClicked) self.listModel = QStandardItemModel(self.picList) self.picList.setModel(self.listModel) splitter = QSplitter(Qt.Vertical) vbtnbox = QVBoxLayout() vbtnbox.addStretch(1) vbtnbox.addWidget(addBtn) vbtnbox.addWidget(recognBtn) vbtnbox.setAlignment(Qt.AlignCenter) vlistbox = QVBoxLayout() vlistbox.addStretch(1) vlistbox.addWidget(lbl) vlistbox.addWidget(self.picList) hbtnbox = QHBoxLayout() hbtnbox.addWidget(delBtn) hbtnbox.addWidget(rotateBtn) vimgbox = QVBoxLayout() vimgbox.addWidget(self.pic) vimgbox.addLayout(hbtnbox) vbox = QVBoxLayout() vbox.addLayout(vlistbox) vbox.addLayout(vbtnbox) hbox = QHBoxLayout() #hbox.addWidget(self.pic, alignment=Qt.AlignLeft) hbox.addLayout(vimgbox) hbox.addWidget(splitter) hbox.addLayout(vbox) self.setLayout(hbox) self.setGeometry(300, 300, 600, 600) self.setWindowTitle('OMR') self.show()
def initUI(self): QToolTip.setFont(QFont('SansSerif', 10)) self.setToolTip('This is a <b>QWidget</b> widget') #''' self.btn = QPushButton('SEARCH', self) self.btn.setToolTip('This is a <b>QPushButton</b> widget') self.btn.resize(self.btn.sizeHint()) self.btn.move(220, 130) #''' ''' icon = QIcon('button.png') btn = QPushButton() btn.setIcon(icon) btn.setIconSize(QSize(24,24)) btn.resize(btn.sizeHint()) ''' vbox = QVBoxLayout(self) label = QLabel(self) image = False if image: path = 'GUI_data/JJ_Lin_From_M.E._To_Myself.jpg' else: path = 'GUI_data/No-album-art-itunes.jpg' pixmap = QPixmap(path) pixmap = pixmap.scaledToHeight(450) label.setPixmap(pixmap) #label.setAlignment(Qt.AlignBottom) label.setAlignment(Qt.AlignCenter) ''' name = '不為誰而作的歌' singer = '林俊傑' album = '和自己對話' ''' name = '' singer = '' album = '' inform = '歌手: ' + singer + ' 收錄專輯: ' + album self.text1 = QLabel(name) self.text2 = QLabel(inform) self.text1.setFont(QFont('SansSerif', 25)) self.text2.setFont(QFont('SansSerif', 12)) self.text1.setAlignment(Qt.AlignCenter) self.text2.setAlignment(Qt.AlignCenter) count = '' self.count = QLabel(count) vbox.addWidget(self.text1) vbox.addWidget(self.text2) vbox.addWidget(label) vbox.addWidget(self.btn) self.resize(500, 550) self.setWindowTitle('Audio Fingerprinting') self.center() self.btn.clicked.connect(self.OpenClick) self.show()
def initWindow(self): QToolTip.setFont(QFont('SansSerif', 10)) # main layout self.frameWidget = QWidget() mainWidget = QSplitter(Qt.Horizontal) self.frameLayout = QVBoxLayout() self.settingWidget = QWidget() settingLayout = QVBoxLayout() self.settingWidget.setProperty("class","settingWidget") mainLayout = QVBoxLayout() self.settingWidget.setLayout(settingLayout) mainLayout.addWidget(self.settingWidget) mainLayout.setStretch(0,2) menuLayout = QHBoxLayout() self.progressHint = QLabel() self.progressHint.hide() self.progressbarRootWidget = QWidget() progressbarLayout = QVBoxLayout() self.progressbarRootWidget.setProperty("class","progressbarWidget") self.progressbarRootWidget.setLayout(progressbarLayout) self.downloadWidget = QWidget() downloadLayout = QVBoxLayout() self.downloadWidget.setProperty("class","downloadWidget") self.downloadWidget.setLayout(downloadLayout) mainWidget.setLayout(mainLayout) # menu # ----- # settings and others # ----- # progress bar # ----- # download button # ----- # status bar self.frameLayout.addLayout(menuLayout) self.frameLayout.addWidget(mainWidget) self.frameLayout.addWidget(self.progressHint) self.frameLayout.addWidget(self.progressbarRootWidget) self.frameLayout.addWidget(self.downloadWidget) self.frameWidget.setLayout(self.frameLayout) self.setCentralWidget(self.frameWidget) self.setFrameStrentch(0) # option layout self.langButton = QPushButton() self.skinButton = QPushButton() self.aboutButton = QPushButton() self.langButton.setProperty("class", "menuItemLang") self.skinButton.setProperty("class", "menuItem2") self.aboutButton.setProperty("class", "menuItem3") self.langButton.setObjectName("menuItem") self.skinButton.setObjectName("menuItem") self.aboutButton.setObjectName("menuItem") menuLayout.addWidget(self.langButton) menuLayout.addWidget(self.skinButton) menuLayout.addWidget(self.aboutButton) menuLayout.addStretch(0) # widgets file select fileSelectGroupBox = QGroupBox(tr("SelectFile")) settingLayout.addWidget(fileSelectGroupBox) fileSelectLayout = QHBoxLayout() fileSelectGroupBox.setLayout(fileSelectLayout) self.filePathWidget = QLineEdit() self.openFileButton = QPushButton(tr("OpenFile")) fileSelectLayout.addWidget(self.filePathWidget) fileSelectLayout.addWidget(self.openFileButton) # widgets board select boardSettingsGroupBox = QGroupBox(tr("BoardSettings")) settingLayout.addWidget(boardSettingsGroupBox) boardSettingsLayout = QGridLayout() boardSettingsGroupBox.setLayout(boardSettingsLayout) self.boardLabel = QLabel(tr("Board")) self.boardCombobox = ComboBox() self.boardCombobox.addItem(parameters.SipeedMaixDock) self.boardCombobox.addItem(parameters.SipeedMaixBit) self.boardCombobox.addItem(parameters.SipeedMaixGoE) self.boardCombobox.addItem(parameters.SipeedMaixGoD) self.boardCombobox.addItem(parameters.KendriteKd233) self.burnPositionLabel = QLabel(tr("BurnTo")) self.burnPositionCombobox = ComboBox() self.burnPositionCombobox.addItem(tr("Flash")) self.burnPositionCombobox.addItem(tr("SRAM")) boardSettingsLayout.addWidget(self.boardLabel, 0, 0) boardSettingsLayout.addWidget(self.boardCombobox, 0, 1) boardSettingsLayout.addWidget(self.burnPositionLabel, 1, 0) boardSettingsLayout.addWidget(self.burnPositionCombobox, 1, 1) # widgets serial settings serialSettingsGroupBox = QGroupBox(tr("SerialSettings")) serialSettingsLayout = QGridLayout() serialPortLabek = QLabel(tr("SerialPort")) serailBaudrateLabel = QLabel(tr("SerialBaudrate")) self.serialPortCombobox = ComboBox() self.serailBaudrateCombobox = ComboBox() self.serailBaudrateCombobox.addItem("115200") self.serailBaudrateCombobox.addItem("921600") self.serailBaudrateCombobox.addItem("1500000") self.serailBaudrateCombobox.addItem("2000000") self.serailBaudrateCombobox.addItem("3500000") self.serailBaudrateCombobox.addItem("4000000") self.serailBaudrateCombobox.addItem("4500000") self.serailBaudrateCombobox.setCurrentIndex(1) self.serailBaudrateCombobox.setEditable(True) serialSettingsLayout.addWidget(serialPortLabek,0,0) serialSettingsLayout.addWidget(serailBaudrateLabel, 1, 0) serialSettingsLayout.addWidget(self.serialPortCombobox, 0, 1) serialSettingsLayout.addWidget(self.serailBaudrateCombobox, 1, 1) serialSettingsGroupBox.setLayout(serialSettingsLayout) settingLayout.addWidget(serialSettingsGroupBox) # set stretch settingLayout.setStretch(0,1) settingLayout.setStretch(1,1) settingLayout.setStretch(2,2) # widgets progress bar self.progressbar = QProgressBar(self.progressbarRootWidget) self.progressbar.setGeometry(10, 0, 360, 40) self.progressbar.setValue(0) self.progressbarRootWidget.hide() # widgets download area self.downloadButton = QPushButton(tr("Download")) downloadLayout.addWidget(self.downloadButton) # main window self.statusBarStauts = QLabel() self.statusBarStauts.setMinimumWidth(80) self.statusBarStauts.setText("<font color=%s>%s</font>" %("#1aac2d", tr("DownloadHint"))) self.statusBar().addWidget(self.statusBarStauts) self.resize(400, 550) self.MoveToCenter() self.setWindowTitle(parameters.appName+" V"+str(helpAbout.versionMajor)+"."+str(helpAbout.versionMinor)) icon = QIcon() print("icon path:"+self.DataPath+"/"+parameters.appIcon) icon.addPixmap(QPixmap(self.DataPath+"/"+parameters.appIcon), QIcon.Normal, QIcon.Off) self.setWindowIcon(icon) if sys.platform == "win32": ctypes.windll.shell32.SetCurrentProcessExplicitAppUserModelID(parameters.appName) self.show() print("config file path:",os.getcwd()+"/"+parameters.configFilePath)
def __init__(self, parent=None): super().__init__(parent) self.robot = None QApplication.setStyle(QStyleFactory.create("Fusion")) QToolTip.setFont(QFont("SansSerif", 10)) self.setFixedSize(800, 450) self.setWindowTitle("Robot Jogger") self.setWindowIcon( QIcon(os.path.join(os.path.dirname(__file__), "robot.png"))) self.setToolTip("Robot jogger based on Common Robot Interface") self.robotLabel = QLabel("robot:") self.robotLabel.setFixedWidth(50) self.robotLabel.setFixedHeight(20) self.robotLabel.setAlignment(Qt.AlignRight | Qt.AlignVCenter) self.robotComboBox = QComboBox() self.robotComboBox.addItems(self.ROBOTS) self.robotComboBox.setCurrentText("abb") self.robotComboBox.setFixedWidth(70) self.robotComboBox.setFixedHeight(20) self.robotComboBox.setEnabled(True) self.ipLabel = QLabel("ip:") self.ipLabel.setFixedWidth(20) self.ipLabel.setFixedHeight(20) self.ipLabel.setAlignment(Qt.AlignRight | Qt.AlignVCenter) self.ipEditBox = LineEdit() self.ipEditBox.setFixedHeight(20) self.ipEditBox.setEnabled(True) self.portLabel = QLabel("port:") self.portLabel.setFixedWidth(40) self.portLabel.setFixedHeight(20) self.portLabel.setAlignment(Qt.AlignRight | Qt.AlignVCenter) self.portEditBox = LineEdit() self.portEditBox.setFixedWidth(60) self.portEditBox.setFixedHeight(20) self.portEditBox.setEnabled(True) self.connectPushButton = QPushButton("&Connect") self.connectPushButton.setFixedHeight(20) self.connectPushButton.setDefault(False) self.connectPushButton.setAutoDefault(True) self.connectPushButton.setEnabled(True) self.disconnectPushButton = QPushButton("&Disconnect") self.disconnectPushButton.setFixedHeight(20) self.disconnectPushButton.setDefault(False) self.disconnectPushButton.setAutoDefault(False) self.disconnectPushButton.setEnabled(False) topLayout = QGridLayout() topLayout.setHorizontalSpacing(20) topLayout.setVerticalSpacing(20) topLayout.setContentsMargins(10, 10, 10, 10) topLayout.addWidget(self.robotLabel, 0, 0) topLayout.addWidget(self.robotComboBox, 0, 1) topLayout.addWidget(self.ipLabel, 0, 2) topLayout.addWidget(self.ipEditBox, 0, 3) topLayout.addWidget(self.portLabel, 0, 4) topLayout.addWidget(self.portEditBox, 0, 5) topLayout.addWidget(self.connectPushButton, 0, 6) topLayout.addWidget(self.disconnectPushButton, 1, 6) robot = self.robotComboBox.currentText() self.createTabWidget(robot) self.tabWidget.setEnabled(False) mainLayout = QVBoxLayout() mainLayout.addLayout(topLayout) mainLayout.addWidget(self.tabWidget) self.setLayout(mainLayout) self.robotComboBox.currentIndexChanged[str].connect( self.onRobotChanged) self.ipEditBox.textEditingFinished.connect(self.onIPAddressChanged) self.portEditBox.textEditingFinished.connect(self.onPortChanged) self.connectPushButton.clicked.connect(self.onConnect) self.disconnectPushButton.clicked.connect(self.onDisconnect) self.axesComboBox.currentIndexChanged.connect(self.onAxesChanged) self.linearSpeedEditBox.textEditingFinished.connect( self.onLinearSpeedChanged) self.angularSpeedEditBox.textEditingFinished.connect( self.onAngularSpeedChanged) self.blendRadiusEditBox.textEditingFinished.connect( self.onBlendRadiusChanged) self.tcpEditWidget.editingFinished.connect(self.onTCPChanged) self.coordFrameEditWidget.editingFinished.connect( self.onCoordFrameChanged) self.poseControlWidget.valueChanged.connect(self.onPoseChanged) self.tabWidget.currentChanged.connect(self.onTabChanged)
#!/usr/bin/env python # -*- coding: utf-8 -*- # @Date : 2018-09-02 17:22:02 # @Author : Yong Lee ([email protected]) # @Link : http://www.cnblogs.com/honkly/ # @Version : $Id$ import sys from PyQt5.QtWidgets import QWidget,QToolTip,QPushButton,QApplication from PyQt5.QtGui import QFont app = QApplication(sys.argv) w = QWidget() w.setGeometry(300,300,300,200) w.setWindowTitle('提示框') QToolTip.setFont(QFont('SansSerif',20)) w.setToolTip('这是一个窗口\n设计者:honkly') button = QPushButton('Button',w) button.setToolTip('这是一个按钮、设计者:honkly') button.resize(button.sizeHint()) button.move(50,50) w.show() sys.exit(app.exec_())
def retranslateUi(self, MainWindow): _translate = QtCore.QCoreApplication.translate MainWindow.setWindowTitle(_translate("MainWindow", "MainWindow")) self.pushButton.setText(_translate("MainWindow", "GeneTreetion")) self.pushButton_2.setText(_translate("MainWindow", "Open project")) self.pushButton_2.setToolTip('Click <b>here</b> to change your old project') QToolTip.setFont(QFont('PurisaBold', 13)) self.pushButton_3.setText(_translate("MainWindow", "Language")) self.pushButton_3.setToolTip('Click <b>here</b> to select language') QToolTip.setFont(QFont('PurisaBold', 13)) self.pushButton_4.setText(_translate("MainWindow", "About us")) self.pushButton_4.setToolTip('Click <b>here</b> if you want to get more information about the app') QToolTip.setFont(QFont('PurisaBold', 13)) self.pushButton_6.setText(_translate("MainWindow", "Project name")) self.pushButton_8.setText(_translate("MainWindow", "Add node")) self.pushButton_8.setToolTip('Click <b>here</b> to add node to your family tree') QToolTip.setFont(QFont('PurisaBold', 13)) self.pushButton_9.setText(_translate("MainWindow", "Delete node")) self.pushButton_9.setToolTip('Click <b>here</b> to delete node from your family tree') QToolTip.setFont(QFont('PurisaBold', 13)) self.pushButton_11.setText(_translate("MainWindow", "Help")) self.pushButton_11.setToolTip('Click <b>here</b> if you need some tips how to use GeneTreetion') QToolTip.setFont(QFont('PurisaBold', 13))