def __init__(self, root, executor, root_directory): self.root_directory = root_directory self.model = Model(root_directory) self.controller = Controller(self.model, root) self.view = View(root, self.model, executor, self.controller) super(PicCollector, self).__init__() self.model.load_model() self.model.load_imagedata() self.view.setup_view()
def __init__(self, game: Game, black: Agent) -> None: self.game: Game = game self.black: Agent = black self.gui = None self.legal_actions: dict = self.game.board.get_legal_actions( Color.WHITE) self.prev_pass = False self.done = False self.gui = View() self.init_gui()
def __init__(self, sGuiStyle=None): # QT starten app = QApplication(sys.argv) #app.setAttribute(QtCore.Qt.AA_DontShowIconsInMenus, True) if sGuiStyle is not None: app.setStyle(QStyleFactory.create(sGuiStyle)) # Instanzvariablen self.model = Model() # Model self.view = View(self.model) # View observer = Observer(self.view) # Observer der View self.model.addObserver(observer) # Observer bei Model anmelden # QT self.view.show() # Hauptfenster # Info sys.exit(app.exec_()) # Eventloop starten
def main(): event_manager = EventManager() game_engine = GameEngine(event_manager) view = View( event_manager, game_engine, window_size=(DISPLAY_WIDTH, DISPLAY_HEIGHT), window_title="Ultimate Tic Tac Toe", fps=30, ) _controller = Controller(event_manager, game_engine, view) game_engine.run()
def __init__(self): self.__root = Tk() self.__view = View(self.__root) self.__modal = Modal(self.__view.TLog) # Set default self.__view.VOrigin.set( settings['DEFAULT_PATH']['original'] if settings['DEFAULT_PATH']['original'] else os.getcwd()) self.__view.VBackup.set(settings['DEFAULT_PATH']['backup']) # Set commands self.__view.BOrigin.config( command=lambda: self.__get_directory(self.__view.VOrigin)) self.__view.BBackup.config( command=lambda: self.__get_directory(self.__view.VBackup)) self.__view.BStart.config(command=self.__start) self.__root.mainloop()
class Controller: def __init__(self, game: Game, black: Agent) -> None: self.game: Game = game self.black: Agent = black self.gui = None self.legal_actions: dict = self.game.board.get_legal_actions( Color.WHITE) self.prev_pass = False self.done = False self.gui = View() self.init_gui() def init_gui(self) -> None: self.gui.controller = self self.gui.configure_view() def start(self) -> None: self.gui.startup_gui() def on_board_clicked(self, event: tkinter.Event) -> None: if not self.done: move = self._convert_point_coord_to_move(event.x, event.y) if move in list(self.legal_actions): # Process white players turn legal_directions: Directions = self.legal_actions[move] self.prev_pass = False self.done = self.game.board.take_action( move, legal_directions, Color.WHITE) if self.done: self._end_game() return else: # Process black players turn self._process_other_turn() self.gui.update_move() else: self.gui.close( ) # closes window and starts new game if there are episodes left def _convert_point_coord_to_move(self, pointx: int, pointy: int) -> Location: row = int(pointy // self.gui.get_cell_height()) if row == self.gui.get_rows(): row -= 1 col = int(pointx // self.gui.get_cell_width()) if col == self.gui.get_columns(): col -= 1 return (row, col) def _process_other_turn(self) -> None: legal_actions_black: dict = self.game.board.get_legal_actions( Color.BLACK) if not legal_actions_black: if self.prev_pass: self.done = True # no agent has legal actions, deadlock self.prev_pass = True # this agent has no legal actions, pass else: # get next action from legal actions and take it location, legal_directions = self.game.agent.next_action( self.game.board, legal_actions_black) self.prev_pass = False # this agent has legal actions, no pass self.done = self.game.board.take_action(location, legal_directions, Color.BLACK) if self.done: self._end_game() return else: # Whites turn again self.legal_actions = self.game.board.get_legal_actions(Color.WHITE) if not self.legal_actions: if self.prev_pass: self.done = True # no agent has legal actions, deadlock self._end_game() return else: self.prev_pass = True # this agent has no legal actions, pass self._process_other_turn() def _end_game(self) -> None: self.black.update_score(self.game.board) self.game.config.white.update_score(self.game.board) # print end result if self.game.board.num_black_disks > self.game.board.num_white_disks: print( colored( f'{self.game.episode:>5}: BLACK ({self.game.board.num_black_disks:>3}|{self.game.board.num_white_disks:>3}|{self.game.board.num_free_spots:>3})', 'red')) elif self.game.board.num_black_disks < self.game.board.num_white_disks: print( colored( f'{self.game.episode:>5}: WHITE ({self.game.board.num_black_disks:>3}|{self.game.board.num_white_disks:>3}|{self.game.board.num_free_spots:>3})', 'green')) else: print( colored( f'{self.game.episode:>5}: DRAW ({self.game.board.num_black_disks:>3}|{self.game.board.num_white_disks:>3}|{self.game.board.num_free_spots:>3})', 'cyan')) print(f'Click on the screen to start a new episode!') self.gui.update_move()
class Central: kernel = None view = None fpac_path = None pac = None def __init__(self): self.kernel = Compressor() self.view = View() def run(self): self.view.actions.subscribe(self) self.view.info.subscribe(self) # self.kernel.subscribe(self.view.actions) self.kernel.subscribe(self.view.info) self.kernel.subscribe(self.view.props) # self.view.run() def load_invoked(self, path): self.kernel.image.load(path) self.kernel.image.show(self.view.graph.axes) self.view.graph.redraw() # self.view.info.send('Image is loaded') #self.view.info.send('Image isn\'t loaded') def select_invoked(self): self.view.graph.create_selector(callback=self.kernel.image.crop) def compress_invoked(self): try: tic = time.time() self.kernel.run() toc = time.time() - tic except MemoryError: tkMessageBox.showerror('Not enough memory', 'Please select a smaller fragment of the image') self.view.info.send('Image isn\'t compressed') return # self.view.info.send('{0:.2f} sec. ({1:.2f} min.) has elapsed'.format(toc, toc / 60)) c = self.kernel.fpac.compression(self.kernel.image) self.view.info.send('Compression: {0:.2f}%'.format(c)) def save_invoked(self, path): self.fpac_path = path self.kernel.fpac.save(path) self.view.info.send('Compressed image is saved') def decompress_invoked(self): if self.fpac_path == None: return # self.pac = Decompressor() self.pac.fpac.load(self.fpac_path) # tic = time.time() self.pac.run() toc = time.time() - tic # self.view.info.send('Image is reconstructed') self.view.info.send('{0:.2f} sec. ({1:.2f} min.) has elapsed'.format(toc, toc / 60)) # (width, height) = self.kernel.option.fix_image_size(self.pac.image) (width, height) = self.kernel.option.fix_image_size(self.kernel.image) rms = self.kernel.image.rmsdiff(self.pac.image) self.view.info.send('RMS error between source and reconstructed image:') self.view.info.send('{0:.2f}%'.format(rms)) def resave_invoked(self, path): self.pac.image.save(path) self.view.info.send('Decompressed image is saved') def progress_stopped(self): self.kernel.is_process = False
def __init__(self): self.kernel = Compressor() self.view = View()
def setupUi(self, MainWindow): MainWindow.setObjectName("MainWindow") MainWindow.resize(1200, 900) MainWindow.setFocusPolicy(QtCore.Qt.StrongFocus) MainWindow.setStyleSheet("") self.centralwidget = QtWidgets.QWidget(MainWindow) self.centralwidget.setStyleSheet("background-color: rgb(50, 50, 50);") self.centralwidget.setObjectName("centralwidget") self.mainLayout = QtWidgets.QHBoxLayout(self.centralwidget) self.mainLayout.setContentsMargins(50, 50, 50, 50) self.mainLayout.setSpacing(50) self.mainLayout.setObjectName("mainLayout") self.view = View(self.centralwidget) sizePolicy = QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.Fixed, QtWidgets.QSizePolicy.Fixed) sizePolicy.setHorizontalStretch(0) sizePolicy.setVerticalStretch(0) sizePolicy.setHeightForWidth( self.view.sizePolicy().hasHeightForWidth()) self.view.setSizePolicy(sizePolicy) self.view.setMinimumSize(QtCore.QSize(700, 700)) self.view.setBaseSize(QtCore.QSize(0, 0)) palette = QtGui.QPalette() brush = QtGui.QBrush(QtGui.QColor(0, 0, 0)) brush.setStyle(QtCore.Qt.SolidPattern) palette.setBrush(QtGui.QPalette.Active, QtGui.QPalette.WindowText, brush) brush = QtGui.QBrush(QtGui.QColor(50, 50, 50)) brush.setStyle(QtCore.Qt.SolidPattern) palette.setBrush(QtGui.QPalette.Active, QtGui.QPalette.Button, brush) brush = QtGui.QBrush(QtGui.QColor(245, 245, 245)) brush.setStyle(QtCore.Qt.SolidPattern) palette.setBrush(QtGui.QPalette.Active, QtGui.QPalette.Light, brush) brush = QtGui.QBrush(QtGui.QColor(220, 220, 220)) brush.setStyle(QtCore.Qt.SolidPattern) palette.setBrush(QtGui.QPalette.Active, QtGui.QPalette.Midlight, brush) brush = QtGui.QBrush(QtGui.QColor(145, 145, 145)) brush.setStyle(QtCore.Qt.SolidPattern) palette.setBrush(QtGui.QPalette.Active, QtGui.QPalette.Dark, brush) brush = QtGui.QBrush(QtGui.QColor(170, 170, 170)) brush.setStyle(QtCore.Qt.SolidPattern) palette.setBrush(QtGui.QPalette.Active, QtGui.QPalette.Mid, brush) brush = QtGui.QBrush(QtGui.QColor(0, 0, 0)) brush.setStyle(QtCore.Qt.SolidPattern) palette.setBrush(QtGui.QPalette.Active, QtGui.QPalette.Text, brush) brush = QtGui.QBrush(QtGui.QColor(0, 0, 0)) brush.setStyle(QtCore.Qt.SolidPattern) palette.setBrush(QtGui.QPalette.Active, QtGui.QPalette.ButtonText, brush) brush = QtGui.QBrush(QtGui.QColor(50, 50, 50)) brush.setStyle(QtCore.Qt.SolidPattern) palette.setBrush(QtGui.QPalette.Active, QtGui.QPalette.Base, brush) brush = QtGui.QBrush(QtGui.QColor(50, 50, 50)) brush.setStyle(QtCore.Qt.SolidPattern) palette.setBrush(QtGui.QPalette.Active, QtGui.QPalette.Window, brush) brush = QtGui.QBrush(QtGui.QColor(0, 0, 0)) brush.setStyle(QtCore.Qt.SolidPattern) palette.setBrush(QtGui.QPalette.Inactive, QtGui.QPalette.WindowText, brush) brush = QtGui.QBrush(QtGui.QColor(50, 50, 50)) brush.setStyle(QtCore.Qt.SolidPattern) palette.setBrush(QtGui.QPalette.Inactive, QtGui.QPalette.Button, brush) brush = QtGui.QBrush(QtGui.QColor(245, 245, 245)) brush.setStyle(QtCore.Qt.SolidPattern) palette.setBrush(QtGui.QPalette.Inactive, QtGui.QPalette.Light, brush) brush = QtGui.QBrush(QtGui.QColor(220, 220, 220)) brush.setStyle(QtCore.Qt.SolidPattern) palette.setBrush(QtGui.QPalette.Inactive, QtGui.QPalette.Midlight, brush) brush = QtGui.QBrush(QtGui.QColor(145, 145, 145)) brush.setStyle(QtCore.Qt.SolidPattern) palette.setBrush(QtGui.QPalette.Inactive, QtGui.QPalette.Dark, brush) brush = QtGui.QBrush(QtGui.QColor(170, 170, 170)) brush.setStyle(QtCore.Qt.SolidPattern) palette.setBrush(QtGui.QPalette.Inactive, QtGui.QPalette.Mid, brush) brush = QtGui.QBrush(QtGui.QColor(0, 0, 0)) brush.setStyle(QtCore.Qt.SolidPattern) palette.setBrush(QtGui.QPalette.Inactive, QtGui.QPalette.Text, brush) brush = QtGui.QBrush(QtGui.QColor(0, 0, 0)) brush.setStyle(QtCore.Qt.SolidPattern) palette.setBrush(QtGui.QPalette.Inactive, QtGui.QPalette.ButtonText, brush) brush = QtGui.QBrush(QtGui.QColor(50, 50, 50)) brush.setStyle(QtCore.Qt.SolidPattern) palette.setBrush(QtGui.QPalette.Inactive, QtGui.QPalette.Base, brush) brush = QtGui.QBrush(QtGui.QColor(50, 50, 50)) brush.setStyle(QtCore.Qt.SolidPattern) palette.setBrush(QtGui.QPalette.Inactive, QtGui.QPalette.Window, brush) brush = QtGui.QBrush(QtGui.QColor(145, 145, 145)) brush.setStyle(QtCore.Qt.SolidPattern) palette.setBrush(QtGui.QPalette.Disabled, QtGui.QPalette.WindowText, brush) brush = QtGui.QBrush(QtGui.QColor(50, 50, 50)) brush.setStyle(QtCore.Qt.SolidPattern) palette.setBrush(QtGui.QPalette.Disabled, QtGui.QPalette.Button, brush) brush = QtGui.QBrush(QtGui.QColor(245, 245, 245)) brush.setStyle(QtCore.Qt.SolidPattern) palette.setBrush(QtGui.QPalette.Disabled, QtGui.QPalette.Light, brush) brush = QtGui.QBrush(QtGui.QColor(220, 220, 220)) brush.setStyle(QtCore.Qt.SolidPattern) palette.setBrush(QtGui.QPalette.Disabled, QtGui.QPalette.Midlight, brush) brush = QtGui.QBrush(QtGui.QColor(145, 145, 145)) brush.setStyle(QtCore.Qt.SolidPattern) palette.setBrush(QtGui.QPalette.Disabled, QtGui.QPalette.Dark, brush) brush = QtGui.QBrush(QtGui.QColor(170, 170, 170)) brush.setStyle(QtCore.Qt.SolidPattern) palette.setBrush(QtGui.QPalette.Disabled, QtGui.QPalette.Mid, brush) brush = QtGui.QBrush(QtGui.QColor(145, 145, 145)) brush.setStyle(QtCore.Qt.SolidPattern) palette.setBrush(QtGui.QPalette.Disabled, QtGui.QPalette.Text, brush) brush = QtGui.QBrush(QtGui.QColor(145, 145, 145)) brush.setStyle(QtCore.Qt.SolidPattern) palette.setBrush(QtGui.QPalette.Disabled, QtGui.QPalette.ButtonText, brush) brush = QtGui.QBrush(QtGui.QColor(50, 50, 50)) brush.setStyle(QtCore.Qt.SolidPattern) palette.setBrush(QtGui.QPalette.Disabled, QtGui.QPalette.Base, brush) brush = QtGui.QBrush(QtGui.QColor(50, 50, 50)) brush.setStyle(QtCore.Qt.SolidPattern) palette.setBrush(QtGui.QPalette.Disabled, QtGui.QPalette.Window, brush) self.view.setPalette(palette) self.view.setObjectName("view") self.mainLayout.addWidget(self.view) self.verticalLayout = QtWidgets.QVBoxLayout() self.verticalLayout.setSpacing(20) self.verticalLayout.setObjectName("verticalLayout") self.tabWidget = QtWidgets.QTabWidget(self.centralwidget) sizePolicy = QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.Fixed, QtWidgets.QSizePolicy.Fixed) sizePolicy.setHorizontalStretch(0) sizePolicy.setVerticalStretch(0) sizePolicy.setHeightForWidth( self.tabWidget.sizePolicy().hasHeightForWidth()) self.tabWidget.setSizePolicy(sizePolicy) self.tabWidget.setMinimumSize(QtCore.QSize(320, 580)) self.tabWidget.setFocusPolicy(QtCore.Qt.NoFocus) self.tabWidget.setStyleSheet( "QPushButton {\n" " background: qlineargradient(x1: 0, y1: 0, x2: 0, y2: 1,\n" "stop: 0 rgb(150, 150, 150), stop: 0.4 rgb(135, 135, 135),\n" "stop: 0.5 rgb(125, 125, 125), stop: 1.0 rgb(110, 110, 110));\n" " border: 1px solid rgb(100, 100, 100);\n" " border-radius: 4px;\n" " color: black;\n" " padding: 5px 10px;\n" "}\n" "QPushButton:hover {\n" " background: qlineargradient(x1: 0, y1: 0, x2: 0, y2: 1, stop: 0 rgb(200, 200, 200), stop: 0.4 rgb(185, 185, 185), stop: 0.5 rgb(175, 175, 175), stop: 1.0 rgb(160, 160, 160));\n" "}\n" "QPushButton:pressed {\n" " background: qlineargradient(x1: 0, y1: 0, x2: 0, y2: 1, stop: 0 rgb(220, 220, 220), stop: 0.4 rgb(205, 205, 205), stop: 0.5 rgb(195, 195, 195), stop: 1.0 rgb(180, 180, 180));\n" "}\n" "QTabWidget::pane {\n" " border-top: 1px solid rgb(150, 150, 150);\n" "}\n" "QTabWidget::tab-bar {\n" " left: 10px;\n" "}\n" "QTabBar::tab {\n" " background: qlineargradient(x1: 0, y1: 0, x2: 0, y2: 1, stop: 0 rgb(180, 180, 180), stop: 0.4 rgb(165, 165, 165), stop: 0.5 rgb(155, 155, 155), stop: 1.0 rgb(140, 140, 140));\n" " border: 1px solid rgb(150, 150, 150);\n" " border-top-left-radius: 4px;\n" " border-top-right-radius: 4px;\n" " min-width: 10ex;\n" " padding: 2px;\n" "}\n" "QTabBar::tab:selected, QTabBar::tab:hover {\n" " background: qlineargradient(x1: 0, y1: 0, x2: 0, y2: 1, stop: 0 rgb(220, 220, 220), stop: 0.4 rgb(205, 205, 205), stop: 0.5 rgb(195, 195, 195), stop: 1.0 rgb(180, 180, 180));\n" "}\n" "QTabBar::tab:!selected {\n" " margin-top: 2px;\n" "}\n" "QTabBar::tab:selected {\n" " margin-left: -4px;\n" " margin-right: -4px;\n" "}\n" "QTabBar::tab:first:selected {\n" " margin-left: 0;\n" "}\n" "QTabBar::tab:last:selected {\n" " margin-right: 0;\n" "}\n" "QTabBar::tab:only-one {\n" " margin: 0;\n" "}") self.tabWidget.setObjectName("tabWidget") self.moveListTab = QtWidgets.QWidget() self.moveListTab.setObjectName("moveListTab") self.layoutWidget = QtWidgets.QWidget(self.moveListTab) self.layoutWidget.setGeometry(QtCore.QRect(10, 10, 302, 542)) self.layoutWidget.setObjectName("layoutWidget") self.verticalLayout_2 = QtWidgets.QVBoxLayout(self.layoutWidget) self.verticalLayout_2.setContentsMargins(0, 0, 0, 0) self.verticalLayout_2.setObjectName("verticalLayout_2") self.commentField = CommentEdit(self.layoutWidget) sizePolicy = QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.Fixed, QtWidgets.QSizePolicy.Fixed) sizePolicy.setHorizontalStretch(0) sizePolicy.setVerticalStretch(0) sizePolicy.setHeightForWidth( self.commentField.sizePolicy().hasHeightForWidth()) self.commentField.setSizePolicy(sizePolicy) self.commentField.setMinimumSize(QtCore.QSize(300, 90)) self.commentField.setMaximumSize(QtCore.QSize(16777215, 90)) self.commentField.setStyleSheet( "background-color: rgb(255, 255, 255);") self.commentField.setFrameShape(QtWidgets.QFrame.NoFrame) self.commentField.setObjectName("commentField") self.verticalLayout_2.addWidget(self.commentField) self.moveListWidget = QtWidgets.QListWidget(self.layoutWidget) sizePolicy = QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.Fixed, QtWidgets.QSizePolicy.Fixed) sizePolicy.setHorizontalStretch(0) sizePolicy.setVerticalStretch(0) sizePolicy.setHeightForWidth( self.moveListWidget.sizePolicy().hasHeightForWidth()) self.moveListWidget.setSizePolicy(sizePolicy) self.moveListWidget.setMinimumSize(QtCore.QSize(300, 400)) font = QtGui.QFont() font.setBold(True) font.setWeight(75) self.moveListWidget.setFont(font) self.moveListWidget.setFocusPolicy(QtCore.Qt.NoFocus) self.moveListWidget.setStyleSheet( "background-color: rgb(255, 255, 255);") self.moveListWidget.setFrameShape(QtWidgets.QFrame.NoFrame) self.moveListWidget.setEditTriggers( QtWidgets.QAbstractItemView.NoEditTriggers) self.moveListWidget.setProperty("showDropIndicator", False) self.moveListWidget.setObjectName("moveListWidget") self.verticalLayout_2.addWidget(self.moveListWidget) self.horizontalLayout_2 = QtWidgets.QHBoxLayout() self.horizontalLayout_2.setSpacing(5) self.horizontalLayout_2.setObjectName("horizontalLayout_2") self.firstMoveButton = QtWidgets.QPushButton(self.layoutWidget) self.firstMoveButton.setObjectName("firstMoveButton") self.horizontalLayout_2.addWidget(self.firstMoveButton) self.prevMoveButton = QtWidgets.QPushButton(self.layoutWidget) self.prevMoveButton.setObjectName("prevMoveButton") self.horizontalLayout_2.addWidget(self.prevMoveButton) self.nextMoveButton = QtWidgets.QPushButton(self.layoutWidget) self.nextMoveButton.setObjectName("nextMoveButton") self.horizontalLayout_2.addWidget(self.nextMoveButton) self.lastMoveButton = QtWidgets.QPushButton(self.layoutWidget) self.lastMoveButton.setObjectName("lastMoveButton") self.horizontalLayout_2.addWidget(self.lastMoveButton) self.verticalLayout_2.addLayout(self.horizontalLayout_2) self.tabWidget.addTab(self.moveListTab, "") self.pgnTab = QtWidgets.QWidget() self.pgnTab.setObjectName("pgnTab") self.layoutWidget1 = QtWidgets.QWidget(self.pgnTab) self.layoutWidget1.setGeometry(QtCore.QRect(10, 10, 302, 542)) self.layoutWidget1.setObjectName("layoutWidget1") self.verticalLayout_4 = QtWidgets.QVBoxLayout(self.layoutWidget1) self.verticalLayout_4.setContentsMargins(0, 0, 0, 0) self.verticalLayout_4.setObjectName("verticalLayout_4") self.pgnField = QtWidgets.QPlainTextEdit(self.layoutWidget1) sizePolicy = QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.Fixed, QtWidgets.QSizePolicy.Fixed) sizePolicy.setHorizontalStretch(0) sizePolicy.setVerticalStretch(0) sizePolicy.setHeightForWidth( self.pgnField.sizePolicy().hasHeightForWidth()) self.pgnField.setSizePolicy(sizePolicy) self.pgnField.setMinimumSize(QtCore.QSize(300, 500)) font = QtGui.QFont() font.setFamily("Trebuchet MS") self.pgnField.setFont(font) self.pgnField.setStyleSheet("background-color: rgb(255, 255, 255);") self.pgnField.setFrameShape(QtWidgets.QFrame.NoFrame) self.pgnField.setObjectName("pgnField") self.verticalLayout_4.addWidget(self.pgnField) self.horizontalLayout_3 = QtWidgets.QHBoxLayout() self.horizontalLayout_3.setSpacing(5) self.horizontalLayout_3.setObjectName("horizontalLayout_3") self.loadPgnButton = QtWidgets.QPushButton(self.layoutWidget1) self.loadPgnButton.setObjectName("loadPgnButton") self.horizontalLayout_3.addWidget(self.loadPgnButton) self.savePgnButton = QtWidgets.QPushButton(self.layoutWidget1) self.savePgnButton.setEnabled(True) self.savePgnButton.setObjectName("savePgnButton") self.horizontalLayout_3.addWidget(self.savePgnButton) spacerItem = QtWidgets.QSpacerItem(40, 20, QtWidgets.QSizePolicy.Expanding, QtWidgets.QSizePolicy.Minimum) self.horizontalLayout_3.addItem(spacerItem) self.verticalLayout_4.addLayout(self.horizontalLayout_3) self.tabWidget.addTab(self.pgnTab, "") self.verticalLayout.addWidget(self.tabWidget) self.fenGroupBox = QtWidgets.QGroupBox(self.centralwidget) sizePolicy = QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.Fixed, QtWidgets.QSizePolicy.Fixed) sizePolicy.setHorizontalStretch(0) sizePolicy.setVerticalStretch(0) sizePolicy.setHeightForWidth( self.fenGroupBox.sizePolicy().hasHeightForWidth()) self.fenGroupBox.setSizePolicy(sizePolicy) self.fenGroupBox.setMinimumSize(QtCore.QSize(320, 110)) self.fenGroupBox.setStyleSheet( "QGroupBox {\n" " background: none;\n" " border: none;\n" " color: rgb(255, 255, 255);\n" " font-weight: bold;\n" "}\n" "QPushButton {\n" " background: qlineargradient(x1: 0, y1: 0, x2: 0, y2: 1, stop: 0 rgb(150, 150, 150), stop: 0.4 rgb(135, 135, 135), stop: 0.5 rgb(125, 125, 125), stop: 1.0 rgb(110, 110, 110));\n" " border: 1px solid rgb(100, 100, 100);\n" " border-radius: 4px;\n" " color: black;\n" " padding: 5px 10px;\n" "}\n" "QPushButton:hover {\n" " background: qlineargradient(x1: 0, y1: 0, x2: 0, y2: 1, stop: 0 rgb(200, 200, 200), stop: 0.4 rgb(185, 185, 185), stop: 0.5 rgb(175, 175, 175), stop: 1.0 rgb(160, 160, 160));\n" "}\n" "QPushButton:pressed {\n" " background: qlineargradient(x1: 0, y1: 0, x2: 0, y2: 1, stop: 0 rgb(220, 220, 220), stop: 0.4 rgb(205, 205, 205), stop: 0.5 rgb(195, 195, 195), stop: 1.0 rgb(180, 180, 180));\n" "}\n" "QPushButton#boardResetButton {\n" " font-weight: bold;\n" "}") self.fenGroupBox.setObjectName("fenGroupBox") self.layoutWidget2 = QtWidgets.QWidget(self.fenGroupBox) self.layoutWidget2.setGeometry(QtCore.QRect(10, 30, 302, 72)) self.layoutWidget2.setObjectName("layoutWidget2") self.verticalLayout_3 = QtWidgets.QVBoxLayout(self.layoutWidget2) self.verticalLayout_3.setContentsMargins(0, 0, 0, 0) self.verticalLayout_3.setObjectName("verticalLayout_3") self.fenField = QtWidgets.QPlainTextEdit(self.layoutWidget2) sizePolicy = QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.Fixed, QtWidgets.QSizePolicy.Fixed) sizePolicy.setHorizontalStretch(0) sizePolicy.setVerticalStretch(0) sizePolicy.setHeightForWidth( self.fenField.sizePolicy().hasHeightForWidth()) self.fenField.setSizePolicy(sizePolicy) self.fenField.setMinimumSize(QtCore.QSize(300, 0)) self.fenField.setMaximumSize(QtCore.QSize(16777215, 25)) font = QtGui.QFont() font.setFamily("Trebuchet MS") self.fenField.setFont(font) self.fenField.setStyleSheet("background-color: rgb(255, 255, 255);\n" "color: rgb(0, 0, 0);") self.fenField.setFrameShape(QtWidgets.QFrame.NoFrame) self.fenField.setVerticalScrollBarPolicy(QtCore.Qt.ScrollBarAlwaysOff) self.fenField.setHorizontalScrollBarPolicy( QtCore.Qt.ScrollBarAlwaysOff) self.fenField.setLineWrapMode(QtWidgets.QPlainTextEdit.NoWrap) self.fenField.setObjectName("fenField") self.verticalLayout_3.addWidget(self.fenField) self.horizontalLayout = QtWidgets.QHBoxLayout() self.horizontalLayout.setObjectName("horizontalLayout") self.setFenButton = QtWidgets.QPushButton(self.layoutWidget2) self.setFenButton.setObjectName("setFenButton") self.horizontalLayout.addWidget(self.setFenButton) spacerItem1 = QtWidgets.QSpacerItem(40, 20, QtWidgets.QSizePolicy.Expanding, QtWidgets.QSizePolicy.Minimum) self.horizontalLayout.addItem(spacerItem1) self.boardResetButton = QtWidgets.QPushButton(self.layoutWidget2) self.boardResetButton.setObjectName("boardResetButton") self.horizontalLayout.addWidget(self.boardResetButton) self.verticalLayout_3.addLayout(self.horizontalLayout) self.verticalLayout.addWidget(self.fenGroupBox) self.mainLayout.addLayout(self.verticalLayout) MainWindow.setCentralWidget(self.centralwidget) self.menubar = QtWidgets.QMenuBar(MainWindow) self.menubar.setGeometry(QtCore.QRect(0, 0, 1200, 22)) self.menubar.setNativeMenuBar(False) self.menubar.setObjectName("menubar") self.menuFile = QtWidgets.QMenu(self.menubar) self.menuFile.setObjectName("menuFile") self.menuEdit = QtWidgets.QMenu(self.menubar) self.menuEdit.setObjectName("menuEdit") self.menuView = QtWidgets.QMenu(self.menubar) self.menuView.setObjectName("menuView") self.menu4PlayerChess = QtWidgets.QMenu(self.menubar) self.menu4PlayerChess.setObjectName("menu4PlayerChess") self.menuHelp = QtWidgets.QMenu(self.menubar) self.menuHelp.setObjectName("menuHelp") MainWindow.setMenuBar(self.menubar) self.statusbar = QtWidgets.QStatusBar(MainWindow) self.statusbar.setStyleSheet("background-color: rgb(50, 50, 50);\n" "color: grey;") self.statusbar.setObjectName("statusbar") MainWindow.setStatusBar(self.statusbar) self.actionLoad_Game = QtWidgets.QAction(MainWindow) self.actionLoad_Game.setObjectName("actionLoad_Game") self.actionSave_Game_As = QtWidgets.QAction(MainWindow) self.actionSave_Game_As.setObjectName("actionSave_Game_As") self.actionQuit = QtWidgets.QAction(MainWindow) self.actionQuit.setObjectName("actionQuit") self.actionCopy_FEN4 = QtWidgets.QAction(MainWindow) self.actionCopy_FEN4.setObjectName("actionCopy_FEN4") self.actionPaste_FEN4 = QtWidgets.QAction(MainWindow) self.actionPaste_FEN4.setObjectName("actionPaste_FEN4") self.actionRotate_Board_Left = QtWidgets.QAction(MainWindow) self.actionRotate_Board_Left.setObjectName("actionRotate_Board_Left") self.actionRotate_Board_Right = QtWidgets.QAction(MainWindow) self.actionRotate_Board_Right.setObjectName("actionRotate_Board_Right") self.actionFlip_Board = QtWidgets.QAction(MainWindow) self.actionFlip_Board.setObjectName("actionFlip_Board") self.actionNew_Game = QtWidgets.QAction(MainWindow) self.actionNew_Game.setObjectName("actionNew_Game") self.actionPreferences = QtWidgets.QAction(MainWindow) self.actionPreferences.setObjectName("actionPreferences") self.actionCheck_for_Updates = QtWidgets.QAction(MainWindow) self.actionCheck_for_Updates.setObjectName("actionCheck_for_Updates") self.actionAbout = QtWidgets.QAction(MainWindow) self.actionAbout.setObjectName("actionAbout") self.actionQuick_Reference = QtWidgets.QAction(MainWindow) self.actionQuick_Reference.setObjectName("actionQuick_Reference") self.actionReport_Bug = QtWidgets.QAction(MainWindow) self.actionReport_Bug.setObjectName("actionReport_Bug") self.actionAbout_PyQt = QtWidgets.QAction(MainWindow) self.actionAbout_PyQt.setObjectName("actionAbout_PyQt") self.menuFile.addAction(self.actionNew_Game) self.menuFile.addAction(self.actionLoad_Game) self.menuFile.addSeparator() self.menuFile.addAction(self.actionSave_Game_As) self.menuEdit.addAction(self.actionCopy_FEN4) self.menuEdit.addAction(self.actionPaste_FEN4) self.menuView.addAction(self.actionRotate_Board_Left) self.menuView.addAction(self.actionRotate_Board_Right) self.menuView.addAction(self.actionFlip_Board) self.menu4PlayerChess.addAction(self.actionAbout) self.menu4PlayerChess.addAction(self.actionCheck_for_Updates) self.menu4PlayerChess.addSeparator() self.menu4PlayerChess.addAction(self.actionPreferences) self.menu4PlayerChess.addSeparator() self.menu4PlayerChess.addAction(self.actionQuit) self.menuHelp.addAction(self.actionAbout_PyQt) self.menuHelp.addSeparator() self.menuHelp.addAction(self.actionQuick_Reference) self.menuHelp.addAction(self.actionReport_Bug) self.menubar.addAction(self.menu4PlayerChess.menuAction()) self.menubar.addAction(self.menuFile.menuAction()) self.menubar.addAction(self.menuEdit.menuAction()) self.menubar.addAction(self.menuView.menuAction()) self.menubar.addAction(self.menuHelp.menuAction()) self.retranslateUi(MainWindow) self.tabWidget.setCurrentIndex(0) QtCore.QMetaObject.connectSlotsByName(MainWindow)
class Ui_MainWindow(object): def setupUi(self, MainWindow): MainWindow.setObjectName("MainWindow") MainWindow.resize(1200, 900) MainWindow.setFocusPolicy(QtCore.Qt.StrongFocus) MainWindow.setStyleSheet("") self.centralwidget = QtWidgets.QWidget(MainWindow) self.centralwidget.setStyleSheet("background-color: rgb(50, 50, 50);") self.centralwidget.setObjectName("centralwidget") self.mainLayout = QtWidgets.QHBoxLayout(self.centralwidget) self.mainLayout.setContentsMargins(50, 50, 50, 50) self.mainLayout.setSpacing(50) self.mainLayout.setObjectName("mainLayout") self.view = View(self.centralwidget) sizePolicy = QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.Fixed, QtWidgets.QSizePolicy.Fixed) sizePolicy.setHorizontalStretch(0) sizePolicy.setVerticalStretch(0) sizePolicy.setHeightForWidth( self.view.sizePolicy().hasHeightForWidth()) self.view.setSizePolicy(sizePolicy) self.view.setMinimumSize(QtCore.QSize(700, 700)) self.view.setBaseSize(QtCore.QSize(0, 0)) palette = QtGui.QPalette() brush = QtGui.QBrush(QtGui.QColor(0, 0, 0)) brush.setStyle(QtCore.Qt.SolidPattern) palette.setBrush(QtGui.QPalette.Active, QtGui.QPalette.WindowText, brush) brush = QtGui.QBrush(QtGui.QColor(50, 50, 50)) brush.setStyle(QtCore.Qt.SolidPattern) palette.setBrush(QtGui.QPalette.Active, QtGui.QPalette.Button, brush) brush = QtGui.QBrush(QtGui.QColor(245, 245, 245)) brush.setStyle(QtCore.Qt.SolidPattern) palette.setBrush(QtGui.QPalette.Active, QtGui.QPalette.Light, brush) brush = QtGui.QBrush(QtGui.QColor(220, 220, 220)) brush.setStyle(QtCore.Qt.SolidPattern) palette.setBrush(QtGui.QPalette.Active, QtGui.QPalette.Midlight, brush) brush = QtGui.QBrush(QtGui.QColor(145, 145, 145)) brush.setStyle(QtCore.Qt.SolidPattern) palette.setBrush(QtGui.QPalette.Active, QtGui.QPalette.Dark, brush) brush = QtGui.QBrush(QtGui.QColor(170, 170, 170)) brush.setStyle(QtCore.Qt.SolidPattern) palette.setBrush(QtGui.QPalette.Active, QtGui.QPalette.Mid, brush) brush = QtGui.QBrush(QtGui.QColor(0, 0, 0)) brush.setStyle(QtCore.Qt.SolidPattern) palette.setBrush(QtGui.QPalette.Active, QtGui.QPalette.Text, brush) brush = QtGui.QBrush(QtGui.QColor(0, 0, 0)) brush.setStyle(QtCore.Qt.SolidPattern) palette.setBrush(QtGui.QPalette.Active, QtGui.QPalette.ButtonText, brush) brush = QtGui.QBrush(QtGui.QColor(50, 50, 50)) brush.setStyle(QtCore.Qt.SolidPattern) palette.setBrush(QtGui.QPalette.Active, QtGui.QPalette.Base, brush) brush = QtGui.QBrush(QtGui.QColor(50, 50, 50)) brush.setStyle(QtCore.Qt.SolidPattern) palette.setBrush(QtGui.QPalette.Active, QtGui.QPalette.Window, brush) brush = QtGui.QBrush(QtGui.QColor(0, 0, 0)) brush.setStyle(QtCore.Qt.SolidPattern) palette.setBrush(QtGui.QPalette.Inactive, QtGui.QPalette.WindowText, brush) brush = QtGui.QBrush(QtGui.QColor(50, 50, 50)) brush.setStyle(QtCore.Qt.SolidPattern) palette.setBrush(QtGui.QPalette.Inactive, QtGui.QPalette.Button, brush) brush = QtGui.QBrush(QtGui.QColor(245, 245, 245)) brush.setStyle(QtCore.Qt.SolidPattern) palette.setBrush(QtGui.QPalette.Inactive, QtGui.QPalette.Light, brush) brush = QtGui.QBrush(QtGui.QColor(220, 220, 220)) brush.setStyle(QtCore.Qt.SolidPattern) palette.setBrush(QtGui.QPalette.Inactive, QtGui.QPalette.Midlight, brush) brush = QtGui.QBrush(QtGui.QColor(145, 145, 145)) brush.setStyle(QtCore.Qt.SolidPattern) palette.setBrush(QtGui.QPalette.Inactive, QtGui.QPalette.Dark, brush) brush = QtGui.QBrush(QtGui.QColor(170, 170, 170)) brush.setStyle(QtCore.Qt.SolidPattern) palette.setBrush(QtGui.QPalette.Inactive, QtGui.QPalette.Mid, brush) brush = QtGui.QBrush(QtGui.QColor(0, 0, 0)) brush.setStyle(QtCore.Qt.SolidPattern) palette.setBrush(QtGui.QPalette.Inactive, QtGui.QPalette.Text, brush) brush = QtGui.QBrush(QtGui.QColor(0, 0, 0)) brush.setStyle(QtCore.Qt.SolidPattern) palette.setBrush(QtGui.QPalette.Inactive, QtGui.QPalette.ButtonText, brush) brush = QtGui.QBrush(QtGui.QColor(50, 50, 50)) brush.setStyle(QtCore.Qt.SolidPattern) palette.setBrush(QtGui.QPalette.Inactive, QtGui.QPalette.Base, brush) brush = QtGui.QBrush(QtGui.QColor(50, 50, 50)) brush.setStyle(QtCore.Qt.SolidPattern) palette.setBrush(QtGui.QPalette.Inactive, QtGui.QPalette.Window, brush) brush = QtGui.QBrush(QtGui.QColor(145, 145, 145)) brush.setStyle(QtCore.Qt.SolidPattern) palette.setBrush(QtGui.QPalette.Disabled, QtGui.QPalette.WindowText, brush) brush = QtGui.QBrush(QtGui.QColor(50, 50, 50)) brush.setStyle(QtCore.Qt.SolidPattern) palette.setBrush(QtGui.QPalette.Disabled, QtGui.QPalette.Button, brush) brush = QtGui.QBrush(QtGui.QColor(245, 245, 245)) brush.setStyle(QtCore.Qt.SolidPattern) palette.setBrush(QtGui.QPalette.Disabled, QtGui.QPalette.Light, brush) brush = QtGui.QBrush(QtGui.QColor(220, 220, 220)) brush.setStyle(QtCore.Qt.SolidPattern) palette.setBrush(QtGui.QPalette.Disabled, QtGui.QPalette.Midlight, brush) brush = QtGui.QBrush(QtGui.QColor(145, 145, 145)) brush.setStyle(QtCore.Qt.SolidPattern) palette.setBrush(QtGui.QPalette.Disabled, QtGui.QPalette.Dark, brush) brush = QtGui.QBrush(QtGui.QColor(170, 170, 170)) brush.setStyle(QtCore.Qt.SolidPattern) palette.setBrush(QtGui.QPalette.Disabled, QtGui.QPalette.Mid, brush) brush = QtGui.QBrush(QtGui.QColor(145, 145, 145)) brush.setStyle(QtCore.Qt.SolidPattern) palette.setBrush(QtGui.QPalette.Disabled, QtGui.QPalette.Text, brush) brush = QtGui.QBrush(QtGui.QColor(145, 145, 145)) brush.setStyle(QtCore.Qt.SolidPattern) palette.setBrush(QtGui.QPalette.Disabled, QtGui.QPalette.ButtonText, brush) brush = QtGui.QBrush(QtGui.QColor(50, 50, 50)) brush.setStyle(QtCore.Qt.SolidPattern) palette.setBrush(QtGui.QPalette.Disabled, QtGui.QPalette.Base, brush) brush = QtGui.QBrush(QtGui.QColor(50, 50, 50)) brush.setStyle(QtCore.Qt.SolidPattern) palette.setBrush(QtGui.QPalette.Disabled, QtGui.QPalette.Window, brush) self.view.setPalette(palette) self.view.setObjectName("view") self.mainLayout.addWidget(self.view) self.verticalLayout = QtWidgets.QVBoxLayout() self.verticalLayout.setSpacing(20) self.verticalLayout.setObjectName("verticalLayout") self.tabWidget = QtWidgets.QTabWidget(self.centralwidget) sizePolicy = QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.Fixed, QtWidgets.QSizePolicy.Fixed) sizePolicy.setHorizontalStretch(0) sizePolicy.setVerticalStretch(0) sizePolicy.setHeightForWidth( self.tabWidget.sizePolicy().hasHeightForWidth()) self.tabWidget.setSizePolicy(sizePolicy) self.tabWidget.setMinimumSize(QtCore.QSize(320, 580)) self.tabWidget.setFocusPolicy(QtCore.Qt.NoFocus) self.tabWidget.setStyleSheet( "QPushButton {\n" " background: qlineargradient(x1: 0, y1: 0, x2: 0, y2: 1,\n" "stop: 0 rgb(150, 150, 150), stop: 0.4 rgb(135, 135, 135),\n" "stop: 0.5 rgb(125, 125, 125), stop: 1.0 rgb(110, 110, 110));\n" " border: 1px solid rgb(100, 100, 100);\n" " border-radius: 4px;\n" " color: black;\n" " padding: 5px 10px;\n" "}\n" "QPushButton:hover {\n" " background: qlineargradient(x1: 0, y1: 0, x2: 0, y2: 1, stop: 0 rgb(200, 200, 200), stop: 0.4 rgb(185, 185, 185), stop: 0.5 rgb(175, 175, 175), stop: 1.0 rgb(160, 160, 160));\n" "}\n" "QPushButton:pressed {\n" " background: qlineargradient(x1: 0, y1: 0, x2: 0, y2: 1, stop: 0 rgb(220, 220, 220), stop: 0.4 rgb(205, 205, 205), stop: 0.5 rgb(195, 195, 195), stop: 1.0 rgb(180, 180, 180));\n" "}\n" "QTabWidget::pane {\n" " border-top: 1px solid rgb(150, 150, 150);\n" "}\n" "QTabWidget::tab-bar {\n" " left: 10px;\n" "}\n" "QTabBar::tab {\n" " background: qlineargradient(x1: 0, y1: 0, x2: 0, y2: 1, stop: 0 rgb(180, 180, 180), stop: 0.4 rgb(165, 165, 165), stop: 0.5 rgb(155, 155, 155), stop: 1.0 rgb(140, 140, 140));\n" " border: 1px solid rgb(150, 150, 150);\n" " border-top-left-radius: 4px;\n" " border-top-right-radius: 4px;\n" " min-width: 10ex;\n" " padding: 2px;\n" "}\n" "QTabBar::tab:selected, QTabBar::tab:hover {\n" " background: qlineargradient(x1: 0, y1: 0, x2: 0, y2: 1, stop: 0 rgb(220, 220, 220), stop: 0.4 rgb(205, 205, 205), stop: 0.5 rgb(195, 195, 195), stop: 1.0 rgb(180, 180, 180));\n" "}\n" "QTabBar::tab:!selected {\n" " margin-top: 2px;\n" "}\n" "QTabBar::tab:selected {\n" " margin-left: -4px;\n" " margin-right: -4px;\n" "}\n" "QTabBar::tab:first:selected {\n" " margin-left: 0;\n" "}\n" "QTabBar::tab:last:selected {\n" " margin-right: 0;\n" "}\n" "QTabBar::tab:only-one {\n" " margin: 0;\n" "}") self.tabWidget.setObjectName("tabWidget") self.moveListTab = QtWidgets.QWidget() self.moveListTab.setObjectName("moveListTab") self.layoutWidget = QtWidgets.QWidget(self.moveListTab) self.layoutWidget.setGeometry(QtCore.QRect(10, 10, 302, 542)) self.layoutWidget.setObjectName("layoutWidget") self.verticalLayout_2 = QtWidgets.QVBoxLayout(self.layoutWidget) self.verticalLayout_2.setContentsMargins(0, 0, 0, 0) self.verticalLayout_2.setObjectName("verticalLayout_2") self.commentField = CommentEdit(self.layoutWidget) sizePolicy = QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.Fixed, QtWidgets.QSizePolicy.Fixed) sizePolicy.setHorizontalStretch(0) sizePolicy.setVerticalStretch(0) sizePolicy.setHeightForWidth( self.commentField.sizePolicy().hasHeightForWidth()) self.commentField.setSizePolicy(sizePolicy) self.commentField.setMinimumSize(QtCore.QSize(300, 90)) self.commentField.setMaximumSize(QtCore.QSize(16777215, 90)) self.commentField.setStyleSheet( "background-color: rgb(255, 255, 255);") self.commentField.setFrameShape(QtWidgets.QFrame.NoFrame) self.commentField.setObjectName("commentField") self.verticalLayout_2.addWidget(self.commentField) self.moveListWidget = QtWidgets.QListWidget(self.layoutWidget) sizePolicy = QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.Fixed, QtWidgets.QSizePolicy.Fixed) sizePolicy.setHorizontalStretch(0) sizePolicy.setVerticalStretch(0) sizePolicy.setHeightForWidth( self.moveListWidget.sizePolicy().hasHeightForWidth()) self.moveListWidget.setSizePolicy(sizePolicy) self.moveListWidget.setMinimumSize(QtCore.QSize(300, 400)) font = QtGui.QFont() font.setBold(True) font.setWeight(75) self.moveListWidget.setFont(font) self.moveListWidget.setFocusPolicy(QtCore.Qt.NoFocus) self.moveListWidget.setStyleSheet( "background-color: rgb(255, 255, 255);") self.moveListWidget.setFrameShape(QtWidgets.QFrame.NoFrame) self.moveListWidget.setEditTriggers( QtWidgets.QAbstractItemView.NoEditTriggers) self.moveListWidget.setProperty("showDropIndicator", False) self.moveListWidget.setObjectName("moveListWidget") self.verticalLayout_2.addWidget(self.moveListWidget) self.horizontalLayout_2 = QtWidgets.QHBoxLayout() self.horizontalLayout_2.setSpacing(5) self.horizontalLayout_2.setObjectName("horizontalLayout_2") self.firstMoveButton = QtWidgets.QPushButton(self.layoutWidget) self.firstMoveButton.setObjectName("firstMoveButton") self.horizontalLayout_2.addWidget(self.firstMoveButton) self.prevMoveButton = QtWidgets.QPushButton(self.layoutWidget) self.prevMoveButton.setObjectName("prevMoveButton") self.horizontalLayout_2.addWidget(self.prevMoveButton) self.nextMoveButton = QtWidgets.QPushButton(self.layoutWidget) self.nextMoveButton.setObjectName("nextMoveButton") self.horizontalLayout_2.addWidget(self.nextMoveButton) self.lastMoveButton = QtWidgets.QPushButton(self.layoutWidget) self.lastMoveButton.setObjectName("lastMoveButton") self.horizontalLayout_2.addWidget(self.lastMoveButton) self.verticalLayout_2.addLayout(self.horizontalLayout_2) self.tabWidget.addTab(self.moveListTab, "") self.pgnTab = QtWidgets.QWidget() self.pgnTab.setObjectName("pgnTab") self.layoutWidget1 = QtWidgets.QWidget(self.pgnTab) self.layoutWidget1.setGeometry(QtCore.QRect(10, 10, 302, 542)) self.layoutWidget1.setObjectName("layoutWidget1") self.verticalLayout_4 = QtWidgets.QVBoxLayout(self.layoutWidget1) self.verticalLayout_4.setContentsMargins(0, 0, 0, 0) self.verticalLayout_4.setObjectName("verticalLayout_4") self.pgnField = QtWidgets.QPlainTextEdit(self.layoutWidget1) sizePolicy = QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.Fixed, QtWidgets.QSizePolicy.Fixed) sizePolicy.setHorizontalStretch(0) sizePolicy.setVerticalStretch(0) sizePolicy.setHeightForWidth( self.pgnField.sizePolicy().hasHeightForWidth()) self.pgnField.setSizePolicy(sizePolicy) self.pgnField.setMinimumSize(QtCore.QSize(300, 500)) font = QtGui.QFont() font.setFamily("Trebuchet MS") self.pgnField.setFont(font) self.pgnField.setStyleSheet("background-color: rgb(255, 255, 255);") self.pgnField.setFrameShape(QtWidgets.QFrame.NoFrame) self.pgnField.setObjectName("pgnField") self.verticalLayout_4.addWidget(self.pgnField) self.horizontalLayout_3 = QtWidgets.QHBoxLayout() self.horizontalLayout_3.setSpacing(5) self.horizontalLayout_3.setObjectName("horizontalLayout_3") self.loadPgnButton = QtWidgets.QPushButton(self.layoutWidget1) self.loadPgnButton.setObjectName("loadPgnButton") self.horizontalLayout_3.addWidget(self.loadPgnButton) self.savePgnButton = QtWidgets.QPushButton(self.layoutWidget1) self.savePgnButton.setEnabled(True) self.savePgnButton.setObjectName("savePgnButton") self.horizontalLayout_3.addWidget(self.savePgnButton) spacerItem = QtWidgets.QSpacerItem(40, 20, QtWidgets.QSizePolicy.Expanding, QtWidgets.QSizePolicy.Minimum) self.horizontalLayout_3.addItem(spacerItem) self.verticalLayout_4.addLayout(self.horizontalLayout_3) self.tabWidget.addTab(self.pgnTab, "") self.verticalLayout.addWidget(self.tabWidget) self.fenGroupBox = QtWidgets.QGroupBox(self.centralwidget) sizePolicy = QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.Fixed, QtWidgets.QSizePolicy.Fixed) sizePolicy.setHorizontalStretch(0) sizePolicy.setVerticalStretch(0) sizePolicy.setHeightForWidth( self.fenGroupBox.sizePolicy().hasHeightForWidth()) self.fenGroupBox.setSizePolicy(sizePolicy) self.fenGroupBox.setMinimumSize(QtCore.QSize(320, 110)) self.fenGroupBox.setStyleSheet( "QGroupBox {\n" " background: none;\n" " border: none;\n" " color: rgb(255, 255, 255);\n" " font-weight: bold;\n" "}\n" "QPushButton {\n" " background: qlineargradient(x1: 0, y1: 0, x2: 0, y2: 1, stop: 0 rgb(150, 150, 150), stop: 0.4 rgb(135, 135, 135), stop: 0.5 rgb(125, 125, 125), stop: 1.0 rgb(110, 110, 110));\n" " border: 1px solid rgb(100, 100, 100);\n" " border-radius: 4px;\n" " color: black;\n" " padding: 5px 10px;\n" "}\n" "QPushButton:hover {\n" " background: qlineargradient(x1: 0, y1: 0, x2: 0, y2: 1, stop: 0 rgb(200, 200, 200), stop: 0.4 rgb(185, 185, 185), stop: 0.5 rgb(175, 175, 175), stop: 1.0 rgb(160, 160, 160));\n" "}\n" "QPushButton:pressed {\n" " background: qlineargradient(x1: 0, y1: 0, x2: 0, y2: 1, stop: 0 rgb(220, 220, 220), stop: 0.4 rgb(205, 205, 205), stop: 0.5 rgb(195, 195, 195), stop: 1.0 rgb(180, 180, 180));\n" "}\n" "QPushButton#boardResetButton {\n" " font-weight: bold;\n" "}") self.fenGroupBox.setObjectName("fenGroupBox") self.layoutWidget2 = QtWidgets.QWidget(self.fenGroupBox) self.layoutWidget2.setGeometry(QtCore.QRect(10, 30, 302, 72)) self.layoutWidget2.setObjectName("layoutWidget2") self.verticalLayout_3 = QtWidgets.QVBoxLayout(self.layoutWidget2) self.verticalLayout_3.setContentsMargins(0, 0, 0, 0) self.verticalLayout_3.setObjectName("verticalLayout_3") self.fenField = QtWidgets.QPlainTextEdit(self.layoutWidget2) sizePolicy = QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.Fixed, QtWidgets.QSizePolicy.Fixed) sizePolicy.setHorizontalStretch(0) sizePolicy.setVerticalStretch(0) sizePolicy.setHeightForWidth( self.fenField.sizePolicy().hasHeightForWidth()) self.fenField.setSizePolicy(sizePolicy) self.fenField.setMinimumSize(QtCore.QSize(300, 0)) self.fenField.setMaximumSize(QtCore.QSize(16777215, 25)) font = QtGui.QFont() font.setFamily("Trebuchet MS") self.fenField.setFont(font) self.fenField.setStyleSheet("background-color: rgb(255, 255, 255);\n" "color: rgb(0, 0, 0);") self.fenField.setFrameShape(QtWidgets.QFrame.NoFrame) self.fenField.setVerticalScrollBarPolicy(QtCore.Qt.ScrollBarAlwaysOff) self.fenField.setHorizontalScrollBarPolicy( QtCore.Qt.ScrollBarAlwaysOff) self.fenField.setLineWrapMode(QtWidgets.QPlainTextEdit.NoWrap) self.fenField.setObjectName("fenField") self.verticalLayout_3.addWidget(self.fenField) self.horizontalLayout = QtWidgets.QHBoxLayout() self.horizontalLayout.setObjectName("horizontalLayout") self.setFenButton = QtWidgets.QPushButton(self.layoutWidget2) self.setFenButton.setObjectName("setFenButton") self.horizontalLayout.addWidget(self.setFenButton) spacerItem1 = QtWidgets.QSpacerItem(40, 20, QtWidgets.QSizePolicy.Expanding, QtWidgets.QSizePolicy.Minimum) self.horizontalLayout.addItem(spacerItem1) self.boardResetButton = QtWidgets.QPushButton(self.layoutWidget2) self.boardResetButton.setObjectName("boardResetButton") self.horizontalLayout.addWidget(self.boardResetButton) self.verticalLayout_3.addLayout(self.horizontalLayout) self.verticalLayout.addWidget(self.fenGroupBox) self.mainLayout.addLayout(self.verticalLayout) MainWindow.setCentralWidget(self.centralwidget) self.menubar = QtWidgets.QMenuBar(MainWindow) self.menubar.setGeometry(QtCore.QRect(0, 0, 1200, 22)) self.menubar.setNativeMenuBar(False) self.menubar.setObjectName("menubar") self.menuFile = QtWidgets.QMenu(self.menubar) self.menuFile.setObjectName("menuFile") self.menuEdit = QtWidgets.QMenu(self.menubar) self.menuEdit.setObjectName("menuEdit") self.menuView = QtWidgets.QMenu(self.menubar) self.menuView.setObjectName("menuView") self.menu4PlayerChess = QtWidgets.QMenu(self.menubar) self.menu4PlayerChess.setObjectName("menu4PlayerChess") self.menuHelp = QtWidgets.QMenu(self.menubar) self.menuHelp.setObjectName("menuHelp") MainWindow.setMenuBar(self.menubar) self.statusbar = QtWidgets.QStatusBar(MainWindow) self.statusbar.setStyleSheet("background-color: rgb(50, 50, 50);\n" "color: grey;") self.statusbar.setObjectName("statusbar") MainWindow.setStatusBar(self.statusbar) self.actionLoad_Game = QtWidgets.QAction(MainWindow) self.actionLoad_Game.setObjectName("actionLoad_Game") self.actionSave_Game_As = QtWidgets.QAction(MainWindow) self.actionSave_Game_As.setObjectName("actionSave_Game_As") self.actionQuit = QtWidgets.QAction(MainWindow) self.actionQuit.setObjectName("actionQuit") self.actionCopy_FEN4 = QtWidgets.QAction(MainWindow) self.actionCopy_FEN4.setObjectName("actionCopy_FEN4") self.actionPaste_FEN4 = QtWidgets.QAction(MainWindow) self.actionPaste_FEN4.setObjectName("actionPaste_FEN4") self.actionRotate_Board_Left = QtWidgets.QAction(MainWindow) self.actionRotate_Board_Left.setObjectName("actionRotate_Board_Left") self.actionRotate_Board_Right = QtWidgets.QAction(MainWindow) self.actionRotate_Board_Right.setObjectName("actionRotate_Board_Right") self.actionFlip_Board = QtWidgets.QAction(MainWindow) self.actionFlip_Board.setObjectName("actionFlip_Board") self.actionNew_Game = QtWidgets.QAction(MainWindow) self.actionNew_Game.setObjectName("actionNew_Game") self.actionPreferences = QtWidgets.QAction(MainWindow) self.actionPreferences.setObjectName("actionPreferences") self.actionCheck_for_Updates = QtWidgets.QAction(MainWindow) self.actionCheck_for_Updates.setObjectName("actionCheck_for_Updates") self.actionAbout = QtWidgets.QAction(MainWindow) self.actionAbout.setObjectName("actionAbout") self.actionQuick_Reference = QtWidgets.QAction(MainWindow) self.actionQuick_Reference.setObjectName("actionQuick_Reference") self.actionReport_Bug = QtWidgets.QAction(MainWindow) self.actionReport_Bug.setObjectName("actionReport_Bug") self.actionAbout_PyQt = QtWidgets.QAction(MainWindow) self.actionAbout_PyQt.setObjectName("actionAbout_PyQt") self.menuFile.addAction(self.actionNew_Game) self.menuFile.addAction(self.actionLoad_Game) self.menuFile.addSeparator() self.menuFile.addAction(self.actionSave_Game_As) self.menuEdit.addAction(self.actionCopy_FEN4) self.menuEdit.addAction(self.actionPaste_FEN4) self.menuView.addAction(self.actionRotate_Board_Left) self.menuView.addAction(self.actionRotate_Board_Right) self.menuView.addAction(self.actionFlip_Board) self.menu4PlayerChess.addAction(self.actionAbout) self.menu4PlayerChess.addAction(self.actionCheck_for_Updates) self.menu4PlayerChess.addSeparator() self.menu4PlayerChess.addAction(self.actionPreferences) self.menu4PlayerChess.addSeparator() self.menu4PlayerChess.addAction(self.actionQuit) self.menuHelp.addAction(self.actionAbout_PyQt) self.menuHelp.addSeparator() self.menuHelp.addAction(self.actionQuick_Reference) self.menuHelp.addAction(self.actionReport_Bug) self.menubar.addAction(self.menu4PlayerChess.menuAction()) self.menubar.addAction(self.menuFile.menuAction()) self.menubar.addAction(self.menuEdit.menuAction()) self.menubar.addAction(self.menuView.menuAction()) self.menubar.addAction(self.menuHelp.menuAction()) self.retranslateUi(MainWindow) self.tabWidget.setCurrentIndex(0) QtCore.QMetaObject.connectSlotsByName(MainWindow) def retranslateUi(self, MainWindow): _translate = QtCore.QCoreApplication.translate MainWindow.setWindowTitle(_translate("MainWindow", "4PlayerChess")) self.commentField.setPlaceholderText( _translate("MainWindow", "Enter comment for this move...")) self.firstMoveButton.setStatusTip( _translate("MainWindow", "Go to first move")) self.firstMoveButton.setText(_translate("MainWindow", "|<")) self.prevMoveButton.setStatusTip( _translate("MainWindow", "Go to previous move")) self.prevMoveButton.setText(_translate("MainWindow", "<")) self.nextMoveButton.setStatusTip( _translate("MainWindow", "Go to next move")) self.nextMoveButton.setText(_translate("MainWindow", ">")) self.lastMoveButton.setStatusTip( _translate("MainWindow", "Go to last move")) self.lastMoveButton.setText(_translate("MainWindow", ">|")) self.tabWidget.setTabText(self.tabWidget.indexOf(self.moveListTab), _translate("MainWindow", "Move List")) self.loadPgnButton.setStatusTip( _translate("MainWindow", "Load game from PGN4 file")) self.loadPgnButton.setText(_translate("MainWindow", "Load...")) self.savePgnButton.setStatusTip( _translate("MainWindow", "Save game to PGN4 file")) self.savePgnButton.setText(_translate("MainWindow", "Save As...")) self.tabWidget.setTabText(self.tabWidget.indexOf(self.pgnTab), _translate("MainWindow", "PGN4")) self.fenGroupBox.setTitle( _translate("MainWindow", "Current Position (FEN4):")) self.fenField.setStatusTip(_translate("MainWindow", "Enter FEN4")) self.fenField.setPlaceholderText( _translate("MainWindow", "Enter FEN4 here...")) self.setFenButton.setStatusTip( _translate("MainWindow", "Set position to specified FEN4")) self.setFenButton.setText(_translate("MainWindow", "Set Position")) self.boardResetButton.setStatusTip( _translate("MainWindow", "Reset board")) self.boardResetButton.setText(_translate("MainWindow", "Reset Board")) self.menuFile.setTitle(_translate("MainWindow", "File")) self.menuEdit.setTitle(_translate("MainWindow", "Edit")) self.menuView.setTitle(_translate("MainWindow", "View")) self.menu4PlayerChess.setTitle(_translate("MainWindow", "4PlayerChess")) self.menuHelp.setTitle(_translate("MainWindow", "Help")) self.actionLoad_Game.setText(_translate("MainWindow", "Load Game...")) self.actionLoad_Game.setToolTip( _translate("MainWindow", "Load Game...")) self.actionLoad_Game.setStatusTip( _translate("MainWindow", "Load game from PGN4 file")) self.actionLoad_Game.setShortcut(_translate("MainWindow", "Ctrl+O")) self.actionSave_Game_As.setText( _translate("MainWindow", "Save Game As...")) self.actionSave_Game_As.setToolTip( _translate("MainWindow", "Save Game As...")) self.actionSave_Game_As.setStatusTip( _translate("MainWindow", "Save game to PGN4 file")) self.actionSave_Game_As.setShortcut(_translate("MainWindow", "Ctrl+S")) self.actionQuit.setText(_translate("MainWindow", "Quit 4PlayerChess")) self.actionQuit.setStatusTip( _translate("MainWindow", "Quit application")) self.actionQuit.setShortcut(_translate("MainWindow", "Ctrl+Q")) self.actionCopy_FEN4.setText(_translate("MainWindow", "Copy FEN4")) self.actionCopy_FEN4.setStatusTip( _translate("MainWindow", "Copy FEN4 to clipboard")) self.actionCopy_FEN4.setShortcut(_translate("MainWindow", "Ctrl+C")) self.actionPaste_FEN4.setText(_translate("MainWindow", "Paste FEN4")) self.actionPaste_FEN4.setStatusTip( _translate("MainWindow", "Paste FEN4 from clipboard")) self.actionPaste_FEN4.setShortcut(_translate("MainWindow", "Ctrl+V")) self.actionRotate_Board_Left.setText( _translate("MainWindow", "Rotate Board Left")) self.actionRotate_Board_Left.setStatusTip( _translate("MainWindow", "Rotate board counterclockwise (next player)")) self.actionRotate_Board_Left.setShortcut( _translate("MainWindow", "Ctrl+L")) self.actionRotate_Board_Right.setText( _translate("MainWindow", "Rotate Board Right")) self.actionRotate_Board_Right.setStatusTip( _translate("MainWindow", "Rotate board clockwise (previous player)")) self.actionRotate_Board_Right.setShortcut( _translate("MainWindow", "Ctrl+R")) self.actionFlip_Board.setText(_translate("MainWindow", "Flip Board")) self.actionFlip_Board.setStatusTip( _translate("MainWindow", "Flip board")) self.actionFlip_Board.setShortcut(_translate("MainWindow", "Ctrl+F")) self.actionNew_Game.setText(_translate("MainWindow", "New Game")) self.actionNew_Game.setStatusTip( _translate("MainWindow", "Start new game")) self.actionNew_Game.setShortcut(_translate("MainWindow", "Ctrl+N")) self.actionPreferences.setText( _translate("MainWindow", "Preferences...")) self.actionPreferences.setStatusTip( _translate("MainWindow", "Application preferences")) self.actionCheck_for_Updates.setText( _translate("MainWindow", "Check for Updates...")) self.actionCheck_for_Updates.setStatusTip( _translate("MainWindow", "Check if updates are available")) self.actionAbout.setText(_translate("MainWindow", "About 4PlayerChess")) self.actionAbout.setStatusTip( _translate("MainWindow", "Application info")) self.actionQuick_Reference.setText( _translate("MainWindow", "Quick Reference Guide")) self.actionQuick_Reference.setStatusTip( _translate("MainWindow", "Overview of application features and shortcuts")) self.actionReport_Bug.setText( _translate("MainWindow", "Report Bug or Request Feature...")) self.actionReport_Bug.setStatusTip( _translate( "MainWindow", "Open GitHub issues page in browser to report a bug or request a feature" )) self.actionAbout_PyQt.setText(_translate("MainWindow", "About PyQt"))