def __init__(self): super().__init__() visualize_button = PushButton("Visualization") visualize_button.clicked.connect(self.visualize_button_clicked) # to style it in our stylesheet visualize_button.setObjectName("bigButton") bulk_investigation_button = PushButton("Investigation / Settings") bulk_investigation_button.clicked.connect( self.bulk_investigation_button_clicked) bulk_investigation_button.setObjectName("bigButton") for button in [visualize_button, bulk_investigation_button]: font = button.font() font.setPointSize(30) button.setFont(font) expanding = QSizePolicy() expanding.setHorizontalPolicy(QSizePolicy.Expanding) expanding.setVerticalPolicy(QSizePolicy.Expanding) button.setSizePolicy(expanding) layout = QHBoxLayout() layout.addWidget(visualize_button) layout.addWidget(bulk_investigation_button) layout.setContentsMargins(15, 15, 15, 10) self.setLayout(layout)
def __init__(self): super().__init__() self._cg = None self.visualizer = None self.old_api_key = get_setting("api_key") self.loadables_q = Queue() # this thread continually checks for new loadables to load self.cg_load_thread = threading.Thread(target=self._load_loadables) # we never kill this thread, so allow the application to quit while it's # still alive self.cg_load_thread.daemon = True self.cg_load_thread.start() self.loadable_loaded = threading.Event() self.show_visualizer_window.connect(self.show_visualizer) self.show_exception_signal.connect(self.show_exception) expanding = QSizePolicy() expanding.setHorizontalPolicy(QSizePolicy.Expanding) expanding.setVerticalPolicy(QSizePolicy.Expanding) self.drop_area = ReplayDropArea() self.drop_area.setSizePolicy(expanding) da_scroll_area = QScrollArea(self) da_scroll_area.setWidget(self.drop_area) da_scroll_area.setWidgetResizable(True) da_scroll_area.setFrameShape(QFrame.NoFrame) self.replay_map_creation = ReplayMapCreation() self.replay_map_creation.setSizePolicy(expanding) rmc_scroll_area = QScrollArea(self) rmc_scroll_area.setWidget(self.replay_map_creation) rmc_scroll_area.setWidgetResizable(True) rmc_scroll_area.setFrameShape(QFrame.NoFrame) visualize_button = PushButton("Visualize") visualize_button.setObjectName("bigButton") visualize_button.clicked.connect(self.visualize) font = visualize_button.font() font.setPointSize(30) visualize_button.setFont(font) expanding = QSizePolicy() expanding.setHorizontalPolicy(QSizePolicy.Expanding) expanding.setVerticalPolicy(QSizePolicy.Expanding) visualize_button.setSizePolicy(expanding) layout = QGridLayout() layout.addWidget(da_scroll_area, 0, 0, 6, 1) layout.addWidget(rmc_scroll_area, 0, 1, 6, 1) layout.addWidget(visualize_button, 6, 0, 2, 2) self.setLayout(layout)
class MainWidget(QFrame): def __init__(self): super().__init__() self.back_button = PushButton() self.back_button.setFixedWidth(55) self.back_button.setFixedHeight(30) self.back_button.setIcon(QIcon(resource_path("back_arrow.png"))) # so we can reference just this button in css self.back_button.setObjectName("backButton") self.back_button.clicked.connect(lambda: self.set_index(0)) # offset by a bit so we're not right against the window border margins = self.back_button.contentsMargins() margins.setLeft(10) margins.setTop(10) self.back_button.setContentsMargins(margins) self.stacked_widget = QStackedWidget() window_selector = WindowSelector() window_selector.visualize_button_clicked.connect( lambda: self.set_index(1)) window_selector.bulk_investigation_button_clicked.connect( lambda: self.set_index(2)) self.analysis_selection = AnalysisSelection() self.cg_classic = CircleguardClassic() self.stacked_widget.addWidget(window_selector) self.stacked_widget.addWidget(self.analysis_selection) self.stacked_widget.addWidget(self.cg_classic) index_map = {"selection": 0, "visualization": 1, "investigation": 2} index = index_map[get_setting("default_page")] self.set_index(index) layout = QVBoxLayout() layout.addWidget(self.back_button) layout.addWidget(self.stacked_widget) layout.setContentsMargins(0, 0, 0, 0) layout.setSpacing(0) self.setLayout(layout) def set_index(self, index): # don't show the back button on the selection page itself self.back_button.hide() if index == 0 else self.back_button.show() self.stacked_widget.setCurrentIndex(index)