def __init__(self, id, app: QApplication, *args, **kwargs): super().__init__(*args, **kwargs) self.id = id self.image_quality = CONFIGURATIONS['cameras']['cam%d' % id]['quality'] self.image_resolution = CONFIGURATIONS['cameras']['cam%d' % id]['resolution'] self.box = QVBoxLayout() self.setLayout(self.box) self.tabs = QTabWidget() self.camera_feed = CameraFeed(self.id, app) self.status_frame = QFrame() self.status_frame.setSizePolicy(QSizePolicy.Fixed, QSizePolicy.Fixed) self.status_frame.setMinimumSize(250, 340) self.status = QScrollArea() self.status.setWidget(self.status_frame) self.initStatus() self.network_graphs = pg.GraphicsLayoutWidget() self.traffic_graphs = pg.GraphicsLayoutWidget() self.frame_rate_graphs = pg.GraphicsLayoutWidget() self.initGraphs() self.box.addWidget(self.tabs) self.tabs.addTab(self.camera_feed, 'Camera') self.tabs.addTab(self.status, 'Status') self.tabs.addTab(self.traffic_graphs, "Traffic") self.tabs.addTab(self.network_graphs, "Latency") self.tabs.addTab(self.frame_rate_graphs, "Video") self.setMinimumSize(1, 1) self.setSizePolicy(QSizePolicy.Expanding, QSizePolicy.Expanding) self.timer = QTimer() self.timer.timeout.connect(self.updateAllGraphs) self.timer.start(100)
def __init__(self, parent=None): super().__init__(parent) self.toolbar = QToolBar() self.addToolBar(self.toolbar) self.add_chapter_action = QAction("Add Chapter") self.hide_selector_action = QAction("Toggle Selection Pane") self.toolbar.addAction(self.add_chapter_action) self.toolbar.addSeparator() self.toolbar.addAction(self.hide_selector_action) self.selector_layout = QVBoxLayout() self.chapter_search_bar = QLineEdit() self.chapter_search_bar.setPlaceholderText("Search...") self.chapter_list_view = QListView() self.selector_layout.addWidget(self.chapter_search_bar) self.selector_layout.addWidget(self.chapter_list_view) self.selector_widget = QWidget() self.selector_widget.setLayout(self.selector_layout) self.selector_widget.setFixedWidth(225) self.config_tab = FE14ChapterConfigTab() self.map_tab = FE14MapEditor() self.characters_tab = FE14CharacterEditor(is_person=True) self.conversation_tab = FE14ConversationEditor() self.tab_widget = QTabWidget() self.tab_widget.addTab(self.config_tab, "Config") self.tab_widget.addTab(self.map_tab, "Map") self.tab_widget.addTab(self.characters_tab, "Characters") self.tab_widget.addTab(self.conversation_tab, "Text") self.main_layout = QHBoxLayout() self.main_widget = QWidget() self.visual_splitter = QFrame() self.visual_splitter.setFrameShape(QFrame.VLine) self.visual_splitter.setFrameShadow(QFrame.Sunken) self.main_widget.setLayout(self.main_layout) self.main_layout.addWidget(self.selector_widget) self.main_layout.addWidget(self.visual_splitter) self.main_layout.addWidget(self.tab_widget) self.setCentralWidget(self.main_widget)
def __init__(self, kind, component, parent=None): super().__init__() self.clipboard = parent.clipboard self.setWindowTitle("%s : %s" % (kind, component)) self.setGeometry(0, 0, 500, 500) # noinspection PyArgumentList self.move( QApplication.desktop().screenGeometry().center() - self.rect().center()) self.show() # Main layout self.layout = QVBoxLayout() self.setLayout(self.layout) self.display_tabs = QTabWidget() self.display = {} for k in ["yaml", "python", "bibliography"]: self.display[k] = QTextEdit() self.display[k].setLineWrapMode(QTextEdit.NoWrap) self.display[k].setFontFamily("mono") self.display[k].setCursorWidth(0) self.display[k].setReadOnly(True) self.display_tabs.addTab(self.display[k], k) self.layout.addWidget(self.display_tabs) # Fill text defaults_txt = get_default_info(component, kind, return_yaml=True) _indent = " " defaults_txt = (kind + ":\n" + _indent + component + ":\n" + 2 * _indent + ("\n" + 2 * _indent).join(defaults_txt.split("\n"))) from cobaya.yaml import yaml_load self.display["python"].setText(pformat(yaml_load(defaults_txt))) self.display["yaml"].setText(defaults_txt) self.display["bibliography"].setText(get_bib_component(component, kind)) # Buttons self.buttons = QHBoxLayout() self.close_button = QPushButton('Close', self) self.copy_button = QPushButton('Copy to clipboard', self) self.buttons.addWidget(self.close_button) self.buttons.addWidget(self.copy_button) self.close_button.released.connect(self.close) self.copy_button.released.connect(self.copy_clipb) self.layout.addLayout(self.buttons)
def __init__(self, left, top, width, height, main_ui: WindowUI): super().__init__() self.main_ui = main_ui self.layout = QVBoxLayout(self) self.tabs = QTabWidget() # Initialise tabs self.map_tab = self.set_up_map_tab(left, top, width, height) self.data_tab = QWidget() self.server_tab = ServerUI(left, top, width, height) self.server_tab.attach_status_listener(self) self.tabs.resize(width, height) # Add tabs self.tabs.addTab(self.map_tab, "Rocket Tracker") self.tabs.addTab(self.data_tab, "Data") self.tabs.addTab(self.server_tab, "Server") # Add tabs to widget self.layout.addWidget(self.tabs) self.setLayout(self.layout)
def makeTabs(self): self.tabWidget = QTabWidget() self.tab1 = QGridLayout() self.tab2 = QHBoxLayout() self.tab3 = QVBoxLayout() self.tab2.addWidget(QLabel("coming soon...")) self.tab3.addWidget(QLabel("coming soon...")) self.makeSearchView() a = QWidget() a.setLayout(self.tab1) b = QWidget() b.setLayout(self.tab2) c = QWidget() c.setLayout(self.tab3) self.tabWidget.addTab(a, 'Search') self.tabWidget.addTab(b, 'Subscriptions') self.tabWidget.addTab( c, 'Videos') #Split into 'playing' and 'Downloading' lists self.setCentralWidget(self.tabWidget) return
def __init__(self, node_set: NodeSet, parent=None): super().__init__(parent=parent) self.node_set = node_set self.tab_widget = QTabWidget() self.litecoin_tab = LitecoinTab(self.node_set.litecoin) self.tab_widget.addTab(self.litecoin_tab, 'Litecoin') self.lnd_tab = LndTab(self.node_set.lnd) self.tab_widget.addTab(self.lnd_tab, 'LND') self.button_box = QDialogButtonBox() self.button_box.addButton('Ok', QDialogButtonBox.AcceptRole) self.button_box.accepted.connect(self.accept) self.main_layout = QVBoxLayout() self.main_layout.addWidget(self.tab_widget) self.main_layout.addWidget(self.button_box) self.setLayout(self.main_layout) self.setWindowTitle('Settings')
def initUI(self): self.setWindowTitle(self.title) # Central widget self.tabs = QTabWidget() # Multiple tabs, slow to load self.tabs.currentChanged.connect(self.tab_changed) # Init tabs self.tab1 = init_tab1(self.paths) # Tab 1 self.tab2 = init_tab2(self.paths) # Tab 2 self.tab3 = init_tab3(self.paths) # Tab 3 self.tab4 = init_tab4(self.paths) # Tab 4 self.tab5 = init_tab5(self.paths) # Tab 5 # Add the tabs self.tabs.addTab(self.tab1, "MS files") self.tabs.addTab(self.tab2, "Edit workflow") self.tabs.addTab(self.tab3, "Advanced Settings") self.tabs.addTab(self.tab4, "Running jobs") self.tabs.addTab(self.tab5, "About") self.setCentralWidget(self.tabs) self.show()
def __init__(self, parent) -> None: super().__init__(parent) self.layout = QVBoxLayout(self) self.tabs = QTabWidget() # self.tabs.resize(300, 200) # Create tabs in the main application window self.scrapeTab = QWidget() self.ratingTab = QWidget() # Add the tabs to the widget self.tabs.addTab(self.scrapeTab, 'Scrape Data') self.tabs.addTab(self.ratingTab, 'Generate Rating') # Functions to layout the tabs self._layoutscrapeTab() self._layoutratingTab() self.layout.addWidget(self.tabs) self.setLayout(self.layout)
def createDialogLayout(self): self.createGeneralTab() self.cellTable = self.createDomainTable(self.mw.cellsModel) self.matTable = self.createDomainTable(self.mw.materialsModel) self.cellTab = self.createDomainTab(self.cellTable) self.matTab = self.createDomainTab(self.matTable) self.tabs = QTabWidget() self.tabs.setMaximumHeight(800) self.tabs.setSizePolicy(QSizePolicy.Expanding, QSizePolicy.Expanding) self.tabs.addTab(self.generalTab, 'General') self.tabs.addTab(self.cellTab, 'Cells') self.tabs.addTab(self.matTab, 'Materials') self.createButtonBox() self.colorDialogLayout = QVBoxLayout() #self.colorDialogLayout.setContentsMargins(0, 0, 0, 0) self.colorDialogLayout.addWidget(self.tabs) self.colorDialogLayout.addWidget(self.buttonBox) self.setLayout(self.colorDialogLayout)
def __init__(self, parent=None): super(TabWidget, self).__init__(parent) self.setWindowIcon(QtGui.QIcon("./Cyclos.png")) self.tabsWidget = QTabWidget() self.tabsWidget.setTabsClosable(True) self.tabsWidget.setMovable(False) self.tabsWidget.setDocumentMode(False) self.tabsWidget.setElideMode(Qt.ElideRight) self.tabsWidget.setUsesScrollButtons(True) self.tabsWidget.tabCloseRequested.connect(self.closeTab) self.plusButton = QtWidgets.QPushButton("+") self.plusButton.setFixedSize(QtCore.QSize(25, 25)) self.tabsWidget.setCornerWidget(self.plusButton) self.plusButton.clicked.connect(self.buttonClicked) vbox = QVBoxLayout() vbox.addWidget(self.tabsWidget) self.setLayout(vbox) self.toolbars = MultiTabNavTool([], self.tabsWidget) self.compt = 2 self.affichage = 1 self.addTab("Protocol 1", 1) self.showMaximized()
def __init__(self, parent=None): QWidget.__init__(self, parent) self.setWindowTitle('串口助手') self.setFixedSize(800, 600) self.tabwidget = QTabWidget(self) new_connect_btn = QPushButton(text='新建连接', parent=self.tabwidget) new_connect_btn.clicked.connect(self.new_connect_dialog) self.tabwidget.addTab(new_connect_btn, '欢迎') self.layout = QVBoxLayout() self.layout.addWidget(self.tabwidget) self.setLayout(self.layout) desktop = qApp.desktop() self.move((desktop.width() - self.width()) / 2, (desktop.height() - self.height()) / 2)
def _init_ui(self, ) -> None: layout = QVBoxLayout(self) self._tab_widget = QTabWidget(self) self._edit_tab_widget = self._create_edit_tab_widget() self._tab_widget.addTab( self._wrap_in_scroll_area(widget=self._edit_tab_widget, ), 'Configuration', ) raw_tab_widget = self._create_raw_tab_widget() self._tab_widget.addTab( raw_tab_widget, f'Raw ({self._entry.raw_format})', ) self._logs_widget = LogsWidget(self) self._progress_bar = self._create_progress_bar() splitter = self._create_splitter() layout.addWidget(splitter)
def _init_widgets(self): # filename filename_caption = QLabel(self) filename_caption.setText('File name:') filename = QLabel(self) filename.setText(self.filename) filename_layout = QHBoxLayout() filename_layout.addWidget(filename_caption) filename_layout.addWidget(filename) self.main_layout.addLayout(filename_layout) # central tab tab = QTabWidget() self._init_central_tab(tab) self.main_layout.addWidget(tab) # buttons ok_button = QPushButton(self) ok_button.setText('OK') ok_button.clicked.connect(self._on_ok_clicked) cancel_button = QPushButton(self) cancel_button.setText('Cancel') cancel_button.clicked.connect(self._on_cancel_clicked) buttons_layout = QHBoxLayout() buttons_layout.addWidget(ok_button) buttons_layout.addWidget(cancel_button) self.main_layout.addLayout(buttons_layout)
def __init__(self, stats_widget=None, records_widget=None, analysis_widget=None): self.width = 800 self.height = 450 QMainWindow.__init__(self) self.setWindowTitle("KD Analysis") # Creating tabs tabWidget = QTabWidget() if stats_widget is not None: self.stats_widget = stats_widget tabWidget.addTab(stats_widget, stats_widget.name) if records_widget is not None: self.records_widget = records_widget tabWidget.addTab(records_widget, records_widget.name) if analysis_widget is not None: self.analysis_widget = analysis_widget tabWidget.addTab(analysis_widget, analysis_widget.name) # Menu self.menu = self.menuBar() self.file_menu = self.menu.addMenu("File") if self.stats_widget is not None: init_action = QAction("Initialize", self) init_action.setShortcut("Ctrl+I") init_action.triggered.connect(self.stats_widget.exec_init_input_dialog) self.file_menu.addAction(init_action) # Status Bar self.status = self.statusBar() self.status.showMessage("Ready") # Window dimensions # self.setFixedSize(self.width, self.height) self.setCentralWidget(tabWidget) self.center()
def __init__(self): super().__init__() self.setWindowTitle("pppGCS : Plural Python Parrot GCS") self.DeviceInfo = ppDeviceInfoWidget() self.DeviceList = ppDiscoverWidget() self.leftcol_layout = QVBoxLayout() self.leftcol_layout.addWidget(self.DeviceInfo) self.leftcol_layout.addWidget(self.DeviceList) self.VideoViewer = ppVideoWidget() self.tabs = QTabWidget() self.tabs.addTab(self.VideoViewer, "Video stream") self.mapview = QQuickView() self.mapcontainer = QWidget.createWindowContainer(self.mapview, self) url = QUrl("map.qml") self.mapview.setSource(url) self.mapview.show() self.tabs.addTab(self.mapcontainer, "map view") self.FlightInfo = ppFlightInfoWidget() self.ControlInfo = ppControlWidget() self.rightcol_layout = QVBoxLayout() self.rightcol_layout.addWidget(self.tabs) self.lowrightcol_layout = QHBoxLayout() self.lowrightcol_layout.addWidget(self.FlightInfo) self.lowrightcol_layout.addWidget(self.ControlInfo) self.rightcol_layout.addLayout(self.lowrightcol_layout) self.layout = QHBoxLayout() self.layout.addLayout(self.leftcol_layout) self.layout.addLayout(self.rightcol_layout) self.setLayout(self.layout) self.DeviceList.DeviceChanged.connect(self.on_device_changed)
def __init__(self, main_frame): self.main_frame = main_frame # Initialize tab screen self.window = QWidget() self.layout = QVBoxLayout(self.window) self.tabs = QTabWidget() self.tabs.layout = QVBoxLayout() self.tab1 = QWidget() self.tab2 = QWidget() self.checkbox_states = {} self.wavelet_parameters = {} self.coeffs = dict() self.coeffs_zero = dict() self.coeffs_waverec = dict() self.checkbox_keep_wavelet = dict() self.attenauation_wavelet = dict() self.args = dict() self.fig_wavelet = dict() self.wavelet_combo_box = dict() self.sig_corrected = None self.order_decomp = None # Add tabs self.tabs.addTab(self.tab1, "Fourier Transform") self.tabs.addTab(self.tab2, "Wavelet Denoising") # Create first tab self._set_ui_tab1() # Create second tab self._set_ui_tab2() # Add tabs to widget self.layout.addWidget(self.tabs) self.window.setLayout(self.layout) self.window.show()
def __init__(self, parent=None): super().__init__(parent) self.setWindowTitle(self.tr("About Cutevariant")) self.setWindowIcon(QIcon(cm.DIR_ICONS + "app.png")) self.tab_widget = QTabWidget() self.header_lbl = QLabel() self.button_box = QDialogButtonBox() github_button = self.button_box.addButton("GitHub", QDialogButtonBox.HelpRole) twitter_button = self.button_box.addButton("Twitter", QDialogButtonBox.HelpRole) self.button_box.addButton(QDialogButtonBox.Ok) github_button.setIcon(FIcon(0xF02A4)) twitter_button.setIcon(FIcon(0xF0544)) vLayout = QVBoxLayout() vLayout.addWidget(self.header_lbl) vLayout.addWidget(self.tab_widget) vLayout.addWidget(self.button_box) self.setLayout(vLayout) self.addTab("LICENSE") # self.addTab("AUTHORS") # self.addTab("CREDITS") # self.addTab("CHANGELOG") self.drawHeader() # Connexions self.button_box.button(QDialogButtonBox.Ok).clicked.connect(self.close) github_button.clicked.connect(self.open_github_page) twitter_button.clicked.connect(self.open_twitter_page) self.resize(600, 400)
def __init__(self, parent=None): super().__init__(parent) self.setMinimumSize(640, 480) self.setWindowFlags(self.windowFlags() & ~Qt.WindowContextHelpButtonHint) self.setWindowTitle(self.tr("Colophon")) # Title box titleBox = DialogTitleBox() # # Content aboutPage = ColophonAboutPage() environmentPage = ColophonEnvironmentPage() licensePage = ColophonLicensePage() authorsPage = ColophonAuthorsPage() creditsPage = ColophonCreditsPage() tabBox = QTabWidget() tabBox.addTab(aboutPage, aboutPage.title()) tabBox.addTab(environmentPage, environmentPage.title()) tabBox.addTab(licensePage, licensePage.title()) tabBox.addTab(authorsPage, authorsPage.title()) tabBox.addTab(creditsPage, creditsPage.title()) # Button box buttonBox = QDialogButtonBox(QDialogButtonBox.Close) buttonBox.rejected.connect(self.close) # Main layout layout = QVBoxLayout(self) layout.addWidget(titleBox) layout.addWidget(tabBox) layout.addWidget(buttonBox)
def __init__(self): if Piasa.__instance: raise Exception("Piasa application already exists") else: QMainWindow.__init__(self) self.resize(635, 800) self.setWindowTitle("Piasa Producers Calculator") self.tab_pane = QTabWidget() self.setCentralWidget(self.tab_pane) self.time_calculator = TimeCalculator() self.beat_calculator = BeatCalculator() self.tune_calculator = TuneCalculator() self.transposer = Transposer() self.scale_calculator = ScaleCalculator() self.chord_calculator = ChordCalculator() self.tab_pane.addTab(self.chord_calculator.form, "Chords") self.tab_pane.addTab(self.scale_calculator.form, "Scale") self.tab_pane.addTab(self.beat_calculator.form, "Beat") self.tab_pane.addTab(self.transposer.form, "Transpose") self.tab_pane.addTab(self.tune_calculator.form, "Tune") self.tab_pane.addTab(self.time_calculator.form, "Time") self.beat_calculator.update_ui() self.show() sys.exit(Piasa.__qt_app.exec_())
def __init__(self, server): QDialog.__init__(self, None) self.modifier = 0 self.server = server self.setup_xmlrpc_server() self.completed = False self.fields = [] self.tabs = QTabWidget() for top in sorted(settings.SETTINGS.keys()): # pylint: disable=no-member self.tabs.addTab(self.make_tab(top), top) buttons = QDialogButtonBox( QDialogButtonBox.StandardButtons( (int(QDialogButtonBox.StandardButton.Ok) | int(QDialogButtonBox.StandardButton.Cancel)))) buttons.accepted.connect(self.accept) buttons.rejected.connect(self.reject) mainLayout = QVBoxLayout() mainLayout.addWidget(self.tabs) mainLayout.addWidget(buttons) self.setLayout(mainLayout) self.setWindowTitle(settings.SETTINGS_WINDOW_TITLE + settings.SOFTWARE_VERSION_NUMBER) self.expiration = threading.Timer(300, self.xmlrpc_kill) self.expiration.start()
def __init__(self, data, splineChartData, areaChartData, scatterChartData, pieChartData, bwChartData, candlestickChartData): QWidget.__init__(self) """ получение модели """ self.model = CustomTableModel(data) """переходим в класс CustomTableModel и создаем объект-таблицу, model-часть класса с помощью которого работаем с данными,имя поля-model """ self.table_view = QTableView() """полностью устраивает класс QTableView поэтому доп конструкторов и ф-ций не пишем, а просто создаем и он поле нашего класса, имя поля-table_view """ self.table_view.setModel(self.model) """может рисовать таблицу в соотвествие с полученными данными(3 столбца, нужные числа и тд) """ resize = QHeaderView.ResizeToContents """ Класс QHeaderView предоставляет строку заголовка или столбец заголовка для представлений элементов, заголовок маштабируется """ self.horizontal_header = self.table_view.horizontalHeader() self.vertical_header = self.table_view.verticalHeader() self.horizontal_header.setSectionResizeMode(resize) self.vertical_header.setSectionResizeMode(resize) self.horizontal_header.setStretchLastSection(True) """ Формируется данные для рисования заголовка """ """создание графика модуль QtChart предоставляет множество типов графиков и опций для графического представления данных. """ chart1 = QtCharts.QChart() """нас устраивает класс QChart полностью, доп методы и консрукторы не нужны """ chart1.setAnimationOptions(QtCharts.QChart.AllAnimations) """ установить параметры анимации, запускается рисование """ self.add_series("Значение", [0, 1], chart1) """подготовка вкладки на кот размещена диаграмма """ size = QSizePolicy(QSizePolicy.Preferred, QSizePolicy.Preferred) size.setHorizontalStretch(4) #----------------------------------------- chart_view1 = QtCharts.QChartView(chart1) """подготовка визуализации продолжается """ chart_view1.setRenderHint(QPainter.Antialiasing) #self.chart_view1.setSizePolicy(size) minWidth = 400 chart_view1.setMinimumWidth(minWidth) #----------------------------------------------------- chart2 = QtCharts.QChart() chart2.setAnimationOptions(QtCharts.QChart.AllAnimations) self.add_series("Глубина", [0, 2], chart2) #данные для каждого графика chart_view2 = QtCharts.QChartView(chart2) """подготовка визуализации продолжается """ chart_view2.setRenderHint(QPainter.Antialiasing) """ QWidget расположение """ """ правое расположение """ #self.chart_view2.setSizePolicy(size) chart_view2.setMinimumWidth(minWidth) main_layout = QHBoxLayout() splitter = QSplitter() dateColumn = 0 magColumn = 1 depthsColumn = 2 xDates = self.getDateAsCategoricalColumn(dateColumn) yMagnitudes = self.getFloatColumn(magColumn) yDepths = self.getFloatColumn(depthsColumn) # print("ymags") # print(yMagnitudes) # print("ydepths") # print(yDepths) bc1 = self.createBarCharts(xDates, yMagnitudes, yDepths) bar1ChartView = QtCharts.QChartView(bc1) bar1ChartView.setRenderHint(QPainter.Antialiasing) chartViewsHbox = QHBoxLayout() chartViewsHbox.addWidget(chart_view1) chartViewsHbox.addWidget(chart_view2) vbox = QVBoxLayout() vbox.addLayout(chartViewsHbox) vbox.addWidget(bar1ChartView) vboxWidget = QWidget() vboxWidget.setLayout(vbox) splitter.addWidget(vboxWidget) splitter.addWidget(self.table_view) main_layout.addWidget(splitter) # self.setLayout(main_layout) # установить макет на QWidget """ mainWidget = QWidget() mainWidget.setLayout(main_layout) tabWidget = QTabWidget() tabWidget.addTab(mainWidget, "travis scott") splineTab = ddv.charts.createSplineChart(splineChartData) tabWidget.addTab(splineTab, "spline chart") #areaTab = ddv.charts.createAreaChart(areaChartData) #tabWidget.addTab(areaTab, "area chart") scatterTab = ddv.charts.createScatterChart(scatterChartData) tabWidget.addTab(scatterTab, "scatter chart") pieTab = ddv.charts.createPieChart(pieChartData) tabWidget.addTab(pieTab, "pie chart") bwTab = ddv.charts.createBwChart(bwChartData) tabWidget.addTab(bwTab, "b w chart") candlestickTab = ddv.charts.createCandlestickChart( candlestickChartData) tabWidget.addTab(candlestickTab, "candlestick chart") grid = QGridLayout() grid.addWidget(tabWidget) #grid.addWidget(areaTab) self.setLayout(grid) """ левое расположение """ size.setHorizontalStretch(1) self.table_view.setSizePolicy(size)
def _init_widgets(self): layout = QGridLayout() self.main_layout.addLayout(layout) # filename filename_caption = QLabel(self) filename_caption.setText('File name:') filename = QLabel(self) filename.setText(self.filename) layout.addWidget(filename_caption, 0, 0, Qt.AlignRight) layout.addWidget(filename, 0, 1) # md5 if self.md5 is not None: md5_caption = QLabel(self) md5_caption.setText('MD5:') md5 = QLineEdit(self) md5.setText(self.md5) md5.setReadOnly(True) layout.addWidget(md5_caption, 1, 0, Qt.AlignRight) layout.addWidget(md5, 1, 1) # sha256 if self.sha256 is not None: sha256_caption = QLabel(self) sha256_caption.setText('SHA256:') sha256 = QLineEdit(self) sha256.setText(self.sha256) sha256.setReadOnly(True) layout.addWidget(sha256_caption, 2, 0, Qt.AlignRight) layout.addWidget(sha256, 2, 1) # central tab tab = QTabWidget() self._init_central_tab(tab) self.main_layout.addWidget(tab) # buttons ok_button = QPushButton(self) ok_button.setText('OK') ok_button.clicked.connect(self._on_ok_clicked) cancel_button = QPushButton(self) cancel_button.setText('Cancel') cancel_button.clicked.connect(self._on_cancel_clicked) buttons_layout = QHBoxLayout() buttons_layout.addWidget(ok_button) buttons_layout.addWidget(cancel_button) self.main_layout.addLayout(buttons_layout)
def __init__(self): super().__init__() self.setWindowTitle("Cobaya input generator for Cosmology") self.setStyleSheet("* {font-size:%s;}" % font_size) # Menu bar for defaults self.menubar = QMenuBar() defaults_menu = self.menubar.addMenu( '&Show defaults and bibliography for a component...') menu_actions = {} for kind in kinds: submenu = defaults_menu.addMenu(subfolders[kind]) components = get_available_internal_class_names(kind) menu_actions[kind] = {} for component in components: menu_actions[kind][component] = QAction(component, self) menu_actions[kind][component].setData((kind, component)) menu_actions[kind][component].triggered.connect( self.show_defaults) submenu.addAction(menu_actions[kind][component]) # Main layout self.menu_layout = QVBoxLayout() self.menu_layout.addWidget(self.menubar) self.setLayout(self.menu_layout) self.layout = QHBoxLayout() self.menu_layout.addLayout(self.layout) self.layout_left = QVBoxLayout() self.layout.addLayout(self.layout_left) self.layout_output = QVBoxLayout() self.layout.addLayout(self.layout_output) # LEFT: Options self.options = QWidget() self.layout_options = QVBoxLayout() self.options.setLayout(self.layout_options) self.options_scroll = QScrollArea() self.options_scroll.setWidget(self.options) self.options_scroll.setWidgetResizable(True) self.layout_left.addWidget(self.options_scroll) self.combos = dict() for group, fields in _combo_dict_text: group_box = QGroupBox(group) self.layout_options.addWidget(group_box) group_layout = QVBoxLayout(group_box) for a, desc in fields: self.combos[a] = QComboBox() # Combo box label only if not single element in group if len(fields) > 1: label = QLabel(desc) group_layout.addWidget(label) group_layout.addWidget(self.combos[a]) self.combos[a].addItems([ text(k, v) for k, v in getattr(input_database, a).items() ]) # PLANCK NAMES CHECKBOX TEMPORARILY DISABLED # if a == "theory": # # Add Planck-naming checkbox # self.planck_names = QCheckBox( # "Keep common parameter names " # "(useful for fast CLASS/CAMB switching)") # group_layout.addWidget(self.planck_names) # Connect to refreshers -- needs to be after adding all elements for field, combo in self.combos.items(): if field == "preset": combo.currentIndexChanged.connect(self.refresh_preset) else: combo.currentIndexChanged.connect(self.refresh) # self.planck_names.stateChanged.connect(self.refresh_keep_preset) # RIGHT: Output + buttons self.display_tabs = QTabWidget() self.display = {} for k in ["yaml", "python", "bibliography"]: self.display[k] = QTextEdit() self.display[k].setLineWrapMode(QTextEdit.NoWrap) self.display[k].setFontFamily("mono") self.display[k].setCursorWidth(0) self.display[k].setReadOnly(True) self.display_tabs.addTab(self.display[k], k) self.display["covmat"] = QWidget() covmat_tab_layout = QVBoxLayout() self.display["covmat"].setLayout(covmat_tab_layout) self.covmat_text = QLabel() self.covmat_text.setWordWrap(True) self.covmat_table = QTableWidget(0, 0) self.covmat_table.setEditTriggers( QAbstractItemView.NoEditTriggers) # ReadOnly! covmat_tab_layout.addWidget(self.covmat_text) covmat_tab_layout.addWidget(self.covmat_table) self.display_tabs.addTab(self.display["covmat"], "covariance matrix") self.layout_output.addWidget(self.display_tabs) # Buttons self.buttons = QHBoxLayout() self.save_button = QPushButton('Save as...', self) self.copy_button = QPushButton('Copy to clipboard', self) self.buttons.addWidget(self.save_button) self.buttons.addWidget(self.copy_button) self.save_button.released.connect(self.save_file) self.copy_button.released.connect(self.copy_clipb) self.layout_output.addLayout(self.buttons) self.save_dialog = QFileDialog() self.save_dialog.setFileMode(QFileDialog.AnyFile) self.save_dialog.setAcceptMode(QFileDialog.AcceptSave) self.read_settings() self.show()
def __init__(self): super().__init__() # tag::tabWidget[] self.tabs = QTabWidget() self.tabs.setDocumentMode(True) self.tabs.tabBarDoubleClicked.connect(self.tab_open_doubleclick) self.tabs.currentChanged.connect(self.current_tab_changed) self.tabs.setTabsClosable(True) self.tabs.tabCloseRequested.connect(self.close_current_tab) self.setCentralWidget(self.tabs) # end::tabWidget[] navtb = QToolBar("Navigation") navtb.setIconSize(QSize(16, 16)) self.addToolBar(navtb) back_btn = QAction(QIcon(os.path.join("icons", "arrow-180.png")), "Back", self) back_btn.setStatusTip("Back to previous page") back_btn.triggered.connect(lambda: self.tabs.currentWidget().back()) navtb.addAction(back_btn) next_btn = QAction(QIcon(os.path.join("icons", "arrow-000.png")), "Forward", self) next_btn.setStatusTip("Forward to next page") next_btn.triggered.connect(lambda: self.tabs.currentWidget().forward()) navtb.addAction(next_btn) reload_btn = QAction( QIcon(os.path.join("icons", "arrow-circle-315.png")), "Reload", self) reload_btn.setStatusTip("Reload page") reload_btn.triggered.connect( lambda: self.tabs.currentWidget().reload()) navtb.addAction(reload_btn) home_btn = QAction(QIcon(os.path.join("icons", "home.png")), "Home", self) home_btn.setStatusTip("Go home") home_btn.triggered.connect(self.navigate_home) navtb.addAction(home_btn) navtb.addSeparator() self.httpsicon = QLabel() # Yes, really! self.httpsicon.setPixmap( QPixmap(os.path.join("icons", "lock-nossl.png"))) navtb.addWidget(self.httpsicon) self.urlbar = QLineEdit() self.urlbar.returnPressed.connect(self.navigate_to_url) navtb.addWidget(self.urlbar) stop_btn = QAction(QIcon(os.path.join("icons", "cross-circle.png")), "Stop", self) stop_btn.setStatusTip("Stop loading current page") stop_btn.triggered.connect(lambda: self.tabs.currentWidget().stop()) navtb.addAction(stop_btn) self.menuBar().setNativeMenuBar(False) self.statusBar() file_menu = self.menuBar().addMenu("&File") new_tab_action = QAction( QIcon(os.path.join("icons", "ui-tab--plus.png")), "New Tab", self) new_tab_action.setStatusTip("Open a new tab") new_tab_action.triggered.connect(lambda _: self.add_new_tab()) file_menu.addAction(new_tab_action) open_file_action = QAction( QIcon(os.path.join("icons", "disk--arrow.png")), "Open file...", self) open_file_action.setStatusTip("Open from file") open_file_action.triggered.connect(self.open_file) file_menu.addAction(open_file_action) save_file_action = QAction( QIcon(os.path.join("icons", "disk--pencil.png")), "Save Page As...", self) save_file_action.setStatusTip("Save current page to file") save_file_action.triggered.connect(self.save_file) file_menu.addAction(save_file_action) print_action = QAction(QIcon(os.path.join("icons", "printer.png")), "Print...", self) print_action.setStatusTip("Print current page") print_action.triggered.connect(self.print_page) file_menu.addAction(print_action) # Create our system printer instance. self.printer = QPrinter() help_menu = self.menuBar().addMenu("&Help") about_action = QAction( QIcon(os.path.join("icons", "question.png")), "About Mozzarella Ashbadger", self, ) about_action.setStatusTip( "Find out more about Mozzarella Ashbadger") # Hungry! about_action.triggered.connect(self.about) help_menu.addAction(about_action) navigate_mozarella_action = QAction( QIcon(os.path.join("icons", "lifebuoy.png")), "Mozzarella Ashbadger Homepage", self, ) navigate_mozarella_action.setStatusTip( "Go to Mozzarella Ashbadger Homepage") navigate_mozarella_action.triggered.connect(self.navigate_mozarella) help_menu.addAction(navigate_mozarella_action) self.add_new_tab(QUrl("http://www.google.com"), "Homepage") self.show() self.setWindowTitle("Mozzarella Ashbadger") self.setWindowIcon(QIcon(os.path.join("icons", "ma-icon-64.png")))
def __set_interface(self): self.button_width = 0.35 self.button_height = 0.05 self.setWindowTitle("GSI-RADS") self.__getScreenDimensions() self.setGeometry(self.left, self.top, self.width, self.height) self.setMaximumWidth(self.width) #self.setMaximumHeight(self.height) self.setMinimumWidth(self.width) self.setMinimumHeight(self.height) self.move(self.width / 2, self.height / 2) self.menu_bar = QMenuBar(self) self.menu_bar.setNativeMenuBar( False ) # https://stackoverflow.com/questions/25261760/menubar-not-showing-for-simple-qmainwindow-code-qt-creator-mac-os self.file_menu = self.menu_bar.addMenu('File') self.import_dicom_action = QAction( QIcon( os.path.join(os.path.dirname(os.path.realpath(__file__)), 'images/database-icon.png')), 'Import DICOM', self) self.import_dicom_action.setShortcut('Ctrl+D') self.file_menu.addAction(self.import_dicom_action) self.quit_action = QAction('Quit', self) self.quit_action.setShortcut("Ctrl+Q") self.file_menu.addAction(self.quit_action) self.settings_menu = self.menu_bar.addMenu('Settings') self.settings_seg_menu = self.settings_menu.addMenu("Segmentation...") self.settings_seg_preproc_menu = self.settings_seg_menu.addMenu( "Preprocessing...") self.settings_seg_preproc_menu_p1_action = QAction( "Brain-masking off (P1)", checkable=True) self.settings_seg_preproc_menu_p2_action = QAction( "Brain-masking on (P2)", checkable=True) self.settings_seg_preproc_menu_p2_action.setChecked(True) self.settings_seg_preproc_menu.addAction( self.settings_seg_preproc_menu_p1_action) self.settings_seg_preproc_menu.addAction( self.settings_seg_preproc_menu_p2_action) self.help_menu = self.menu_bar.addMenu('Help') self.readme_action = QAction( QIcon( os.path.join(os.path.dirname(os.path.realpath(__file__)), 'images/readme-icon.jpeg')), 'Tutorial', self) self.readme_action.setShortcut("Ctrl+R") self.help_menu.addAction(self.readme_action) self.about_action = QAction( QIcon( os.path.join(os.path.dirname(os.path.realpath(__file__)), 'images/about-icon.png')), 'About', self) self.about_action.setShortcut("Ctrl+A") self.help_menu.addAction(self.about_action) self.help_action = QAction( QIcon.fromTheme("help-faq"), "Help", self ) # Default icons can be found here: https://specifications.freedesktop.org/icon-naming-spec/icon-naming-spec-latest.html#guidelines self.help_action.setShortcut("Ctrl+J") self.help_menu.addAction(self.help_action) self.input_image_lineedit = QLineEdit() self.input_image_lineedit.setFixedWidth(self.width * (0.93 - self.button_width / 2)) self.input_image_lineedit.setFixedHeight(self.height * self.button_height) self.input_image_lineedit.setReadOnly(True) self.input_image_pushbutton = QPushButton('Input MRI') self.input_image_pushbutton.setFixedWidth(self.height * self.button_width) self.input_image_pushbutton.setFixedHeight(self.height * self.button_height) self.input_segmentation_lineedit = QLineEdit() self.input_segmentation_lineedit.setReadOnly(True) self.input_segmentation_lineedit.setFixedWidth( self.width * (0.93 - self.button_width / 2)) self.input_segmentation_lineedit.setFixedHeight(self.height * self.button_height) self.input_segmentation_pushbutton = QPushButton('Input segmentation') self.input_segmentation_pushbutton.setFixedWidth(self.height * self.button_width) self.input_segmentation_pushbutton.setFixedHeight(self.height * self.button_height) self.output_folder_lineedit = QLineEdit() self.output_folder_lineedit.setReadOnly(True) self.output_folder_lineedit.setFixedWidth( self.width * (0.93 - self.button_width / 2)) self.output_folder_lineedit.setFixedHeight(self.height * self.button_height) self.output_folder_pushbutton = QPushButton('Output destination') self.output_folder_pushbutton.setFixedWidth(self.height * self.button_width) self.output_folder_pushbutton.setFixedHeight(self.height * self.button_height) self.run_button = QPushButton('Run diagnosis') self.run_button.setFixedWidth(self.height * self.button_width) self.run_button.setFixedHeight(self.height * self.button_height) self.main_display_tabwidget = QTabWidget() self.tutorial_textedit = QPlainTextEdit() self.tutorial_textedit.setReadOnly(True) self.tutorial_textedit.setFixedWidth(self.width * 0.97) self.tutorial_textedit.setPlainText( "HOW TO USE THE SOFTWARE: \n" " 1) Click 'Input MRI...' to select from your file explorer the MRI scan to process (unique file).\n" " 1*) Alternatively, Click File > Import DICOM... if you wish to process an MRI scan as a DICOM sequence.\n" " 2) Click 'Output destination' to choose a directory where to save the results \n" " 3) (OPTIONAL) Click 'Input segmentation' to choose a tumor segmentation mask file, if nothing is provided the internal model with generate the segmentation automatically \n" " 4) Click 'Run diagnosis' to perform the analysis. The human-readable version will be displayed in the interface.\n" " \n" "NOTE: \n" "The output folder is populated automatically with the following: \n" " * The diagnosis results in human-readable text (report.txt) and Excel-ready format (report.csv).\n" " * The automatic segmentation masks of the brain and the tumor in the original patient space (input_brain_mask.nii.gz and input_tumor_mask.nii.gz).\n" " * The input volume and tumor segmentation mask in MNI space in the sub-directory named \'registration\'.\n" ) self.main_display_tabwidget.addTab(self.tutorial_textedit, 'Tutorial') self.prompt_lineedit = QPlainTextEdit() self.prompt_lineedit.setReadOnly(True) self.prompt_lineedit.setFixedWidth(self.width * 0.97) self.main_display_tabwidget.addTab(self.prompt_lineedit, 'Logging') self.results_textedit = QPlainTextEdit() self.results_textedit.setReadOnly(True) self.results_textedit.setFixedWidth(self.width * 0.97) self.main_display_tabwidget.addTab(self.results_textedit, 'Results') self.sintef_logo_label = QLabel() self.sintef_logo_label.setPixmap( QPixmap( os.path.join(os.path.dirname(os.path.realpath(__file__)), 'images/sintef-logo.png'))) self.sintef_logo_label.setFixedWidth(0.95 * (self.width / 3)) self.sintef_logo_label.setFixedHeight( 1 * (self.height * self.button_height)) self.sintef_logo_label.setScaledContents(True) self.stolavs_logo_label = QLabel() self.stolavs_logo_label.setPixmap( QPixmap( os.path.join(os.path.dirname(os.path.realpath(__file__)), 'images/stolavs-logo.png'))) self.stolavs_logo_label.setFixedWidth(0.95 * (self.width / 3)) self.stolavs_logo_label.setFixedHeight( 1 * (self.height * self.button_height)) self.stolavs_logo_label.setScaledContents(True) self.amsterdam_logo_label = QLabel() self.amsterdam_logo_label.setPixmap( QPixmap( os.path.join(os.path.dirname(os.path.realpath(__file__)), 'images/amsterdam-logo.png'))) self.amsterdam_logo_label.setFixedWidth(0.95 * (self.width / 3)) self.amsterdam_logo_label.setFixedHeight( 1 * (self.height * self.button_height)) self.amsterdam_logo_label.setScaledContents(True)
def setupUi(self, parent): """Setup the interfaces for the clock.""" if not self.objectName(): self.setObjectName(u"Clock") sizePolicy = QSizePolicy(QSizePolicy.Fixed, QSizePolicy.Fixed) sizePolicy.setHorizontalStretch(0) sizePolicy.setVerticalStretch(0) sizePolicy.setHeightForWidth(parent.sizePolicy().hasHeightForWidth()) parent.setSizePolicy(sizePolicy) parent.setAutoFillBackground(True) parent.setWindowFlag(Qt.Widget, True) if os.uname().sysname == "Linux" or self.frameless: parent.setWindowFlag(Qt.FramelessWindowHint, True) self.tabWidget = QTabWidget(parent) self.tabWidget.setObjectName(u"tabWidget") self.tabWidget.setGeometry(QRect(0, 0, 800, 460)) # This works for Mac, but seems to not work with Linux/Arm/RPi # tabbar = self.tabWidget.tabBar() # tabbar.setMinimumSize(50, 24) # tabfont = QFont() # tabfont.setBold(True) # tabfont.setItalic(True) # tabfont.setPointSize(32) # tabbar.setFont(tabfont) # Setup the TABS self.clock = QWidget() self.clock.setObjectName(u"clock") self.tabWidget.addTab(self.clock, "") self.tabWidget.setTabText(self.tabWidget.indexOf(self.clock), "Clock") self.weather = QWeather(parent=None, debug=self.debug) self.tabWidget.addTab(self.weather, "") self.tabWidget.setTabText(self.tabWidget.indexOf(self.weather), "Weather") self.settings = QWidget() self.settings.setObjectName(u"settings") self.tabWidget.addTab(self.settings, "") self.tabWidget.setTabText(self.tabWidget.indexOf(self.settings), "Settings") self.tabWidget.setCurrentIndex(0) ################################################################################################# # Setup Clock Page ################################################################################################# self.analog = AnalogClock(self.clock) # DIGITAL clock in "clock" tab self.Digital = QLabel(self.clock) self.Digital.setObjectName(u"Digital") self.Digital.setGeometry(QRect(0, 5, 765, 71)) self.Digital.setAutoFillBackground(False) self.Digital.setStyleSheet(u"") self.Digital.setText(u"Current Time - Date + time") # Weather Icon self.weathericon = QWeatherIcon((480, 5), self.weather, parent=self.clock) self.weather.weather_updated.connect(self.weathericon.update) # Weather info on the Clock page. self.minipanel = QTempMiniPanel((475, 105), self.weather, parent=self.clock) self.weather.temp_updated.connect(self.minipanel.update) self.hilo = QHiLoTide((580, 5), parent=self.clock, debug=self.debug) # Moon phase self.moon = QMoon(pos=(450, 210), parent=self.clock, size=216, web=self.web) # Push buttons in "clock tab. push_button_width = 111 push_button_height = 40 push_button_x = 670 push_button_y = 220 self.ledball_off = QPushButton(self.clock) self.ledball_off.setObjectName(u"ledball_off") self.ledball_off.setText(u"LED off") self.ledball_off.setGeometry(QRect(push_button_x, push_button_y, push_button_width, push_button_height)) self.ledball_on = QPushButton(self.clock) self.ledball_on.setObjectName(u"ledball_on") self.ledball_on.setText(u"LED on ") self.ledball_on.setGeometry(QRect(push_button_x, push_button_y+push_button_height, push_button_width, push_button_height)) self.ledball_on2 = QPushButton(self.clock) self.ledball_on2.setObjectName(u"ledball_on2") self.ledball_on2.setText(u"LED on 2") self.ledball_on2.setGeometry(QRect(push_button_x, push_button_y+push_button_height*2, push_button_width, push_button_height)) self.sleep = QPushButton(self.clock) self.sleep.setObjectName(u"sleep") self.sleep.setText(u"Sleep") self.sleep.setGeometry(QRect(push_button_x, push_button_y+push_button_height*3+10, push_button_width, push_button_height)) ################################################################################################# # Setup Weather Page ################################################################################################# ################################################################################################# # Setup Setting Page ################################################################################################# self.timeEdit = QTimeEdit(self.settings) self.timeEdit.setObjectName(u"timeEdit") self.timeEdit.setDisplayFormat(u"h:mm AP") self.timeEdit.setGeometry(QRect(200, 30, 191, 41)) font8 = QFont() font8.setFamily(u"Gill Sans") font8.setPointSize(16) font8.setBold(False) font8.setItalic(False) font8.setWeight(50) self.timeEdit.setFont(font8) self.timeEdit.setAutoFillBackground(True) self.timeEdit.setTime(self.bedtime) self.bedtime_label = QLabel(self.settings) self.bedtime_label.setObjectName(u"bedtime_label") self.bedtime_label.setText(u"Set Bedtime:") self.bedtime_label.setGeometry(QRect(200, 0, 151, 31)) self.bedtime_label.setFont(font8) self.bedtime_label.setAutoFillBackground(True) self.Brightness_Value = QLCDNumber(self.settings) self.Brightness_Value.setObjectName(u"Brightness_Value") self.Brightness_Value.setGeometry(QRect(20, 120, 61, 31)) self.Brightness_Value.setStyleSheet(u"color: \"White\";\n" "margin:0px;\n" "border:0px;background:\"transparent\";") self.Brightness_Value.setDigitCount(3) self.Brightness_Value.setProperty("value", 180.000000000000000) self.Brightness = QSlider(self.settings) self.Brightness.setObjectName(u"Brightness") self.Brightness.setGeometry(QRect(30, 160, 51, 261)) self.Brightness.setAutoFillBackground(False) self.Brightness.setMaximum(255) self.Brightness.setValue(self.LCD_brightness) self.Brightness.setOrientation(Qt.Vertical) self.Brightness_label = QLabel(self.settings) self.Brightness_label.setObjectName(u"Brightness_label") self.Brightness_label.setText(u"Brightness") self.Brightness_label.setGeometry(QRect(20, 70, 101, 41)) font10 = QFont() font10.setFamily(u"Arial Black") font10.setPointSize(12) font10.setBold(True) font10.setWeight(75) self.Brightness_label.setFont(font10) self.temp_test = QLabel(self.settings) self.temp_test.setObjectName(u"temp_test") self.temp_test.setText(u"T20.5 C") self.temp_test.setFont(font8) self.temp_test.setGeometry(QRect(630, 60, 141, 51)) # self.temp_test.setFont(font_bold_20) self.temp_test_slide = QSlider(self.settings) self.temp_test_slide.setObjectName(u"temp_test_slide") self.temp_test_slide.setGeometry(QRect(660, 150, 51, 271)) self.temp_test_slide.setAutoFillBackground(False) self.temp_test_slide.setMinimum(-250) self.temp_test_slide.setMaximum(450) self.temp_test_slide.setSingleStep(5) self.temp_test_slide.setPageStep(25) self.temp_test_slide.setValue(38) self.temp_test_slide.setOrientation(Qt.Vertical) self.temp_check_outside = QCheckBox(self.settings) self.temp_check_outside.setObjectName(u"temp_check_outside") self.temp_check_outside.setText(u"Outside") self.temp_check_outside.setGeometry(QRect(640, 110, 86, 20)) self.grace_period = QSpinBox(self.settings) self.grace_period.setObjectName(u"grace_period") self.grace_period.setGeometry(QRect(411, 31, 111, 41)) self.grace_period.setFont(font8) self.grace_period.setMinimum(1) self.grace_period.setMaximum(60) self.grace_period.setValue(self.bedtime_grace_period) self.grace_period.setDisplayIntegerBase(10) self.grace_period_label = QLabel(self.settings) self.grace_period_label.setObjectName(u"grace_period_label") self.grace_period_label.setText(u"Grace period:") self.grace_period_label.setGeometry(QRect(410, 10, 111, 16)) self.grace_period_label.setFont(font8) ################################################################################################# # SET ALL LABEL TEXTS ################################################################################################# # if QT_CONFIG(tooltip) self.sleep.setToolTip(u"Put display to sleep") self.ledball_on2.setToolTip(u"Turn on the LED Ball, mode 2") self.ledball_on.setToolTip(u"Turn on the LED Ball.") self.ledball_off.setToolTip(u"Turn off the LED Ball.") # endif // QT_CONFIG(tooltip) ################################################################################################# # Make the Connections. ################################################################################################# self.temp_test_slide.valueChanged.connect(self.test_temp_update) self.temp_check_outside.clicked.connect(self.test_temp_update) self.ledball_off.clicked.connect(self.set_ledball_off) self.ledball_on.clicked.connect(self.set_ledball_on) self.ledball_on2.clicked.connect(self.set_ledball_on2) self.sleep.clicked.connect(self.set_sleep) self.timeEdit.timeChanged.connect(self.set_bedtime) self.grace_period.valueChanged.connect(self.set_grace_period) self.Brightness.valueChanged.connect(self.set_screen_brightness) self.Brightness.valueChanged.connect(self.Brightness_Value.display)
def __init__(self): super(SidePanel, self).__init__() # Internal variables self._coverdir = path.join("data", "images", "covers") self._id = 0 self._imagedata = "" size = [220, 16] # Width, Height (for QLineEdits/QTextEdits) # QDockWidget settings self.setAllowedAreas(Qt.RightDockWidgetArea) self.setFeatures(QDockWidget.DockWidgetClosable) self.setFixedWidth(350) self.setVisible(False) # Fonts bold = QFont() bold.setBold(True) boldUnderline = QFont() boldUnderline.setBold(True) boldUnderline.setUnderline(True) # Horizontal line hline = QFrame() hline.setFrameShape(QFrame.HLine) hline.setFrameShadow(QFrame.Sunken) """Widgets""" # Cover self.cover = QLabel() self.cover.setAlignment(Qt.AlignCenter) self.cover.setMinimumHeight(200) self.cover.setMaximumSize(self.width(), 250) # Buttons self.fetchInfoButton = QPushButton("Fetch missing info") self.fetchInfoButton.setToolTip("Try to fetch info from MobyGames") self.fetchInfoButton.clicked.connect(self._fetchInfo) self.editDetailsButton = QPushButton("Edit") self.editDetailsButton.setCheckable(True) self.editDetailsButton.clicked.connect(self._editDetails) self.saveDetailsButton = QPushButton("Save") self.saveDetailsButton.clicked.connect(self._saveInfo) self.fetchPriceButton = QPushButton("Update price data") self.fetchPriceButton.setToolTip("Try to update price data from Pricecharting") self.fetchPriceButton.clicked.connect(self._fetchPriceData) self.savePriceButton = QPushButton("Save") self.savePriceButton.clicked.connect(self._saveInfo) # Info layout widgets self.nameInfoLabel = QLabel("Name:") self.nameInfoLabel.setFont(bold) self.nameDataLabel = QLabel() self.nameDataLabel.setWordWrap(True) self.platformInfoLabel = QLabel("Platform:") self.platformInfoLabel.setFont(bold) self.platformDataLabel = QLabel() self.publisherInfoLabel = QLabel("Publisher:") self.publisherInfoLabel.setFont(bold) self.publisherDataLabel = QLabel() self.developerInfoLabel = QLabel("Developer:") self.developerInfoLabel.setFont(bold) self.developerDataLabel = QLabel() self.regionInfoLabel = QLabel("Region:") self.regionInfoLabel.setFont(bold) self.regionDataLabel = QLabel() self.codeInfoLabel = QLabel("Code:") self.codeInfoLabel.setFont(bold) self.codeDataLabel = QLabel() self.codeDataLabel.setWordWrap(True) self.itemInfoLabel = QLabel("Game:") self.itemInfoLabel.setFont(bold) self.itemDataLabel = QLabel() self.boxInfoLabel = QLabel("Box:") self.boxInfoLabel.setFont(bold) self.boxDataLabel = QLabel() self.manualInfoLabel = QLabel("Manual:") self.manualInfoLabel.setFont(bold) self.manualDataLabel = QLabel() self.genreInfoLabel = QLabel("Genre:") self.genreInfoLabel.setFont(bold) self.genreDataLabel = QLabel() self.yearInfoLabel = QLabel("Year:") self.yearInfoLabel.setFont(bold) self.yearDataLabel = QLabel() self.commentInfoLabel = QLabel("Comment:") self.commentInfoLabel.setFont(bold) self.commentDataLabel = QLabel() self.commentDataLabel.setWordWrap(True) self.platformsInfoLabel = QLabel("Available for:") self.platformsInfoLabel.setFont(bold) self.platformsDataLabel = QLabel() self.platformsDataLabel.setWordWrap(True) self.platformsDataLabel.setMaximumHeight(50) # Can get quite large otherwise # Edit layout widgets self.nameEditLabel = QLabel("Name:") self.nameEditLabel.setFont(bold) self.nameDataTE = QTextEdit() self.nameDataTE.setMaximumSize(size[0], size[1] * 2) self.platformEditLabel = QLabel("Platform:") self.platformEditLabel.setFont(bold) self.platformDataLE = QLineEdit() self.platformDataLE.setMaximumSize(size[0], size[1]) self.publisherEditLabel = QLabel("Publisher:") self.publisherEditLabel.setFont(bold) self.publisherDataLE = QLineEdit() self.publisherDataLE.setMaximumSize(size[0], size[1]) self.developerEditLabel = QLabel("Developer:") self.developerEditLabel.setFont(bold) self.developerDataLE = QLineEdit() self.developerDataLE.setMaximumSize(size[0], size[1]) self.regionEditLabel = QLabel("Region:") self.regionEditLabel.setFont(bold) self.regionDataCoB = QComboBox() self.regionDataCoB.addItems(("NTSC (JP)", "NTSC (NA)", "PAL")) self.regionDataCoB.setMinimumWidth(size[0]) # If not set it will be too small self.regionDataCoB.setMaximumSize(size[0], size[1]) self.codeEditLabel = QLabel("Code:") self.codeEditLabel.setFont(bold) self.codeDataLE = QLineEdit() self.codeDataLE.setMaximumSize(size[0], size[1]) self.itemEditLabel = QLabel("Game:") self.itemEditLabel.setFont(bold) self.itemDataCB = QCheckBox() self.itemDataCB.setChecked(False) self.boxEditLabel = QLabel("Box:") self.boxEditLabel.setFont(bold) self.boxDataCB = QCheckBox() self.boxDataCB.setChecked(False) self.manualEditLabel = QLabel("Manual:") self.manualEditLabel.setFont(bold) self.manualDataCB = QCheckBox() self.manualDataCB.setChecked(False) self.genreEditLabel = QLabel("Genre:") self.genreEditLabel.setFont(bold) self.genreDataLE = QLineEdit() self.genreDataLE.setMaximumSize(size[0], size[1]) self.yearEditLabel = QLabel("Year:") self.yearEditLabel.setFont(bold) self.yearDataLE = QLineEdit() self.yearDataLE.setMaximumSize(size[0], size[1]) self.commentEditLabel = QLabel("Comment:") self.commentEditLabel.setFont(bold) self.commentDataTE = QTextEdit() self.commentDataTE.setMaximumSize(size[0], size[1] * 2) self.platformsEditLabel = QLabel("Available for:") self.platformsEditLabel.setFont(bold) self.platformsDataTE = QTextEdit() self.platformsDataTE.setMaximumSize(size[0], size[1] * 2) # Price widgets self.paidPriceLabel = QLabel("Paid:") self.paidPriceLabel.setFont(bold) self.paidPriceDataLE = QLineEdit() self.paidPriceDataLE.setMaximumSize(60, size[1]) self.paidPriceDataLE.setAlignment(Qt.AlignRight) self.loosePriceLabel = QLabel("Loose:") self.loosePriceLabel.setFont(bold) self.loosePriceDataLabel = QLabel() self.loosePriceDataLabel.setAlignment(Qt.AlignRight) self.cibPriceLabel = QLabel("CIB:") self.cibPriceLabel.setFont(bold) self.cibPriceDataLabel = QLabel() self.cibPriceDataLabel.setAlignment(Qt.AlignRight) self.newPriceLabel = QLabel("New:") self.newPriceLabel.setFont(bold) self.newPriceDataLabel = QLabel() self.newPriceDataLabel.setAlignment(Qt.AlignRight) """Layouts""" # Cover self.coverVbox = QVBoxLayout() self.coverVbox.addWidget(self.cover, 1) self.coverVbox.addWidget(hline, 0) # Buttons self.detailsButtonHbox = QHBoxLayout() self.detailsButtonHbox.addWidget(self.fetchInfoButton, 0) self.detailsButtonHbox.addWidget(self.editDetailsButton, 0) self.detailsButtonHbox.addWidget(self.saveDetailsButton, 0) self.priceButtonHbox = QHBoxLayout() self.priceButtonHbox.addWidget(self.fetchPriceButton, 0) self.priceButtonHbox.addWidget(self.savePriceButton, 0) # Info layouts self.nameInfoHbox = QHBoxLayout() self.nameInfoHbox.addWidget(self.nameInfoLabel, 0) self.nameInfoHbox.addWidget(self.nameDataLabel, 0) self.platformInfoHbox = QHBoxLayout() self.platformInfoHbox.addWidget(self.platformInfoLabel, 0) self.platformInfoHbox.addWidget(self.platformDataLabel, 0) self.publisherInfoHbox = QHBoxLayout() self.publisherInfoHbox.addWidget(self.publisherInfoLabel, 0) self.publisherInfoHbox.addWidget(self.publisherDataLabel, 0) self.developerInfoHbox = QHBoxLayout() self.developerInfoHbox.addWidget(self.developerInfoLabel, 0) self.developerInfoHbox.addWidget(self.developerDataLabel, 0) self.regionInfoHbox = QHBoxLayout() self.regionInfoHbox.addWidget(self.regionInfoLabel, 0) self.regionInfoHbox.addWidget(self.regionDataLabel, 0) self.codeInfoHbox = QHBoxLayout() self.codeInfoHbox.addWidget(self.codeInfoLabel, 0) self.codeInfoHbox.addWidget(self.codeDataLabel, 0) self.itemInfoHbox = QHBoxLayout() self.itemInfoHbox.addWidget(self.itemInfoLabel, 0) self.itemInfoHbox.addWidget(self.itemDataLabel, 0) self.boxInfoHbox = QHBoxLayout() self.boxInfoHbox.addWidget(self.boxInfoLabel, 0) self.boxInfoHbox.addWidget(self.boxDataLabel, 0) self.manualInfoHbox = QHBoxLayout() self.manualInfoHbox.addWidget(self.manualInfoLabel, 0) self.manualInfoHbox.addWidget(self.manualDataLabel, 0) self.genreInfoHbox = QHBoxLayout() self.genreInfoHbox.addWidget(self.genreInfoLabel, 0) self.genreInfoHbox.addWidget(self.genreDataLabel, 0) self.yearInfoHbox = QHBoxLayout() self.yearInfoHbox.addWidget(self.yearInfoLabel, 0) self.yearInfoHbox.addWidget(self.yearDataLabel, 0) self.commentInfoHbox = QHBoxLayout() self.commentInfoHbox.addWidget(self.commentInfoLabel, 0) self.commentInfoHbox.addWidget(self.commentDataLabel, 0) self.platformsInfoHbox = QHBoxLayout() self.platformsInfoHbox.addWidget(self.platformsInfoLabel, 0) self.platformsInfoHbox.addWidget(self.platformsDataLabel, 0) # Edit layouts self.nameEditHbox = QHBoxLayout() self.nameEditHbox.addWidget(self.nameEditLabel, 0) self.nameEditHbox.addWidget(self.nameDataTE, 0) self.platformEditHbox = QHBoxLayout() self.platformEditHbox.addWidget(self.platformEditLabel, 0) self.platformEditHbox.addWidget(self.platformDataLE, 0) self.publisherEditHbox = QHBoxLayout() self.publisherEditHbox.addWidget(self.publisherEditLabel, 0) self.publisherEditHbox.addWidget(self.publisherDataLE, 0) self.developerEditHbox = QHBoxLayout() self.developerEditHbox.addWidget(self.developerEditLabel, 0) self.developerEditHbox.addWidget(self.developerDataLE, 0) self.regionEditHbox = QHBoxLayout() self.regionEditHbox.addWidget(self.regionEditLabel, 0) self.regionEditHbox.addWidget(self.regionDataCoB, 0) self.codeEditHbox = QHBoxLayout() self.codeEditHbox.addWidget(self.codeEditLabel, 0) self.codeEditHbox.addWidget(self.codeDataLE, 0) self.itemEditHbox = QHBoxLayout() self.itemEditHbox.addWidget(self.itemEditLabel, 0) self.itemEditHbox.addWidget(self.itemDataCB, 0) self.itemEditHbox.addSpacing(135) self.boxEditHbox = QHBoxLayout() self.boxEditHbox.addWidget(self.boxEditLabel, 0) self.boxEditHbox.addWidget(self.boxDataCB, 0) self.boxEditHbox.addSpacing(135) self.manualEditHbox = QHBoxLayout() self.manualEditHbox.addWidget(self.manualEditLabel, 0) self.manualEditHbox.addWidget(self.manualDataCB, 0) self.manualEditHbox.addSpacing(135) self.genreEditHbox = QHBoxLayout() self.genreEditHbox.addWidget(self.genreEditLabel, 0) self.genreEditHbox.addWidget(self.genreDataLE, 0) self.yearEditHbox = QHBoxLayout() self.yearEditHbox.addWidget(self.yearEditLabel, 0) self.yearEditHbox.addWidget(self.yearDataLE, 0) self.commentEditHbox = QHBoxLayout() self.commentEditHbox.addWidget(self.commentEditLabel, 0) self.commentEditHbox.addWidget(self.commentDataTE, 0) self.platformsEditHbox = QHBoxLayout() self.platformsEditHbox.addWidget(self.platformsEditLabel, 0) self.platformsEditHbox.addWidget(self.platformsDataTE, 0) # Price layouts self.paidPriceHbox = QHBoxLayout() self.paidPriceHbox.addWidget(self.paidPriceLabel, 0) self.paidPriceHbox.addWidget(self.paidPriceDataLE, 0) self.loosePriceHbox = QHBoxLayout() self.loosePriceHbox.addWidget(self.loosePriceLabel, 0) self.loosePriceHbox.addWidget(self.loosePriceDataLabel, 0) self.cibPriceHbox = QHBoxLayout() self.cibPriceHbox.addWidget(self.cibPriceLabel, 0) self.cibPriceHbox.addWidget(self.cibPriceDataLabel, 0) self.newPriceHbox = QHBoxLayout() self.newPriceHbox.addWidget(self.newPriceLabel, 0) self.newPriceHbox.addWidget(self.newPriceDataLabel, 0) # Info layout self.infoLayout = QVBoxLayout() self.infoLayout.addLayout(self.nameInfoHbox, 0) self.infoLayout.addLayout(self.platformInfoHbox, 0) self.infoLayout.addLayout(self.publisherInfoHbox, 0) self.infoLayout.addLayout(self.developerInfoHbox, 0) self.infoLayout.addLayout(self.genreInfoHbox, 0) self.infoLayout.addLayout(self.regionInfoHbox, 0) self.infoLayout.addLayout(self.yearInfoHbox, 0) self.infoLayout.addLayout(self.codeInfoHbox, 0) self.infoLayout.addLayout(self.itemInfoHbox, 0) self.infoLayout.addLayout(self.boxInfoHbox, 0) self.infoLayout.addLayout(self.manualInfoHbox, 0) self.infoLayout.addLayout(self.commentInfoHbox, 0) self.infoLayout.addLayout(self.platformsInfoHbox, 0) # Edit layout self.editLayout = QVBoxLayout() self.editLayout.addLayout(self.nameEditHbox, 0) self.editLayout.addLayout(self.platformEditHbox, 0) self.editLayout.addLayout(self.publisherEditHbox, 0) self.editLayout.addLayout(self.developerEditHbox, 0) self.editLayout.addLayout(self.genreEditHbox, 0) self.editLayout.addLayout(self.regionEditHbox, 0) self.editLayout.addLayout(self.yearEditHbox, 0) self.editLayout.addLayout(self.codeEditHbox, 0) self.editLayout.addLayout(self.itemEditHbox, 0) self.editLayout.addLayout(self.boxEditHbox, 0) self.editLayout.addLayout(self.manualEditHbox, 0) self.editLayout.addLayout(self.commentEditHbox, 0) self.editLayout.addLayout(self.platformsEditHbox, 0) # Price layout self.priceLayout = QVBoxLayout() self.priceLayout.addLayout(self.paidPriceHbox, 0) self.priceLayout.addLayout(self.loosePriceHbox, 0) self.priceLayout.addLayout(self.cibPriceHbox, 0) self.priceLayout.addLayout(self.newPriceHbox, 0) self.priceLayout.addStretch(1) self.priceLayout.addLayout(self.priceButtonHbox, 0) """Main layout""" self.infoWidget = QWidget() self.infoWidget.setLayout(self.infoLayout) self.editWidget = QWidget() self.editWidget.setLayout(self.editLayout) # Add info and edit widgets to a stacked layout so we can switch layouts when editing self.stackedLayout = QStackedLayout() self.stackedLayout.addWidget(self.infoWidget) self.stackedLayout.addWidget(self.editWidget) self.stackedLayout.setCurrentIndex(0) # Default to info layout self.detailsLayout = QVBoxLayout() self.detailsLayout.addLayout(self.coverVbox, 1) self.detailsLayout.addLayout(self.stackedLayout, 0) self.detailsLayout.addLayout(self.detailsButtonHbox, 0) self.detailsWidget = QWidget() self.detailsWidget.setLayout(self.detailsLayout) self.priceWidget = QWidget() self.priceWidget.setLayout(self.priceLayout) self.tab = QTabWidget() self.tab.addTab(self.detailsWidget, "Details") self.tab.addTab(self.priceWidget, "Price info") self.setWidget(self.tab)
def init_gui(self): """Initiates GUI elements.""" mainMenu = self.menuBar() # File menu fileMenu = mainMenu.addMenu('File') # Adding actions to file menu action_open_file = QAction('Open File', self) fileMenu.addAction(action_open_file) action_open_file.triggered.connect(lambda: self.open_file(None)) self.toolsMenu = mainMenu.addMenu('Tools') self.tabularMenu = self.toolsMenu.addMenu('Tabular') self.timeseriesMenu = self.toolsMenu.addMenu('Time Series') helpMenu = mainMenu.addMenu('Help') action_about = QAction('About', self) helpMenu.addAction(action_about) action_about.triggered.connect(self.about) # Left panels ---------------------------------------------------------- self.bt_markall = QPushButton('Mark all') self.bt_markall.clicked.connect(self.mark_all) self.bt_unmarkall = QPushButton('Unmark all') self.bt_unmarkall.clicked.connect(self.unmark_all) self.bt_test = QPushButton(' ') self.bt_test.clicked.connect(self.test) self.tree_primary = QTreeCustomPrimary(parent=self) self.tree_primary.setAlternatingRowColors(True) self.tree_primary.setHeaderLabels(['Primary Variables', 'type']) self.tree_primary.setToolTip( "Columns of the Dataframe. Can be accessed\n" "in the console with the variable 'df'") self.tree_primary.itemClicked.connect(self.update_selected_primary) self.bt_toprimary = QPushButton('To primary') self.bt_toprimary.clicked.connect(self.to_primary) self.bt_tosecondary = QPushButton('To secondary') self.bt_tosecondary.clicked.connect(self.to_secondary) self.hbox_l1 = QHBoxLayout() self.hbox_l1.addWidget(self.bt_toprimary) self.hbox_l1.addWidget(self.bt_tosecondary) self.tree_secondary = QTreeCustomSecondary(parent=self) self.tree_secondary.setAlternatingRowColors(True) self.tree_secondary.setHeaderLabels(['Secondary Variables', 'type']) self.tree_secondary.setToolTip( "Secondary variables, can be added to the Dataframe.\n" "Can be accessed in the console with the variable \n" "'secondary_vars'") self.tree_secondary.itemClicked.connect(self.update_selected_secondary) self.df = pd.DataFrame(np.random.rand(100, 5), columns=['a', 'b', 'c', 'd', 'e']) names = ['aa', 'bb', 'cc'] nm = [names[ind % 3] for ind in np.arange(100)] self.df['name'] = nm names_2 = ['abcd', 'ab789', 'another_class', 'yet_another', 'dfg65'] nm_2 = [names_2[ind % 5] for ind in np.arange(100)] self.df['name_2'] = nm_2 self.primary_names = list(self.df.keys()) self.secondary_vars = {'var 3': np.zeros(100), 'var 4': np.zeros(100)} self.secondary_names = list(self.secondary_vars.keys()) self.init_trees() self.vbox1 = QVBoxLayout() self.vbox1.addLayout(self.hbox_l1) self.vbox1.addWidget(self.tree_secondary) self.wbox1 = QWidget() self.wbox1.setLayout(self.vbox1) self.vsplit1 = QSplitter(Qt.Vertical) self.vsplit1.addWidget(self.tree_primary) self.vsplit1.addWidget(self.wbox1) self.grid_left1 = QGridLayout() self.grid_left1.setColumnStretch(5, 1) self.grid_left1.addWidget(self.bt_markall, 0, 0, 1, 2) self.grid_left1.addWidget(self.bt_unmarkall, 0, 2, 1, 2) self.grid_left1.addWidget(self.bt_test, 0, 4, 1, 1) self.grid_left1.addWidget(self.vsplit1, 1, 0, 1, 6) self.left_widget = QWidget() self.left_widget.setLayout(self.grid_left1) # Center panels ------------------------------------------------------- # Top tabs self.tabs_top = QTabWidget() self.tab0 = QWidget() self.tabs_top.addTab(self.tab0, "Tools") # Bottom tabs self.tabs_bottom = QTabWidget() self.console = ConsoleWidget(par=self) self.console.setToolTip( "df --> Dataframe with Primary variables\n" "secondary_vars --> Dictionary with Secondary variables") self.logger = QTextEdit() self.logger.setReadOnly(True) self.tabs_bottom.addTab(self.console, "Console") self.tabs_bottom.addTab(self.logger, "Logger") self.righ_widget = QSplitter(Qt.Vertical) self.righ_widget.addWidget(self.tabs_top) self.righ_widget.addWidget(self.tabs_bottom) # Window layout -------------------------------------------------------- self.hbox = QSplitter(Qt.Horizontal) self.hbox.addWidget(self.left_widget) # add left panel self.hbox.addWidget(self.righ_widget) # add centre panel self.setCentralWidget(self.hbox)
def init_gui(self): self.min = 0 self.max = 10 self.dat = [0] self.median_m = int() self.mean_m = int() self.mode_m = int() self.mode_list = [2, -34, 14, 14, 19, 15, -14, -13, 5] vbox = QVBoxLayout() print(self.median_m) layout = QHBoxLayout() text_layout = QHBoxLayout() self.median_ = QLabel(("Median: {0}".format(self.median_m))) self.mean_ = QLabel("Mean: {0}".format(self.mean_m)) self.mode_ = QLabel("Mode: {0}".format(mode(self.mode_list))) text_layout.addWidget(self.median_) text_layout.addWidget(self.mean_) text_layout.addWidget(self.mode_) vbox.addLayout(text_layout) central_widget = QWidget() self.chart = QtCharts.QChart() self.chart_view = QtCharts.QChartView() self.chart_view.setChart(self.chart) self.series = QtCharts.QLineSeries() self.chart_view.setRenderHint(QPainter.Antialiasing) self.chart.addSeries(self.series) axis_y = QtCharts.QValueAxis() axis_y.setTickCount(21) axis_y.setTickInterval(5) axis_y.setRange(-50, 50) self.chart.addAxis(axis_y, Qt.AlignLeft) axis_x = QtCharts.QValueAxis() axis_x.setTickCount(5) axis_x.setTickInterval(1) axis_x.setRange(self.min, self.max) self.chart.addAxis(axis_x, Qt.AlignBottom) self.series.attachAxis(axis_x) self.series.attachAxis(axis_y) self.series.setName("Temp") list_ = QListWidget() list_.addItem("Light theme") list_.addItem("Dark theme") list_.addItem("Sand theme") # list_.setSizePolicy(QSizePolicy.Policy.Minimum, QSizePolicy.Policy.Preferred) list_.currentRowChanged.connect(self.clicked_theme) '''statistic_list = QListWidget() statistic_list.addItem("Median") statistic_list.addItem("Mode") statistic_list.addItem("Mean") # statistic_list.setSizePolicy(QSizePolicy.Policy.Minimum, QSizePolicy.Policy.Preferred) statistic_list.currentRowChanged.connect(self.clicked_statistic)''' tab_widget = QTabWidget() tab_widget.addTab(list_, "Themes") # tab_widget.addTab(statistic_list, "Statistic data") tab_widget.setSizePolicy(QSizePolicy.Policy.Minimum, QSizePolicy.Policy.Preferred) layout.addWidget(tab_widget) # layout.addWidget(list_) vbox.addWidget(self.chart_view) layout.addLayout(vbox) central_widget.setLayout(layout) self.setCentralWidget(central_widget)
def __init__(self): super().__init__() self.setWindowTitle("AcademicChain") self.resize(640, 480) # Submit tab self.submitLayout = QFormLayout() self.lblStudentID = QLabel("Student ID") self.submitLayout.addWidget(self.lblStudentID) self.txtStudentID = QLineEdit() self.submitLayout.addWidget(self.txtStudentID) self.lblStudentName = QLabel("Student Name") self.submitLayout.addWidget(self.lblStudentName) self.txtStudentName = QLineEdit() self.submitLayout.addWidget(self.txtStudentName) self.lblClassID = QLabel("Class ID") self.submitLayout.addWidget(self.lblClassID) self.txtClassID = QLineEdit() self.submitLayout.addWidget(self.txtClassID) self.lblClassName = QLabel("Class Name") self.submitLayout.addWidget(self.lblClassName) self.txtClassName = QLineEdit() self.submitLayout.addWidget(self.txtClassName) self.lblGrade = QLabel("Grade") self.submitLayout.addWidget(self.lblGrade) self.txtGrade = QLineEdit() self.submitLayout.addWidget(self.txtGrade) self.lblAbsences = QLabel("Absences") self.submitLayout.addWidget(self.lblAbsences) self.txtAbsences = QLineEdit() self.submitLayout.addWidget(self.txtAbsences) self.lblCredits = QLabel("Credits") self.submitLayout.addWidget(self.lblCredits) self.txtCredits = QLineEdit() self.submitLayout.addWidget(self.txtCredits) def say_hello(): prevBlock = bc.get_block(0) height = prevBlock.height + 1 timestamp = int(time.time()) prevHash = prevBlock.currHash data = "tmp data" #nonce difficulty = prevBlock.difficulty # Data from QLineEdits student_id = self.txtStudentID.text() student_name = self.txtStudentName.text() class_id = self.txtClassID.text() class_name = self.txtClassName.text() grade = int(self.txtGrade.text()) absences = int(self.txtAbsences.text()) credits = int(self.txtCredits.text()) block = Block(timestamp, prevHash, "lol", difficulty, student_id, student_name, class_id, class_name, grade, absences, credits) bc.add_block(block) print("Block added to chain") print(bc) button = QPushButton("Submit data to chain") button.clicked.connect(say_hello) self.submitLayout.addWidget(button) submit = QWidget() submit.setLayout(self.submitLayout) # Request tab self.requestLayout = QFormLayout() self.lblTest = QLabel("ethan") self.requestLayout.addWidget(self.lblTest) request = QWidget() request.setLayout(self.requestLayout) # Info tab self.infoLayout = QFormLayout() self.lblTest2 = QLabel("Test2") self.infoLayout.addWidget(self.lblTest2) info = QWidget() info.setLayout(self.infoLayout) # Tabs init self.tab = QTabWidget() self.tab.addTab(submit, "Submit") self.tab.addTab(request, "Request") self.tab.addTab(info, "Stats") self.setCentralWidget(self.tab) self.show()