def build_models(self): self.path_model = PathModel(self.coredata) self.target_model = TargetModel(self.build) self.dep_model = DependencyModel(self.coredata) self.core_model = CoreModel(self.coredata) self.fill_data() self.ui.core_view.setModel(self.core_model) hv = QHeaderView(1) hv.setModel(self.core_model) self.ui.core_view.setHeader(hv) self.ui.path_view.setModel(self.path_model) hv = QHeaderView(1) hv.setModel(self.path_model) self.ui.path_view.setHeader(hv) self.ui.target_view.setModel(self.target_model) hv = QHeaderView(1) hv.setModel(self.target_model) self.ui.target_view.setHeader(hv) self.ui.dep_view.setModel(self.dep_model) hv = QHeaderView(1) hv.setModel(self.dep_model) self.ui.dep_view.setHeader(hv) self.ui.compile_button.clicked.connect(self.compile) self.ui.test_button.clicked.connect(self.run_tests) self.ui.install_button.clicked.connect(self.install) self.ui.clean_button.clicked.connect(self.clean) self.ui.save_button.clicked.connect(self.save)
def __init__(self, columns): super(TableView, self).__init__() self.columns = columns horizontal_header = QHeaderView(Qt.Horizontal) horizontal_header.setSectionResizeMode(QHeaderView.Stretch) self.setHorizontalHeader(horizontal_header) vertical_header = QHeaderView(Qt.Vertical) self.setVerticalHeader(vertical_header)
def __init__(self, menu, parent=None): super().__init__(parent) self.menu = menu # self wrapper self.head = QHeaderView(Qt.Horizontal, self) # link to database self.db_link = DataBase4Args() self.null_model = QStandardItemModel() # checking the value by its type. self.inspector = AutoInspector() # for collection the ArgsEditableModel self.edit_model = {} self.current_model = None self.current_ref_model = None self.current_ref_dst_model_id = None # set the horizontal head self.head.setStretchLastSection(True) self.setHorizontalHeader(self.head) # hide the vertical head self.verticalHeader().setHidden(True) # set width self.setMinimumWidth(320) self.setMaximumWidth(520) # set pop up right menu policy self.right_menu = QMenu() self.setContextMenuPolicy(Qt.DefaultContextMenu)
def setup_UI(self): """ Инициализация интерфейса поля морского боя """ cell_size = 32 self.table = QTableWidget() self.table.setColumnCount(10) self.table.setRowCount(10) horizontal_header = QHeaderView(Qt.Horizontal) horizontal_header.setDefaultSectionSize(cell_size) self.table.setHorizontalHeader(horizontal_header) self.table.setHorizontalHeaderLabels([c for c in "АБВГДЕЖЗИК"]) for r in range(10): for c in range(10): self.table.setItem(r, c, QTableWidgetItem()) self.table.setEditTriggers(QTableWidget.NoEditTriggers) self.table.setSelectionMode(QAbstractItemView.NoSelection) layout = QVBoxLayout() layout.addWidget(self.table) self.setLayout(layout) self.init_ships()
def setup_controller(self, user_id): self.user_id = user_id self.main_model = MainWindowModel(self.db_connection, 'Pracownicy') self.table_model = TableModel(self.main_model, edit_enabled=False) self.create_list( Queries.query_trainer_personal, ['Imię', 'Nazwisko', 'PESEL', 'Data urodzenia', 'Nr licencji']) self.ui.tableView.setHorizontalHeader( QHeaderView(Qt.Horizontal, self.ui.tableView)) self.ui.tableView.setModel(self.table_model) self.ui.tableView.horizontalHeader().setSizeAdjustPolicy( QtWidgets.QAbstractScrollArea.AdjustToContents)
def create_tableview(self): """ create the table view for DMX values """ self.view = QTableView() self.view.setSelectionMode(QAbstractItemView.NoSelection) self.model = UniverseModel(self) self.view.setModel(self.model) # set up headers of the QTableView v_headers = QHeaderView(Qt.Vertical) self.view.setVerticalHeader(v_headers) h_headers = QHeaderView(Qt.Horizontal) self.view.setHorizontalHeader(h_headers) if debug: print('how many lines : ', v_headers.count()) print('how many columns : ', h_headers.count()) # set up rows and columns for col in range(self.model.columnCount()): self.view.setColumnWidth(col, 28) for row in range(self.model.rowCount()): self.view.setRowHeight(row, 20) self.view.setMinimumHeight(350)
def create_registered_mn_tab(self): w = QWidget() hw = QWidget() self.reg_label = QLabel(self.registered_label()) self.reg_search_btn = QPushButton(_('Search')) self.reg_search_btn.clicked.connect(self.on_reg_search) src_model = RegisteredMNsModel(self.mn_list) self.reg_model = Dip3FilterProxyModel() self.reg_model.setSourceModel(src_model) self.reg_view = QTableView() self.reg_view.setContextMenuPolicy(Qt.CustomContextMenu) self.reg_view.customContextMenuRequested.connect(self.create_reg_menu) self.reg_hheader = QHeaderView(Qt.Horizontal, self.reg_view) self.reg_hheader.setSectionResizeMode(QHeaderView.ResizeToContents) self.reg_hheader.setStretchLastSection(True) self.reg_view.setHorizontalHeader(self.reg_hheader) self.reg_view.verticalHeader().hide() self.reg_view.setModel(self.reg_model) self.reg_view.setSelectionMode(QAbstractItemView.SingleSelection) self.reg_view.setSelectionBehavior(QAbstractItemView.SelectRows) self.reg_view.doubleClicked.connect(self.reg_mn_dbl_clicked) sel_model = self.reg_view.selectionModel() sel_model.selectionChanged.connect(self.on_reg_selection_changed) hbox = QHBoxLayout() vbox = QVBoxLayout() hbox.setContentsMargins(0, 0, 0, 0) hbox.addWidget(self.reg_label) hbox.addStretch(1) hbox.addWidget(self.reg_search_btn) hw.setLayout(hbox) vbox.addWidget(hw) vbox.addWidget(self.reg_view) w.setLayout(vbox) self.addTab(w, read_QIcon('tab_search.png'), _('Registered MNs')) if not self.mn_list.protx_loading: self.reg_model.reload_data() self.restore_reg_selection() return w
def createContractTable(self): self.contractHeaderView = QHeaderView(Qt.Horizontal) self.contractHeaderView.resizeSections(QHeaderView.Interactive) styleSheet = """ QHeaderView::section{ background-color: qlineargradient(x1:0, y1:0, x2:0, y2:1, stop:0 #616161, stop: 0.5 #505050, stop: 0.6 #434343, stop:1 #656565); color:white; border:0.5px solid; } """ self.contractHeaderView.setStyleSheet(styleSheet) self.contractView.setHorizontalHeader(self.contractHeaderView) header = ["time", "open", "high", "low", "close", "volume"] row_length = 0 col_length = 6 self.contractModel = ContractModel(row_length, col_length, header) self.contractView.setModel(self.contractModel)
def _setFilelistTable(self): fileHeaderview = QHeaderView(Qt.Horizontal) fileHeaderview.resizeSections(QHeaderView.Interactive) styleSheet = """ QHeaderView::section{ background-color: qlineargradient(x1:0, y1:0, x2:0, y2:1, stop:0 #616161, stop: 0.5 #505050, stop: 0.6 #434343, stop:1 #656565); color:white; border:0.5px solid; } """ fileHeaderview.setStyleSheet(styleSheet) self.filelistView.setHorizontalHeader(fileHeaderview) header = ["file name", "start date", "end date", "base"] row_length = 0 self.col_length = 4 self.filemodel = ShiftFilelistModel(row_length, self.col_length, header) self.filelistView.setModel(self.filemodel)
def __init__(self, ui, db_connection): super(AdminWindowController, self).__init__(db_connection=db_connection, ui=ui) self.main_model = MainWindowModel(db_connection, 'Pracownicy') self.current_table = 'Pracownicy' self.current_id = None self.table_model = TableModel(self.main_model) # self.create_list('Pracownicy', ['id_pracownika,imie,nazwisko,pesel,id_stanowisko,data_urodzenia'], 'id_pracownika') self.create_list('Pracownicy', ['*'], 'id_pracownika') self.ui.tableView.setHorizontalHeader( QHeaderView(Qt.Horizontal, self.ui.tableView)) self.ui.tableView.horizontalHeader().setStretchLastSection(True) self.ui.tableView.setModel(self.table_model) self.ui.tableView.verticalHeader().setVisible(False) style = "::section {" "background-color: pink; }" self.ui.tableView.horizontalHeader().setStyleSheet(style) # INITIAL STATE OF BUTTONS self.ui.pushButton_delete.setDisabled(True) self.edit_enabled = True # self.ui.tableView.resizeColumnsToContents() self.ui.tableView.horizontalHeader().setSizeAdjustPolicy( QtWidgets.QAbstractScrollArea.AdjustToContents) # CONNECTING FUNCTIONS TO BUTTONS self.ui.pushButton_add.clicked.connect(self.add) self.ui.pushButton_delete.clicked.connect(self.delete) self.ui.tableView.clicked.connect(self.table_clicked) #Table choice combo box self.ui.comboBox_tables.addItems(self.main_model.tables) self.ui.comboBox_tables.currentIndexChanged.connect( self.table_selection_change) #SORT BY COMBO BOX self.ui.comboBox_sortBy.addItems(self.table_model.headers) self.ui.comboBox_sortBy.currentIndexChanged.connect( self.sort_selection_change)
def _unittest_task_statistics_table_model(): import time from PyQt5.QtWidgets import QApplication, QMainWindow app = QApplication([]) win = QMainWindow() win.resize(800, 600) model = _TableModel(win) view = QTableView(win) view.setModel(model) view.setSortingEnabled(True) hh = QHeaderView(Qt.Horizontal, view) hh.setModel(model) hh.setVisible(True) view.setHorizontalHeader(hh) win.setCentralWidget(view) win.show() def go_go_go(): for _ in range(1000): time.sleep(0.001) app.processEvents() go_go_go() model.set_data(_make_test_data()) for _ in range(5): go_go_go() win.close()
def _setup_AdjustTable(self): adjustHeaderview = QHeaderView(Qt.Horizontal) adjustHeaderview.resizeSections(QHeaderView.Interactive) styleSheet = """ QHeaderView::section{ background-color: qlineargradient(x1:0, y1:0, x2:0, y2:1, stop:0 #616161, stop: 0.5 #505050, stop: 0.6 #434343, stop:1 #656565); color:white; border:0.5px solid; } """ adjustHeaderview.setStyleSheet(styleSheet) self.adjustView.setHorizontalHeader(adjustHeaderview) header = [ "first contract", "start date", "end date", "second contract", "start date", "end date", "base point" ] row_length = 0 col_length = 7 self.adjustmodel = ShiftAdjustModel(row_length, col_length, header) self.adjustmodel.setContractDataDict(self.contractEditor_dict) self.adjustmodel.setRollPointCalculator(RPByMaxVolume()) self.adjustView.setModel(self.adjustmodel)
def _setupResultTable(self): resultHeaderview = QHeaderView(Qt.Horizontal) resultHeaderview.resizeSections(QHeaderView.Interactive) styleSheet = """ QHeaderView::section{ background-color: qlineargradient(x1:0, y1:0, x2:0, y2:1, stop:0 #616161, stop: 0.5 #505050, stop: 0.6 #434343, stop:1 #656565); color:white; border:0.5px solid; } """ resultHeaderview.setStyleSheet(styleSheet) #resultHeaderview.setSectionResizeMode(QHeaderView.ResizeToContents) self.resultView.setHorizontalHeader(resultHeaderview) header = [ "date", "open", "high", "low", "close", "volume", "adjustment", "contract name" ] row_size = 0 col_size = 8 self.resultmodel = ResultModel(row_size, col_size, header) self.resultView.setModel(self.resultmodel)
def __init__(self, tmodel, parent=None): """Create the view. """ super(TableView, self).__init__(parent) self.setAttribute(Qt.WA_DeleteOnClose) self.tmodel = tmodel # This is a MUST self.leaf_numrows = leaf_numrows = self.tmodel.leaf_numrows self.selection_model = self.selectionModel() self.setSelectionMode(_aiv.SingleSelection) self.setSelectionBehavior(_aiv.SelectItems) # Setup the actual vertical scrollbar self.setVerticalScrollMode(_aiv.ScrollPerItem) self.vscrollbar = self.verticalScrollBar() # configure move over event capture self.clicked.connect(self.cellClicked) # get flag names for flag tooltip self.flagsDict = {} for name, value in ismrmrd.__dict__.items(): if name.startswith('ACQ_'): self.flagsDict[value] = name # set data model self.setModel(tmodel) # For potentially huge datasets use a customised scrollbar if leaf_numrows > tmodel.numrows: self.setItemDelegate(TableDelegate()) self.rbuffer_fault = False self.setVerticalScrollBarPolicy(Qt.ScrollBarAlwaysOn) self.tricky_vscrollbar = Scrollbar.ScrollBar(self) self.max_value = self.tricky_vscrollbar.setMaxValue( self.leaf_numrows) self.tricky_vscrollbar.setMinimum(0) self.interval_size = self.mapSlider2Leaf() # Setup the vertical header width self.vheader = QHeaderView(Qt.Vertical) self.setVerticalHeader(self.vheader) font = self.vheader.font() font.setBold(True) fmetrics = QFontMetrics(font) max_width = fmetrics.width(" {0} ".format(str(leaf_numrows))) self.vheader.setMinimumWidth(max_width) self.vheader.setSectionsClickable(True) self.vheader.setSectionResizeMode(QHeaderView.Fixed) self.vheader.setDefaultSectionSize(24) self.vheader.setVisible(False) # setup column widths metrics = QFontMetrics(self.vheader.font()) for ind in range(0, len(self.tmodel.colnames)): colName = self.tmodel.colnames[ind] width = metrics.boundingRect(colName).width() + 10 self.setColumnWidth(ind, width) # setup the text elide mode self.setTextElideMode(Qt.ElideRight) # connect signals to slots if leaf_numrows > tmodel.numrows: self.tricky_vscrollbar.actionTriggered.connect( self.navigateWithMouse) ## Instead of invoking updateView(). self.setSpan(0, 0, *tmodel.get_corner_span())
def create_wallet_mn_tab(self): w = QWidget() hw = QWidget() self.w_label = QLabel(self.wallet_label()) self.w_add_btn = QPushButton(_('Add / Import')) self.w_file_btn = QPushButton(_('File')) self.w_del_btn = QPushButton(_('Remove')) self.w_up_params_btn = QPushButton(_('Update Params')) self.w_up_coll_btn = QPushButton(_('Change Collateral')) self.w_protx_btn = QPushButton(_('Register')) self.w_up_srv_btn = QPushButton(_('Update Service')) self.w_up_reg_btn = QPushButton(_('Update Registrar')) self.w_add_btn.clicked.connect(self.on_add_masternode) self.w_file_btn.clicked.connect(self.on_file) self.w_del_btn.clicked.connect(self.on_del_masternode) self.w_up_params_btn.clicked.connect(self.on_update_params) self.w_up_coll_btn.clicked.connect(self.on_update_collateral) self.w_protx_btn.clicked.connect(self.on_make_pro_reg_tx) self.w_up_srv_btn.clicked.connect(self.on_make_pro_up_srv_tx) self.w_up_reg_btn.clicked.connect(self.on_make_pro_up_reg_tx) self.w_view = DeselectableTableView() self.w_view.setContextMenuPolicy(Qt.CustomContextMenu) self.w_view.customContextMenuRequested.connect(self.create_wallet_menu) self.w_view.on_deselect.connect(self.clear_selection) self.w_hheader = QHeaderView(Qt.Horizontal, self.w_view) self.w_hheader.setSectionResizeMode(QHeaderView.ResizeToContents) self.w_hheader.setStretchLastSection(True) self.w_view.setHorizontalHeader(self.w_hheader) self.w_view.verticalHeader().hide() self.w_view.setSelectionMode(QAbstractItemView.SingleSelection) self.w_view.setSelectionBehavior(QAbstractItemView.SelectRows) self.w_view.doubleClicked.connect(self.w_mn_dbl_clicked) row_h = self.w_view.verticalHeader().defaultSectionSize() self.w_hheader.setMinimumSectionSize(row_h) src_model = WalletMNsModel(self.manager, self.mn_list, self.gui, row_h) src_model.dataChanged.connect(self.w_data_changed) self.w_model = Dip3FilterProxyModel() self.w_model.setSourceModel(src_model) self.w_view.setModel(self.w_model) sel_model = self.w_view.selectionModel() sel_model.selectionChanged.connect(self.on_wallet_selection_changed) self.w_model.modelReset.connect(self.on_wallet_model_reset) hbox = QHBoxLayout() vbox = QVBoxLayout() hbox.setContentsMargins(0, 0, 0, 0) hbox.addWidget(self.w_label) if self.wallet.keystore and self.wallet.keystore.type == 'hardware': self.w_hardware_warning = QLabel( "Hardware wallets cannot register a Znode. Please use <a href=\"https://github.com/zcoinofficial/znode-tool-evo\">Znode Tool Evo</a> instead." ) self.w_hardware_warning.setStyleSheet( ColorScheme.WARNING.as_stylesheet()) self.w_hardware_warning.setOpenExternalLinks(True) hbox.addWidget(self.w_hardware_warning) hbox.addStretch(1) hbox.addWidget(self.w_del_btn) hbox.addWidget(self.w_up_params_btn) hbox.addWidget(self.w_up_coll_btn) hbox.addWidget(self.w_protx_btn) hbox.addWidget(self.w_up_reg_btn) hbox.addWidget(self.w_up_srv_btn) hbox.addWidget(self.w_file_btn) hbox.addWidget(self.w_add_btn) hw.setLayout(hbox) vbox.addWidget(hw) vbox.addWidget(self.w_view) w.setLayout(vbox) self.addTab(w, read_QIcon('tab_dip3.png'), _('Wallet Znodes')) if not self.mn_list.protx_loading: self.w_model.reload_data() return w
def create_wallet_mn_tab(self): w = QWidget() hw = QWidget() self.w_label = QLabel(self.wallet_label()) self.w_add_btn = QPushButton(_('Add / Import')) self.w_file_btn = QPushButton(_('File')) self.w_del_btn = QPushButton(_('Remove')) self.w_up_params_btn = QPushButton(_('Update Params')) self.w_up_coll_btn = QPushButton(_('Change Collateral')) self.w_protx_btn = QPushButton(_('Register')) self.w_up_srv_btn = QPushButton(_('Update Service')) self.w_up_reg_btn = QPushButton(_('Update Registrar')) self.w_add_btn.clicked.connect(self.on_add_masternode) self.w_file_btn.clicked.connect(self.on_file) self.w_del_btn.clicked.connect(self.on_del_masternode) self.w_up_params_btn.clicked.connect(self.on_update_params) self.w_up_coll_btn.clicked.connect(self.on_update_collateral) self.w_protx_btn.clicked.connect(self.on_make_pro_reg_tx) self.w_up_srv_btn.clicked.connect(self.on_make_pro_up_srv_tx) self.w_up_reg_btn.clicked.connect(self.on_make_pro_up_reg_tx) self.w_view = QTableView() self.w_view.setContextMenuPolicy(Qt.CustomContextMenu) self.w_view.customContextMenuRequested.connect(self.create_wallet_menu) self.w_hheader = QHeaderView(Qt.Horizontal, self.w_view) self.w_hheader.setSectionResizeMode(QHeaderView.ResizeToContents) self.w_hheader.setStretchLastSection(True) self.w_view.setHorizontalHeader(self.w_hheader) self.w_view.verticalHeader().hide() self.w_view.setSelectionMode(QAbstractItemView.SingleSelection) self.w_view.setSelectionBehavior(QAbstractItemView.SelectRows) self.w_view.doubleClicked.connect(self.w_mn_dbl_clicked) row_h = self.w_view.verticalHeader().defaultSectionSize() self.w_hheader.setMinimumSectionSize(row_h) src_model = WalletMNsModel(self.manager, self.mn_list, self.gui, row_h) src_model.dataChanged.connect(self.w_data_changed) self.w_model = Dip3FilterProxyModel() self.w_model.setSourceModel(src_model) self.w_view.setModel(self.w_model) sel_model = self.w_view.selectionModel() sel_model.selectionChanged.connect(self.on_wallet_selection_changed) self.w_model.modelReset.connect(self.on_wallet_model_reset) hbox = QHBoxLayout() vbox = QVBoxLayout() hbox.setContentsMargins(0, 0, 0, 0) hbox.addWidget(self.w_label) hbox.addStretch(1) hbox.addWidget(self.w_del_btn) hbox.addWidget(self.w_up_params_btn) hbox.addWidget(self.w_up_coll_btn) hbox.addWidget(self.w_protx_btn) hbox.addWidget(self.w_up_reg_btn) hbox.addWidget(self.w_up_srv_btn) hbox.addWidget(self.w_file_btn) hbox.addWidget(self.w_add_btn) hw.setLayout(hbox) vbox.addWidget(hw) vbox.addWidget(self.w_view) w.setLayout(vbox) self.addTab(w, read_QIcon('tab_dip3.png'), _('Wallet MNs')) if not self.mn_list.protx_loading: self.w_model.reload_data() return w
def initUI(self): self.setGeometry(100, 100, 1200, 1200) self.display_size = 800 self.addToolBar("MY Window") self.showMaximized() layout = QHBoxLayout() vbox1 = QVBoxLayout() vbox2 = QVBoxLayout() vbox1hbox1 = QHBoxLayout() vbox1.setContentsMargins(0, 0, 100, 100) vbox2.setContentsMargins(100, 0, 0, 100) vbox2hbox1 = QHBoxLayout() vbox2.addLayout(vbox2hbox1) layout.addLayout(vbox1) layout.addLayout(vbox2) dicomButton = QPushButton('Read DICOM') contoursButton = QPushButton('Read Contours') gatingButton = QPushButton('Extract Diastolic Frames') segmentButton = QPushButton('Segment') splineButton = QPushButton('Manual Contour') writeButton = QPushButton('Write Contours') reportButton = QPushButton('Write Report') dicomButton.setToolTip("Load images in .dcm format") contoursButton.setToolTip("Load saved contours in .xml format") gatingButton.setToolTip("Extract end diastolic images from pullback") segmentButton.setToolTip( "Run deep learning based segmentation of lumen and plaque") splineButton.setToolTip( "Manually draw new contour for lumen, plaque or stent") writeButton.setToolTip("Save contours in .xml file") reportButton.setToolTip( "Write report containing, lumen, plaque and vessel areas and plaque burden" ) hideHeader1 = QHeaderView(Qt.Vertical) hideHeader1.hide() hideHeader2 = QHeaderView(Qt.Horizontal) hideHeader2.hide() self.infoTable = QTableWidget() self.infoTable.setRowCount(8) self.infoTable.setColumnCount(2) self.infoTable.setItem(0, 0, QTableWidgetItem('Patient Name')) self.infoTable.setItem(1, 0, QTableWidgetItem('Patient DOB')) self.infoTable.setItem(2, 0, QTableWidgetItem('Patient Sex')) self.infoTable.setItem(3, 0, QTableWidgetItem('Pullback Speed')) self.infoTable.setItem(4, 0, QTableWidgetItem('Resolution (mm)')) self.infoTable.setItem(5, 0, QTableWidgetItem('Dimensions')) self.infoTable.setItem(6, 0, QTableWidgetItem('Manufacturer')) self.infoTable.setItem(7, 0, QTableWidgetItem('Model')) self.infoTable.setVerticalHeader(hideHeader1) self.infoTable.setHorizontalHeader(hideHeader2) self.infoTable.horizontalHeader().setStretchLastSection(True) dicomButton.clicked.connect(self.readDICOM) contoursButton.clicked.connect(self.readContours) segmentButton.clicked.connect(self.segment) splineButton.clicked.connect(self.newSpline) gatingButton.clicked.connect(self.gate) writeButton.clicked.connect(self.writeContours) reportButton.clicked.connect(self.report) self.playButton = QPushButton() pixmapi1 = getattr(QStyle, 'SP_MediaPlay') pixmapi2 = getattr(QStyle, 'SP_MediaPause') self.playIcon = self.style().standardIcon(pixmapi1) self.pauseIcon = self.style().standardIcon(pixmapi2) self.playButton.setIcon(self.playIcon) self.playButton.clicked.connect(self.play) self.paused = True self.slider = Slider(Qt.Horizontal) self.slider.valueChanged[int].connect(self.changeValue) self.hideBox = QCheckBox('Hide Contours') self.hideBox.setChecked(True) self.hideBox.stateChanged[int].connect(self.changeState) self.useGatedBox = QCheckBox('Gated Frames') self.useGatedBox.stateChanged[int].connect(self.useGated) self.useGatedBox.setToolTip( "When this is checked only gated frames will be segmented and only gated frames statistics will be written to the report" ) self.useGatedBox.setToolTipDuration(200) self.wid = Display() self.c = Communicate() self.c.updateBW[int].connect(self.wid.setFrame) self.c.updateBool[bool].connect(self.wid.setDisplay) self.text = QLabel() self.text.setAlignment(Qt.AlignCenter) self.text.setText("Frame {}".format(self.slider.value())) vbox1.addWidget(self.wid) vbox1hbox1.addWidget(self.playButton) vbox1hbox1.addWidget(self.slider) vbox1.addLayout(vbox1hbox1) vbox1.addWidget(self.text) vbox2.addWidget(self.hideBox) vbox2.addWidget(self.useGatedBox) vbox2.addWidget(dicomButton) vbox2.addWidget(contoursButton) vbox2.addWidget(gatingButton) vbox2.addWidget(segmentButton) vbox2.addWidget(splineButton) vbox2.addWidget(writeButton) vbox2.addWidget(reportButton) vbox2hbox1.addWidget(self.infoTable) centralWidget = QWidget() centralWidget.setLayout(layout) self.setWindowIcon(QIcon('Media/thumbnail.png')) self.setWindowTitle('DeepIVUS') self.setCentralWidget(centralWidget) self.show() disclaimer = QMessageBox.about( self, 'DeepIVUS', 'DeepIVUS is not FDA approved and should not be used for medical decisions.' )
def __init__(self): super(ListBox, self).__init__() self.fileList = [] self.folderlist = [] self.allFolders = [] self.dir = QDir.homePath() self.subdir = QDir.homePath() self.setGeometry(0, 0, 800, 450) self.setMinimumSize(500, 300) self.setContentsMargins(10, 10, 10, 0) self.setWindowIcon(QIcon.fromTheme('kfind')) self.setWindowTitle("Find Files") ##toolbar###################################################### self.tb = self.addToolBar("Tools") self.tb.setMovable(False) self.tb.setContextMenuPolicy(Qt.PreventContextMenu) self.findEdit = QLineEdit("*") self.findAct = QAction(QIcon.fromTheme('edit-find'), "find", self, statusTip="find Files", triggered=self.findMyFiles) self.findEdit.addAction(self.findAct, QLineEdit.LeadingPosition) self.findEdit.setPlaceholderText("find") self.findEdit.setToolTip("for example: *word*") self.findEdit.setStatusTip("for example: *word*") self.tb.addWidget(self.findEdit) self.findEdit.returnPressed.connect(self.findMyFiles) self.tb.addSeparator() self.folderEdit = QLineEdit() self.folderAct = QAction(QIcon.fromTheme('document-open'), "change Folder", self, statusTip="change Folder", triggered=self.changeFolder) self.folderEdit.addAction(self.folderAct, QLineEdit.LeadingPosition) self.folderEdit.setPlaceholderText("insert folder path") self.folderEdit.setText(self.dir) # self.folderEdit.textChanged.connect(self.setDir) self.folderEdit.returnPressed.connect(self.findMyFiles) self.tb.addWidget(self.folderEdit) self.tb.addSeparator() # self.addToolBarBreak() self.noDot = QCheckBox("include hidden files") # self.tb2 = self.addToolBar("hidden") # self.tb2.addWidget(self.noDot) ##Listbox########################################################## self.lb = QTableWidget() self.lb.setSelectionBehavior(QAbstractItemView.SelectRows) self.lb.setColumnCount(2) self.lb.setColumnWidth(0, 300) # self.lb.setSelectionBehavior(self.lb.SelectRows) self.lb.setSelectionMode(self.lb.SingleSelection) self.lb.cellDoubleClicked.connect(self.doubleClicked) self.lb.itemClicked.connect(self.getItem) self.lb.setEditTriggers(QAbstractItemView.NoEditTriggers) self.lb.horizontalHeader().setStretchLastSection(True) self.lb.setAlternatingRowColors(True) self.verticalHeader = QHeaderView(Qt.Vertical) self.lb.setVerticalHeader(self.verticalHeader) self.lb.horizontalHeader().setStretchLastSection(True) self.lb.setHorizontalHeaderItem(0, QTableWidgetItem("Filename")) self.lb.setHorizontalHeaderItem(1, QTableWidgetItem("Path")) self.verticalHeader.setDefaultSectionSize(24) self.lb.verticalHeader().hide() self.lb.setToolTip( "double click first column to open file\nsecond column to open file parent folder" ) self.setCentralWidget(self.lb) self.findEdit.setFocus() self.statusBar().showMessage("Ready") print("Welcome\nPython Version: " + sys.version[:5]) print("home is: " + home) self.setStyleSheet(stylesheet(self)) self.copyBtn = QPushButton("copy filepath") self.copyBtn.clicked.connect(self.copyPath) self.copyBtn.setFlat(True) self.statusBar().addPermanentWidget(self.copyBtn) self.dir = self.folderEdit.text()