Example #1
0
    def init_ui(self):
        """
        Initialize the actual UI
        :return: 
        """
        # Main window
        desktop = QDesktopWidget()
        screen_width = desktop.screen().width()
        screen_height = desktop.screen().height()
        app_width = 505
        app_height = 400
        self.setWindowTitle('Stellaris Profile Manager')
        self.setGeometry(  # this centers the window
            (screen_width / 2) - (app_width / 2),
            (screen_height / 2) - (app_height / 2),
            app_width,
            app_height
        )
        self.setFixedSize(self.size())
        self.setSizePolicy(QSizePolicy.Fixed, QSizePolicy.Fixed)

        # elements
        self.create_list_of_profiles()
        self.create_launch_button()
        self.create_new_profile_button()
        self.create_edit_profile_button()
        self.create_delete_profile_button()
        self.create_import_profile_button()
        self.create_export_profile_button()
        self.create_find_steam_button()
        self.create_path_to_steam_input()
        self.create_game_version()
    def init_ui(self):
        """
        Initialize the actual UI
        :return: 
        """
        # Main window
        desktop = QDesktopWidget()
        screen_width = desktop.screen().width()
        screen_height = desktop.screen().height()
        app_width = 450
        app_height = 420
        self.setWindowTitle('Stellaris Profile Manager')
        self.setGeometry(  # this centers the window
            (screen_width / 2) - (app_width / 2),
            (screen_height / 2) - (app_height / 2),
            app_width,
            app_height
        )
        self.setFixedSize(self.size())
        self.setSizePolicy(QSizePolicy.Fixed, QSizePolicy.Fixed)

        # elements
        self.create_profile_name_input()
        self.create_list_of_mods()
        self.create_save_button()
        self.create_cancel_button()
        self.create_reload_mods_button()
    def set_image(self, image: QImage) -> None:
        """Sets the background image for self

        :param image: image to set as background of self
        """

        self.__scene.clear()
        self.__word_polygons = []

        screen_res = QDesktopWidget().screenGeometry()
        image = image.scaled(screen_res.width() * 0.75,
                             screen_res.height() * 0.75, Qt.KeepAspectRatio)
        bg = QGraphicsPixmapItem(QPixmap(image))
        self.setFixedSize(image.width(), image.height())
        self.__currentImage = image
        self.__scene.addItem(bg)
Example #4
0
 def show(self):
     QDialog.show(self)
     if self.geom_pref is None:
         if self.parent() is None:
             geom = QDesktopWidget.screenGeometry(self)
         else:
             geom = self.parent().geometry()
         x = max(50, geom.x() + geom.width() // 2 - self.width() // 2)
         y = max(50, geom.y() + geom.height() // 2 - self.height() // 2)
         self.move(x, y)
Example #5
0
 def show(self):
     QDialog.show(self)
     if self.geom_pref is None:
         if self.parent() is None:
             geom = QDesktopWidget.screenGeometry(self)
         else:
             geom = self.parent().geometry()
         x = max(50, geom.x() + geom.width() // 2 - self.width() // 2)
         y = max(50, geom.y() + geom.height() // 2 - self.height() // 2)
         self.move(x, y)
 def initUI(self):
     
     centralWidget = QWidget()
     self.setCentralWidget(centralWidget)
     self.setWindowTitle(self._gameBoard.name)
     self.setWindowIcon(QIcon(os.path.join('./Pictures/', 'berserker_icon.png'))) #Apparently this doens't work the same way on a mac.
     self.statusBar().showMessage('Ready!')
     vbox = QVBoxLayout()
     centralWidget.setLayout(vbox)
     self.gameStats = GameStats(self)
     self.mapView = MapView(self)
     self.bottomButtons = BottomButtons(self)
     vbox.addWidget(self.gameStats)
     vbox.addWidget(self.mapView)
     vbox.addWidget(self.bottomButtons)
     
     screen = QDesktopWidget().screenGeometry()
     self.setGeometry((screen.width() - (self.gameboard.width - 1) * 20) / 2, (screen.height() - self.gameboard.height * 20 - 200) / 2, 500, 400)
     
     self.show()
Example #7
0
    def init_ui(self):
        """
        Initialize the actual UI
        :return: 
        """
        # Main window
        desktop = QDesktopWidget()
        screen_width = desktop.screen().width()
        screen_height = desktop.screen().height()
        app_width = 450
        app_height = 375
        self.setWindowTitle('Import profile')
        self.setGeometry(  # this centers the window
            (screen_width / 2) - (app_width / 2),
            (screen_height / 2) - (app_height / 2), app_width, app_height)
        self.setFixedSize(self.size())
        self.setSizePolicy(QSizePolicy.Fixed, QSizePolicy.Fixed)

        # elements
        self.create_list_of_profiles()
        self.create_import_button()
    def initUI(self):

        centralWidget = QWidget()
        self.setCentralWidget(centralWidget)
        self.setWindowTitle(self._gameBoard.name)
        self.setWindowIcon(
            QIcon(os.path.join('./Pictures/', 'berserker_icon.png'))
        )  #Apparently this doens't work the same way on a mac.
        self.statusBar().showMessage('Ready!')
        vbox = QVBoxLayout()
        centralWidget.setLayout(vbox)
        self.gameStats = GameStats(self)
        self.mapView = MapView(self)
        self.bottomButtons = BottomButtons(self)
        vbox.addWidget(self.gameStats)
        vbox.addWidget(self.mapView)
        vbox.addWidget(self.bottomButtons)

        screen = QDesktopWidget().screenGeometry()
        self.setGeometry(
            (screen.width() - (self.gameboard.width - 1) * 20) / 2,
            (screen.height() - self.gameboard.height * 20 - 200) / 2, 500, 400)

        self.show()
Example #9
0
 def center(self):  # функция отцентровывает окно относительно окна
     qr = self.frameGeometry()
     cp = QDesktopWidget().availableGeometry().center()
     qr.moveCenter(cp)
     self.move(qr.topLeft())
Example #10
0
 def center(self):
     qr = self.frameGeometry()
     cp = QDesktopWidget().availableGeometry().center()
     qr.moveCenter(cp)
     self.move(qr.topLeft())
Example #11
0
 def move_window_to_center(self):
     qreact = self.frameGeometry()
     cp = QDesktopWidget().availableGeometry().center()
     qreact.moveCenter(cp)
     self.move(qreact.topLeft())
Example #12
0
 def showCentered(self):
     rectSpe = self.frameGeometry()
     centerPoint = QDesktopWidget().availableGeometry().center()
     rectSpe.moveCenter(centerPoint)
     self.move(rectSpe.topLeft())
Example #13
0
 def CenterOnScreen(self):
     '''alinhando a o formulario no centro da tela'''
     resolucao = QDesktopWidget().screenGeometry()
     self.move((resolucao.width() / 2) - (self.frameSize().width() / 2), (resolucao.height() / 2) - (self.frameSize().height() / 2))