def __init__(self): super().__init__() self.centralWidget = CentralWidget() self.centralWidget.setObjectName("centralWidget") self.centralWidget.setStyleSheet( "#centralWidget {background-color: blue ; color : #f8f8f8}") self.setCentralWidget(self.centralWidget) self.setWindowTitle("Character Select") """
def __init__(self, *args, **kwargs): super().__init__(*args, **kwargs) # --------------------------------------------------------------------- # Setup Window # --------------------------------------------------------------------- self.setWindowTitle("Developer Dashboard") self.setWindowIcon(QIcon('logo.png')) # --------------------------------------------------------------------- # Menus/ Widgets # --------------------------------------------------------------------- # Create an instance of an Actions object. This contains all the QActions # to be used in this application. self.actions = Actions() # Create a MainWidget object. Note the Actions are being passed in. self.mainWidget = CentralWidget(self.actions) # Set the central widget self.setCentralWidget(self.mainWidget) # Create an application menu (this will be a sub-menu) self.dashboardMenu = QMenu("dashboard") # Add actions to the application menu self.dashboardMenu.addActions(self.actions.getDashboardActions()) # Create an options menu self.optionsMenu = QMenu("Options") # Add the dashboard menu to the options menu self.optionsMenu.addMenu(self.dashboardMenu) # Add actions to the options menu self.optionsMenu.addActions(self.actions.getOptionsActions()) # Add the options menu to the menu bar self.menuBar().addMenu(self.optionsMenu) # Create a tool bar self.toolBar = QToolBar() # Add actions to the tool bar self.toolBar.addActions(self.actions.getToolBarActions()) # Add the tool bar to this MainWindow self.addToolBar(self.toolBar) # Connect the signals self.actions.exitAction.triggered.connect(self.quit) self.mainWidget.quitApplication.connect(self.quit) self.actions.clearAction.triggered.connect(self.mainWidget.clearForm) self.actions.resetAction.triggered.connect(self.mainWidget.resetScores) self.actions.aboutAction.triggered.connect(self.mainWidget.aboutInfo)
def __init__(self, reactor): super().__init__() self.setFont(QFont("Calibri", 10)) self.setWindowTitle("Movie Scrapper") import configparser self.config = configparser.ConfigParser() self.config.read('scrapper.ini') self.initConfig() self.setCentralWidget(CentralWidget(self.config)) self.createToolbar() self.createMenu() self.setGeometry(self.left, self.top, self.width, self.height) self.reactor = reactor
def __init__(self): super().__init__() self.centralWidget = CentralWidget() newPalette = self.centralWidget.palette() newPalette.setColor(self.centralWidget.backgroundRole(), QColor(105, 105, 105)) self.centralWidget.setAutoFillBackground(True) self.centralWidget.setPalette(newPalette) self.centralWidget.setFixedWidth(325) self.centralWidget.setFixedHeight(500) self.setCentralWidget(self.centralWidget) self.setWindowTitle("The Game") """
def __init__(self): super().__init__() self.centralWidget = CentralWidget() newPalette = self.centralWidget.palette() newPalette.setColor(self.centralWidget.backgroundRole(), QColor(0, 105, 105)) self.centralWidget.setAutoFillBackground(True) self.centralWidget.setPalette(newPalette) self.centralWidget.setFixedWidth(355) self.centralWidget.setFixedHeight(580) # self.setGeometry(self.left, self.top, self.width, self.height) self.setCentralWidget(self.centralWidget) self.setWindowTitle("The Game") self.mainMenuBar = self.menuBar() fileMenu = self.mainMenuBar.addMenu('File') characterMenu = self.mainMenuBar.addMenu('Character') helpMenu = self.mainMenuBar.addMenu('Help') saveAction = QAction('Save', self) exitAction = QAction('Exit', self) exitAction.triggered.connect(qApp.quit) characterAction = QAction('Character Info', self) inventoryAction = QAction('Inventory', self) roomDescAction = QAction('Description', self) actionAvailAction = QAction('Actions', self) fileMenu.addAction(saveAction) fileMenu.addAction(exitAction) characterMenu.addAction(characterAction) characterMenu.addAction(inventoryAction) helpMenu.addAction(roomDescAction) helpMenu.addAction(actionAvailAction) self.mainMenuBar.setVisible(False) self.centralWidget.procShowMenu.connect(self.showMenuBar)
def start(self): ok = LoadProteinGroupsDialog.get_file_info(self, self.analysis) if ok: central_widget = CentralWidget(self.analysis, self) self.setCentralWidget(central_widget)
def __init__(self): super().__init__() ###################################################################################################### # Change settings for central widget ###################################################################################################### self.centralWidget = CentralWidget() newPalette = self.centralWidget.palette() newPalette.setColor(self.centralWidget.backgroundRole(), QColor(0, 105, 105)) self.centralWidget.setAutoFillBackground( True ) self.centralWidget.setPalette(newPalette) self.centralWidget.setFixedWidth(580) self.centralWidget.setFixedHeight(600) self.setCentralWidget(self.centralWidget) self.setWindowTitle("The Game") ###################################################################################################### # Create menu bar ###################################################################################################### self.mainMenuBar = self.menuBar() fileMenu = self.mainMenuBar.addMenu('File') characterMenu = self.mainMenuBar.addMenu('Character') helpMenu = self.mainMenuBar.addMenu('Help') ###################################################################################################### # Create and set actions ###################################################################################################### openWebAction = QAction('Open Website', self) openWebAction.triggered.connect(self.centralWidget.launchWeb) uploadAction = QAction('Upload Game To Website', self) uploadAction.triggered.connect(self.centralWidget.uploadGameInfo) exitAction = QAction('Exit', self) exitAction.triggered.connect(qApp.quit) characterAction = QAction('Character Info', self) characterAction.triggered.connect(self.centralWidget.showCharacterInfo) inventoryAction = QAction('Inventory', self) inventoryAction.triggered.connect(self.centralWidget.showInventoryInfo) equipmentAction = QAction('Equipment', self) equipmentAction.triggered.connect(self.centralWidget.changeEquipmentGeneral) roomDescAction = QAction('Description', self) roomDescAction.triggered.connect(self.centralWidget.showRoomDesc) actionAvailAction = QAction('Actions', self) actionAvailAction.triggered.connect(self.centralWidget.showAvailActions) characterStuckAction = QAction('Stuck? Click here', self) characterStuckAction.triggered.connect(self.centralWidget.unstuckCharacter) helpMeAction = QAction('Helpful Info', self) helpMeAction.triggered.connect(self.centralWidget.showHelpfulInfo) ###################################################################################################### # Pair actions with menubar ###################################################################################################### fileMenu.addAction(openWebAction) fileMenu.addAction(uploadAction) fileMenu.addAction(exitAction) characterMenu.addAction(characterAction) characterMenu.addAction(inventoryAction) characterMenu.addAction(equipmentAction) helpMenu.addAction(roomDescAction) helpMenu.addAction(actionAvailAction) helpMenu.addAction(characterStuckAction) helpMenu.addAction(helpMeAction) ###################################################################################################### # Show menu visibility ###################################################################################################### self.mainMenuBar.setVisible(False) self.centralWidget.procShowMenu.connect(self.showMenuBar)
def __init__(self): super().__init__() self.centralWidget = CentralWidget() self.setCentralWidget(self.centralWidget) self.setWindowTitle("Wubba Lubba Dub Dub")
def __init__(self, parent): QWidget.__init__(self) MainWindowGeneric.__init__(self) self._parent = parent self.settings = QSettings('NINJA-IDE', 'Kunai') self.settings.beginGroup('Preferences') self.settings.beginGroup('Interface') self._vbox = QVBoxLayout(self) #Splitters self.splitterMain = QSplitter() self.splitterCentral = QSplitter(Qt.Vertical) #Properties Panel self._properties = PropertiesWidget(self) #Central self._central = CentralWidget(self) self.show_start_page() self.splitterCentral.insertWidget( self.settings.value('central_tab_position', 0).toInt()[0], self._central) #Display Container self.container = DisplayContainer(self) self._hide_container() self.splitterCentral.insertWidget( self.settings.value('container_tab_position', 1).toInt()[0], self.container) height = [(self.height() / 3) * 2, self.height() / 3] self.splitterCentral.setSizes([height[self.settings.value('central_tab_position', 0).toInt()[0]], height[self\ .settings.value('container_tab_position', 1).toInt()[0]]]) #Size Central Splitter self.splitterMain.insertWidget( self.settings.value('main_tab_position', 0).toInt()[0], self.splitterCentral) self.splitterMain.insertWidget( self.settings.value('properties_tab_position', 1).toInt()[0], self._properties) width = [(self.width() / 6) * 5, self.width() / 6] self.splitterMain.setSizes([width[self.settings.value('main_tab_position', 0).toInt()[0]],\ width[self.settings.value('properties_tab_position', 1).toInt()[0]]]) self._vbox.addWidget(self.splitterMain) self.settings.endGroup() #End General Preferences self.settings.endGroup() #flag for reload_file self._reloading = False #Shortcuts shortCloseTab = QShortcut(QKeySequence(Qt.CTRL + Qt.Key_W), self) shortNew = QShortcut(QKeySequence(Qt.CTRL + Qt.Key_N), self) shortNewProject = QShortcut(QKeySequence(Qt.CTRL + Qt.Key_J), self) shortOpen = QShortcut(QKeySequence(Qt.CTRL + Qt.Key_O), self) shortOpenProject = QShortcut(QKeySequence(Qt.CTRL + Qt.Key_P), self) shortSave = QShortcut(QKeySequence(Qt.CTRL + Qt.Key_S), self) shortSaveAll = QShortcut(QKeySequence(Qt.CTRL + Qt.SHIFT + Qt.Key_S), self) shortRedo = QShortcut(QKeySequence(Qt.CTRL + Qt.Key_Y), self) shortComment = QShortcut(QKeySequence(Qt.CTRL + Qt.Key_D), self) shortHorizontalLine = QShortcut(QKeySequence(Qt.CTRL + Qt.Key_R), self) shortIndentLess = QShortcut(QKeySequence(Qt.SHIFT + Qt.Key_Tab), self) shortHideContainer = QShortcut(QKeySequence(Qt.Key_F4), self) shortHideEditor = QShortcut(QKeySequence(Qt.Key_F3), self) shortHideExplorer = QShortcut(QKeySequence(Qt.Key_F2), self) shortRunFile = QShortcut(QKeySequence(Qt.CTRL + Qt.Key_F6), self) shortRunProgram = QShortcut(QKeySequence(Qt.Key_F6), self) shortHideAll = QShortcut(QKeySequence(Qt.Key_F11), self) shortFind = QShortcut(QKeySequence(Qt.CTRL + Qt.Key_F), self) shortFindReplace = QShortcut(QKeySequence(Qt.CTRL + Qt.Key_H), self) shortHelp = QShortcut(QKeySequence(Qt.Key_F1), self) shortSplitHorizontal = QShortcut(QKeySequence(Qt.Key_F10), self) shortSplitVertical = QShortcut(QKeySequence(Qt.Key_F9), self) shortReloadFile = QShortcut(QKeySequence(Qt.Key_F5), self) #Signal -> Slot self.connect(shortCloseTab, SIGNAL("activated()"), self.close_actual_tab) self.connect(shortNew, SIGNAL("activated()"), self.new_editor) self.connect(shortNewProject, SIGNAL("activated()"), self.new_project) self.connect(shortOpen, SIGNAL("activated()"), self.open_file) self.connect(shortOpenProject, SIGNAL("activated()"), self.open_project_folder) self.connect(shortSave, SIGNAL("activated()"), self.save) self.connect(shortSaveAll, SIGNAL("activated()"), self.save_project) self.connect(shortComment, SIGNAL("activated()"), lambda: self._central.obtain_editor().comment()) self.connect(shortIndentLess, SIGNAL("activated()"), lambda: self._central.obtain_editor().indent_less()) self.connect( shortHorizontalLine, SIGNAL("activated()"), lambda: self._central.obtain_editor().insert_horizontal_line()) self.connect(shortRedo, SIGNAL("activated()"), lambda: self._central.obtain_editor().redo()) self.connect(shortHideContainer, SIGNAL("activated()"), self._hide_container) self.connect(shortHideEditor, SIGNAL("activated()"), self._hide_editor) self.connect(shortHideExplorer, SIGNAL("activated()"), self._hide_explorer) self.connect(shortRunFile, SIGNAL("activated()"), self._run_code) self.connect(shortRunProgram, SIGNAL("activated()"), self._run_program) self.connect(shortHideAll, SIGNAL("activated()"), self._hide_all) self.connect(shortFind, SIGNAL("activated()"), self._open_find) self.connect(shortFindReplace, SIGNAL("activated()"), self._open_find_replace) self.connect(shortHelp, SIGNAL("activated()"), self._show_python_doc) self.connect(shortSplitHorizontal, SIGNAL("activated()"), lambda: self.split_tab(True)) self.connect(shortSplitVertical, SIGNAL("activated()"), lambda: self.split_tab(False)) self.connect(shortReloadFile, SIGNAL("activated()"), lambda: self.reload_file())
def __init__(self): """Initialize the main window. Input: None Output: Titles the window, creates instance of CentralWidget, sets up the menu bar menus and their actions. """ # Initialize the parent widget super().__init__() # Name the window self.setWindowTitle("Facial Recognition App") # Create a main widget object (the central widget) self.mainWidget = CentralWidget() # create the menu bar and its two menus: file and edit self.menuBar = QMenuBar() self.file = self.menuBar.addMenu("File") self.edit = self.menuBar.addMenu("Edit") # Add action for File->Exit self.file_exit = self.file.addAction("Exit") self.file_exit.triggered.connect(self.closeApp) # create menu bar action for toggling facial recognition self.file_recognize_faces = QAction("Facial Recognition", self.menuBar, checkable=True) self.file.addAction(self.file_recognize_faces) self.file_recognize_faces.triggered.connect( self.changeFacialRecognitionState) # Add actions for Edit # create menu bar action for subscribing to SMS alerts self.edit_subscribeAlerts = self.edit.addAction( "Subscribe to Alerts...") self.edit_subscribeAlerts.triggered.connect(self.subscribeToAlerts) # create menu bar action for adding a new face self.edit_addFace = self.edit.addAction("Add a New Face...") self.edit_addFace.triggered.connect(self.addNewFace) # create dialog widget to allow users to capturing face images (for adding a new face) self.captureFaceImagesDialog = CaptureFaceImagesDialog() # connect the dialog's capture signal ot the Engine's recognizeAndRecordCurrentFrame method self.captureFaceImagesDialog.capture.connect( self.mainWidget.engine.recognizeAndRecordCurrentFrame) # menu bar action for deleting a specific face self.edit_deleteFace = self.edit.addAction("Delete a Face...") self.edit_deleteFace.triggered.connect(self.deleteFace) # menu bar action for deleting all known faces from the application self.edit_deleteAllFaces = self.edit.addAction("Delete All Faces") self.edit_deleteAllFaces.triggered.connect(self.deleteAllFaces) # set the menu bar self.setMenuBar(self.menuBar) # Set the main widget object as the central widget of the main window self.setCentralWidget(self.mainWidget)