Exemplo n.º 1
0
    def initUI(self):
        self.setWindowTitle('Graph visualization')
        self.resize(1200, 600)
        self.toCenter()

        name_label = QLabel("Enter name:", self)
        name_label.resize(name_label.sizeHint())
        self.nameEdit = QLineEdit("Name", self)
        self.nameEdit.setObjectName("file")
        self.nameEdit.resize(self.nameEdit.sizeHint())
        self.nameEdit.setToolTip('Select file')

        self.error_label = QLabel("", self)
        self.error_label.resize(name_label.sizeHint())
        self.error_label.hide()
        enter_game_button = QPushButton('Enter', self)
        enter_game_button.resize(enter_game_button.sizeHint())

        home_button = QPushButton('Home', self)
        home_button.resize(home_button.sizeHint())

        weight_visibler_button = QPushButton('Show/Hide weight', self)
        weight_visibler_button.resize(weight_visibler_button.sizeHint())

        load_status_layout = QVBoxLayout()
        load_status_layout.setSpacing(0)
        load_status_layout.addWidget(self.nameEdit)
        load_status_layout.addWidget(self.error_label)

        tools_grid = QGridLayout()
        tools_grid.setHorizontalSpacing(10)
        tools_grid.setVerticalSpacing(5)
        tools_grid.addWidget(name_label, 1, 0)
        tools_grid.addLayout(load_status_layout, 1, 1)
        tools_grid.addWidget(enter_game_button, 1, 2)

        tools_grid.addWidget(home_button, 2, 0)
        tools_grid.addWidget(weight_visibler_button, 2, 2)

        graph_drawer = GraphDrawer()
        graph_drawer.resize(500, 800)
        self.graphWidget = graph_drawer
        verticalLayout = QSplitter()

        verticalLayout.addWidget(self.graphWidget)
        verticalLayout.addWidget(LegendDrawer(self))
        verticalLayout.SetMinimumSize = (800, 670)
        tools_grid.addWidget(verticalLayout, 3, 0, 3, 3)
        tools_grid.SetMinimumSize = (900, 680)
        self.setLayout(tools_grid)

        home_button.clicked.connect(self.graphWidget.cameraToHome)
        enter_game_button.clicked.connect(self.enterTheGame)
        weight_visibler_button.clicked.connect(self.changeWeightVisibility)
        self.show()