class BaseDifferFrame(QFrame): def __init__(self, parent, diff_type='trait', name='BaseDifferFrame'): QFrame.__init__(self, parent, name) self.diff_type = diff_type if self.diff_type == 'trait': boxtype = SuiteTraitComboBox elif self.diff_type == 'family': boxtype = FamilyList else: raise ValueError, 'unknown diff_type %s' % self.diff_type self.leftBox = boxtype(self, 'leftBox') self.rightBox = boxtype(self, 'rightBox') self.vbox = QVBoxLayout(self) margin = 5 self.list_hbox = QHBoxLayout(self.vbox, margin) self.list_hbox.addWidget(self.leftBox) self.list_hbox.addWidget(self.rightBox) def slotDiff(self): left_data = self.leftBox.getData() right_data = self.rightBox.getData() if self.diff_type == 'trait': differ = Differ(left_data, right_data) differ.diff() if differ.isdifferent('left', left_data): newdata = differ.get_data('left') self.leftBox.updateData(newdata) if differ.isdifferent('right', right_data): newdata = differ.get_data('right') self.rightBox.updateData(newdata) elif self.diff_type == 'family': # VariablesConfig objects have their own diff method left_data.diff(right_data) else: raise ValueError, 'unknown diff_type %s' % self.diff_type
class BaseDifferWidget(QWidget): def __init__(self, app, parent, dtype='trait', name='BaseDiffer'): QWidget.__init__(self, parent, name) dbwidget(self, app) self.dtype = dtype if dtype == 'trait': boxtype = SuiteTraitCombo elif dtype == 'family': boxtype = FamilyList self.leftBox = boxtype(self.app, self, 'leftBox') self.rightBox = boxtype(self.app, self, 'rightBox') self.vbox = QVBoxLayout(self) self.list_hbox = QHBoxLayout(self.vbox, 5) self.list_hbox.addWidget(self.leftBox) self.list_hbox.addWidget(self.rightBox) def slotDiff(self): print 'diff me' #left_item = self.leftBox.currentItem() #right_item = self.rightBox.currentItem() ldata = self.leftBox.getData() rdata = self.rightBox.getData() if self.dtype == 'trait': differ = Differ(ldata, rdata) differ.diff() if differ.isdifferent('left', ldata): newdata = differ.get_data('left') self.leftBox.updateData(newdata) if differ.isdifferent('right', rdata): newdata = differ.get_data('right') self.rightBox.updateData(newdata) elif self.dtype == 'family': ldata.diff(rdata)
def __init__(self, parent): super(TilesetSelector, self).__init__(parent) loadUi(self) self.kcfg_tilesetName = KLineEdit(self) self.kcfg_tilesetName.setVisible(False) self.kcfg_tilesetName.setObjectName('kcfg_tilesetName') self.tileScene = SceneWithFocusRect() self.tileView = FittingView() self.tileView.setScene(self.tileScene) self.tileset = Tileset(Internal.Preferences.tilesetName) self.uiTiles = [UITile('w' + s.char.lower()) for s in Wind.all4] self.board = Board(2, 2, self.tileset) self.board.showShadows = True self.tileScene.addItem(self.board) self.tileView.setParent(self.tilesetPreview) layout = QHBoxLayout(self.tilesetPreview) layout.addWidget(self.tileView) for idx, offsets in enumerate([(0, 0), (0, 1), (1, 0), (1, 1)]): self.uiTiles[idx].setBoard( self.board, *offsets) self.uiTiles[idx].focusable = False self.setUp()
def __init__(self, parent): QDialog.__init__(self) self.parent = parent self._data = {} self.table = QTableWidget(self) self.table.horizontalHeader().setStretchLastSection(True) self.table.verticalHeader().setVisible(False) self.table.setEditTriggers(QTableWidget.NoEditTriggers) self.table.itemChanged.connect(self.itemChanged) self.updateTable() self.buttonBox = QDialogButtonBox() self.buttonBox.setStandardButtons( QDialogButtonBox.Close) # Close has the Rejected role self.buttonBox.rejected.connect(self.accept) self.newButton = self.buttonBox.addButton( m18nc('define a new player', "&New"), QDialogButtonBox.ActionRole) self.newButton.setIcon(KIcon("document-new")) self.newButton.clicked.connect(self.slotInsert) self.deleteButton = self.buttonBox.addButton( m18n("&Delete"), QDialogButtonBox.ActionRole) self.deleteButton.setIcon(KIcon("edit-delete")) self.deleteButton.clicked.connect(self.delete) cmdLayout = QHBoxLayout() cmdLayout.addWidget(self.buttonBox) layout = QVBoxLayout() layout.addWidget(self.table) layout.addLayout(cmdLayout) self.setLayout(layout) decorateWindow(self, m18n("Players")) self.setObjectName('Players')
def setupUi(self): """setup UI elements""" self.viewLeft = ScoreViewLeft(self) self.viewRight = ScoreViewRight(self) self.viewRight.setHorizontalScrollBar(HorizontalScrollBar(self)) self.viewRight.setHorizontalScrollMode(QAbstractItemView.ScrollPerItem) self.viewRight.setFocusPolicy(Qt.NoFocus) self.viewRight.header().setSectionsClickable(False) self.viewRight.header().setSectionsMovable(False) self.viewRight.setSelectionMode(QAbstractItemView.NoSelection) windowLayout = QVBoxLayout(self) self.splitter = QSplitter(Qt.Vertical) self.splitter.setObjectName('ScoreTableSplitter') windowLayout.addWidget(self.splitter) scoreWidget = QWidget() self.scoreLayout = QHBoxLayout(scoreWidget) leftLayout = QVBoxLayout() leftLayout.addWidget(self.viewLeft) self.leftLayout = leftLayout self.scoreLayout.addLayout(leftLayout) self.scoreLayout.addWidget(self.viewRight) self.splitter.addWidget(scoreWidget) self.ruleTree = RuleTreeView(i18nc('kajongg', 'Used Rules')) self.splitter.addWidget(self.ruleTree) # this shows just one line for the ruleTree - so we just see the # name of the ruleset: self.splitter.setSizes(list([1000, 1]))
def __init__(self, parent): QDialog.__init__(self) self.parent = parent self._data = {} self.table = QTableWidget(self) self.table.horizontalHeader().setStretchLastSection(True) self.table.verticalHeader().setVisible(False) self.table.setEditTriggers(QTableWidget.NoEditTriggers) self.table.itemChanged.connect(self.itemChanged) self.updateTable() self.buttonBox = QDialogButtonBox() self.buttonBox.setStandardButtons( QDialogButtonBox.Close) # Close has the Rejected role self.buttonBox.rejected.connect(self.accept) self.newButton = self.buttonBox.addButton( i18nc('define a new player', "&New"), QDialogButtonBox.ActionRole) self.newButton.setIcon(KIcon("document-new")) self.newButton.clicked.connect(self.slotInsert) self.deleteButton = self.buttonBox.addButton( i18n("&Delete"), QDialogButtonBox.ActionRole) self.deleteButton.setIcon(KIcon("edit-delete")) self.deleteButton.clicked.connect(self.delete) cmdLayout = QHBoxLayout() cmdLayout.addWidget(self.buttonBox) layout = QVBoxLayout() layout.addWidget(self.table) layout.addLayout(cmdLayout) self.setLayout(layout) decorateWindow(self, i18n("Players")) self.setObjectName('Players')
def __init__(self, client): super(TableList, self).__init__(None) self.autoStarted = False self.client = client self.setObjectName('TableList') self.resize(700, 400) self.view = MJTableView(self) self.differ = None self.debugModelTest = None self.requestedNewTable = False self.view.setItemDelegateForColumn(2, RichTextColumnDelegate(self.view)) buttonBox = QDialogButtonBox(self) self.newButton = buttonBox.addButton( i18nc('allocate a new table', "&New"), QDialogButtonBox.ActionRole) self.newButton.setIcon(KIcon("document-new")) self.newButton.setToolTip(i18n("Allocate a new table")) self.newButton.clicked.connect(self.client.newTable) self.joinButton = buttonBox.addButton(i18n("&Join"), QDialogButtonBox.AcceptRole) self.joinButton.clicked.connect(client.joinTable) self.joinButton.setIcon(KIcon("list-add-user")) self.joinButton.setToolTip(i18n("Join a table")) self.leaveButton = buttonBox.addButton(i18n("&Leave"), QDialogButtonBox.AcceptRole) self.leaveButton.clicked.connect(self.leaveTable) self.leaveButton.setIcon(KIcon("list-remove-user")) self.leaveButton.setToolTip(i18n("Leave a table")) self.compareButton = buttonBox.addButton( i18nc('Kajongg-Ruleset', 'Compare'), QDialogButtonBox.AcceptRole) self.compareButton.clicked.connect(self.compareRuleset) self.compareButton.setIcon(KIcon("preferences-plugin-script")) self.compareButton.setToolTip( i18n('Compare the rules of this table with my own rulesets')) self.chatButton = buttonBox.addButton(i18n('&Chat'), QDialogButtonBox.AcceptRole) self.chatButton.setIcon(KIcon("call-start")) self.chatButton.clicked.connect(self.chat) self.startButton = buttonBox.addButton(i18n('&Start'), QDialogButtonBox.AcceptRole) self.startButton.clicked.connect(self.startGame) self.startButton.setIcon(KIcon("arrow-right")) self.startButton.setToolTip( i18n("Start playing on a table. " "Empty seats will be taken by robot players.")) cmdLayout = QHBoxLayout() cmdLayout.addWidget(buttonBox) layout = QVBoxLayout() layout.addWidget(self.view) layout.addLayout(cmdLayout) self.setLayout(layout) self.view.doubleClicked.connect(client.joinTable) StateSaver(self, self.view.horizontalHeader()) self.updateButtonsForTable(None)
def __init__(self, parent, nombre, lista): """el ultimo parametro es la lista de posibles valores""" ElementoWidgetOpciones.__init__(self) QGroupBox.__init__(self, parent, "ListaSimple") self.nombre = nombre self.setTitle(nombre) self.setColumnLayout(0, Qt.Vertical) self.layout().setSpacing(6) self.layout().setMargin(11) llayout = QVBoxLayout(self.layout()) llayout.setAlignment(Qt.AlignTop) layout12 = QHBoxLayout(None, 0, 6, "layout12") label = QLabel(self, "label") layout12.addWidget(label) spacer7 = QSpacerItem(51, 31, QSizePolicy.Expanding, QSizePolicy.Minimum) layout12.addItem(spacer7) self.combo1 = QComboBox(0, self, "comboBox1") layout12.addWidget(self.combo1) spacer8 = QSpacerItem(131, 20, QSizePolicy.Expanding, QSizePolicy.Minimum) layout12.addItem(spacer8) llayout.addLayout(layout12) for elemento in lista: self.combo1.insertItem(elemento)
def set_board_widget(self, board_widget): self.board_widget = board_widget layout = QHBoxLayout() layout.addWidget(board_widget, 2) layout.addWidget(self.create_sidebar_widget()) central_widget = QWidget(self) central_widget.setLayout(layout) self.setCentralWidget(central_widget) self.repaint()
def __init__(self, leftRulesets, rightRulesets, parent=None): QDialog.__init__(self, parent) if not isinstance(leftRulesets, list): leftRulesets = list([leftRulesets]) if not isinstance(rightRulesets, list): rightRulesets = list([rightRulesets]) leftRulesets, rightRulesets = leftRulesets[:], rightRulesets[:] # remove rulesets from right which are also on the left side for left in leftRulesets: left.load() for right in rightRulesets: right.load() for left in leftRulesets: for right in rightRulesets[:]: if left == right and left.name == right.name: # rightRulesets.remove(right) this is wrong because it # removes the first ruleset with the same hash rightRulesets = list(x for x in rightRulesets if id(x) != id(right)) self.leftRulesets = leftRulesets self.rightRulesets = rightRulesets self.model = None self.modelTest = None self.view = MJTableView(self) self.buttonBox = QDialogButtonBox() self.buttonBox.setStandardButtons(QDialogButtonBox.Ok) self.buttonBox.accepted.connect(self.accept) self.buttonBox.rejected.connect(self.reject) cbLayout = QHBoxLayout() self.cbRuleset1 = ListComboBox(self.leftRulesets) if len(self.leftRulesets) == 1: self.lblRuleset1 = QLabel(self.leftRulesets[0].name) cbLayout.addWidget(self.lblRuleset1) else: cbLayout.addWidget(self.cbRuleset1) self.cbRuleset2 = ListComboBox(self.rightRulesets) cbLayout.addWidget(self.cbRuleset2) cmdLayout = QHBoxLayout() cmdLayout.addWidget(self.buttonBox) layout = QVBoxLayout() layout.addLayout(cbLayout) layout.addWidget(self.view) layout.addLayout(cmdLayout) self.setLayout(layout) decorateWindow(self, m18n("Compare")) self.setObjectName("RulesetDiffer") self.cbRuleset1.currentIndexChanged.connect(self.leftRulesetChanged) self.cbRuleset2.currentIndexChanged.connect(self.rulesetChanged) self.leftRulesetChanged() StateSaver(self)
def __init__(self, app, parent, dtype='trait', name='BaseDiffer'): QWidget.__init__(self, parent, name) dbwidget(self, app) self.dtype = dtype if dtype == 'trait': boxtype = SuiteTraitCombo elif dtype == 'family': boxtype = FamilyList self.leftBox = boxtype(self.app, self, 'leftBox') self.rightBox = boxtype(self.app, self, 'rightBox') self.vbox = QVBoxLayout(self) self.list_hbox = QHBoxLayout(self.vbox, 5) self.list_hbox.addWidget(self.leftBox) self.list_hbox.addWidget(self.rightBox)
def __init__(self, parent=None): super(Games, self).__init__(parent) self.selectedGame = None self.onlyPending = True decorateWindow(self, m18nc('kajongg', 'Games')) self.setObjectName('Games') self.resize(700, 400) self.model = GamesModel() if Debug.modelTest: self.modelTest = ModelTest(self.model, self) self.view = MJTableView(self) self.view.setModel(self.model) self.selection = QItemSelectionModel(self.model, self.view) self.view.setSelectionModel(self.selection) self.view.setSelectionBehavior(QAbstractItemView.SelectRows) self.view.setSelectionMode(QAbstractItemView.SingleSelection) self.buttonBox = QDialogButtonBox(self) self.buttonBox.setStandardButtons(QDialogButtonBox.Cancel) self.newButton = self.buttonBox.addButton( m18nc('start a new game', "&New"), QDialogButtonBox.ActionRole) self.newButton.setIcon(KIcon("document-new")) self.newButton.clicked.connect(self.accept) self.loadButton = self.buttonBox.addButton( m18n("&Load"), QDialogButtonBox.AcceptRole) self.loadButton.clicked.connect(self.loadGame) self.loadButton.setIcon(KIcon("document-open")) self.deleteButton = self.buttonBox.addButton( m18n("&Delete"), QDialogButtonBox.ActionRole) self.deleteButton.setIcon(KIcon("edit-delete")) self.deleteButton.clicked.connect(self.delete) chkPending = QCheckBox(m18n("Show only pending games"), self) chkPending.setChecked(True) cmdLayout = QHBoxLayout() cmdLayout.addWidget(chkPending) cmdLayout.addWidget(self.buttonBox) layout = QVBoxLayout() layout.addWidget(self.view) layout.addLayout(cmdLayout) self.setLayout(layout) StateSaver(self) self.selection.selectionChanged.connect(self.selectionChanged) self.buttonBox.accepted.connect(self.accept) self.buttonBox.rejected.connect(self.reject) self.view.doubleClicked.connect(self.loadGame) chkPending.stateChanged.connect(self.pendingOrNot)
def setupUi(self): """setup UI elements""" self.viewLeft = ScoreViewLeft(self) self.viewRight = ScoreViewRight(self) self.viewRight.setHorizontalScrollBar(HorizontalScrollBar(self)) self.viewRight.setHorizontalScrollMode(QAbstractItemView.ScrollPerItem) self.viewRight.setFocusPolicy(Qt.NoFocus) if usingQt5: self.viewRight.header().setSectionsClickable(False) self.viewRight.header().setSectionsMovable(False) else: self.viewRight.header().setClickable(False) self.viewRight.header().setMovable(False) self.viewRight.setSelectionMode(QAbstractItemView.NoSelection) windowLayout = QVBoxLayout(self) self.splitter = QSplitter(Qt.Vertical) self.splitter.setObjectName("ScoreTableSplitter") windowLayout.addWidget(self.splitter) scoreWidget = QWidget() self.scoreLayout = QHBoxLayout(scoreWidget) leftLayout = QVBoxLayout() leftLayout.addWidget(self.viewLeft) self.leftLayout = leftLayout self.scoreLayout.addLayout(leftLayout) self.scoreLayout.addWidget(self.viewRight) self.splitter.addWidget(scoreWidget) self.ruleTree = RuleTreeView(m18nc("kajongg", "Used Rules")) self.splitter.addWidget(self.ruleTree) # this shows just one line for the ruleTree - so we just see the # name of the ruleset: self.splitter.setSizes(list([1000, 1]))
def __init__(self, parent, diff_type='trait', name='BaseDifferFrame'): QFrame.__init__(self, parent, name) self.diff_type = diff_type if self.diff_type == 'trait': boxtype = SuiteTraitComboBox elif self.diff_type == 'family': boxtype = FamilyList else: raise ValueError, 'unknown diff_type %s' % self.diff_type self.leftBox = boxtype(self, 'leftBox') self.rightBox = boxtype(self, 'rightBox') self.vbox = QVBoxLayout(self) margin = 5 self.list_hbox = QHBoxLayout(self.vbox, margin) self.list_hbox.addWidget(self.leftBox) self.list_hbox.addWidget(self.rightBox)
def setupUi(self): """layout the window""" self.setContentsMargins(0, 0, 0, 0) vlayout = QVBoxLayout(self) vlayout.setContentsMargins(0, 0, 0, 0) sliderLayout = QHBoxLayout() self.kcfg_showShadows = QCheckBox(m18n('Show tile shadows'), self) self.kcfg_showShadows.setObjectName('kcfg_showShadows') self.kcfg_rearrangeMelds = QCheckBox( m18n('Rearrange undisclosed tiles to melds'), self) self.kcfg_rearrangeMelds.setObjectName('kcfg_rearrangeMelds') self.kcfg_showOnlyPossibleActions = QCheckBox(m18n( 'Show only possible actions')) self.kcfg_showOnlyPossibleActions.setObjectName( 'kcfg_showOnlyPossibleActions') self.kcfg_propose = QCheckBox(m18n('Propose what to do')) self.kcfg_propose.setObjectName('kcfg_propose') self.kcfg_animationSpeed = QSlider(self) self.kcfg_animationSpeed.setObjectName('kcfg_animationSpeed') self.kcfg_animationSpeed.setOrientation(Qt.Horizontal) self.kcfg_animationSpeed.setSingleStep(1) lblSpeed = QLabel(m18n('Animation speed:')) lblSpeed.setBuddy(self.kcfg_animationSpeed) sliderLayout.addWidget(lblSpeed) sliderLayout.addWidget(self.kcfg_animationSpeed) self.kcfg_useSounds = QCheckBox(m18n('Use sounds if available'), self) self.kcfg_useSounds.setObjectName('kcfg_useSounds') self.kcfg_uploadVoice = QCheckBox(m18n( 'Let others hear my voice'), self) self.kcfg_uploadVoice.setObjectName('kcfg_uploadVoice') pol = QSizePolicy() pol.setHorizontalPolicy(QSizePolicy.Expanding) pol.setVerticalPolicy(QSizePolicy.Expanding) spacerItem = QSpacerItem( 20, 20, QSizePolicy.Minimum, QSizePolicy.Expanding) vlayout.addWidget(self.kcfg_showShadows) vlayout.addWidget(self.kcfg_rearrangeMelds) vlayout.addWidget(self.kcfg_showOnlyPossibleActions) vlayout.addWidget(self.kcfg_propose) vlayout.addWidget(self.kcfg_useSounds) vlayout.addWidget(self.kcfg_uploadVoice) vlayout.addLayout(sliderLayout) vlayout.addItem(spacerItem) self.setSizePolicy(pol) self.retranslateUi()
def setup(self): showPlusServerWidget = True if _platform == "linux" or _platform == "linux2" or _platform == "darwin": #linux or linux or OS X message = "Attention: You are running Slicer on Linux or OS X. Do you have PlusServer installed on the current OS?" result = QMessageBox.question(slicer.util.mainWindow(), 'ProstateTRUSNav', message, QMessageBox.Yes | QMessageBox.No) showPlusServerWidget = result == QMessageBox.Yes if _platform == "win32" or showPlusServerWidget: # Windows... plusServerCollapsibleButton = ctkCollapsibleButton() plusServerCollapsibleButton.text = "PlusServer" self.layout.addWidget(plusServerCollapsibleButton) self.configurationFileChooserButton = QPushButton( self.configurationFile) self.configurationFileChooserButton.connect( 'clicked()', self.onConfigFileSelected) self.runPlusServerButton = QPushButton("Run PlusServer") self.runPlusServerButton.setCheckable(True) self.runPlusServerButton.connect('clicked()', self.onRunPlusServerButtonClicked) self.serverFormLayout = QFormLayout(plusServerCollapsibleButton) self.serverExecutableChooserButton = QPushButton( self.serverExecutable) self.serverExecutableChooserButton.connect( 'clicked()', self.onServerExecutableSelected) hbox = QHBoxLayout() hbox.addWidget(self.serverExecutableChooserButton) self.serverFormLayout.addRow(hbox) hbox = QHBoxLayout() hbox.addWidget(self.configurationFileChooserButton) hbox.addWidget(self.runPlusServerButton) self.serverFormLayout.addRow(hbox) GuideletWidget.setup(self) # do specific setup here if _platform == "win32" or showPlusServerWidget: self.launchGuideletButton.setEnabled(False) self.checkExecutableAndArgument()
def __init__(self, interfazdato, cajadisponible): """Caja disponible son los elementos que aparecen a la izquierda en el selector""" #VARIABLES PUBLICAS QWidget.__init__(self, None, "selector", 0) image1 = QPixmap(IMAGE1DATA) image2 = QPixmap(IMAGE2DATA) selectorsimplelayout = QHBoxLayout(self, 11, 6, "WSelectorSimpleLayout") layout2 = QVBoxLayout(None, 0, 6, "layout2") widgetstack1 = QWidgetStack(self, "staaack") widgetstack1.addWidget(cajadisponible) widgetstack1.raiseWidget(cajadisponible) widgetstack1.setSizePolicy(QSizePolicy(\ QSizePolicy.Expanding, QSizePolicy.Expanding, \ 0, 0, widgetstack1.sizePolicy().hasHeightForWidth())) self._cajadisponible = cajadisponible layout2.addWidget(widgetstack1) selectorsimplelayout.addLayout(layout2) layout1 = QVBoxLayout(None, 0, 6, "layout1") self.__pushbutton1 = QPushButton(self, "pushButton1") self.__pushbutton1.setMaximumSize(QSize(30, 30)) self.__pushbutton1.setPixmap(image1) layout1.addWidget(self.__pushbutton1) spacer1 = QSpacerItem(30, 122, QSizePolicy.Minimum, QSizePolicy.Expanding) layout1.addItem(spacer1) self.__pushbutton2 = QPushButton(self,"pushButton2") self.__pushbutton2.setMaximumSize(QSize(30, 30)) self.__pushbutton2.setPixmap(image2) self.__pushbutton2.setAccel("Del") layout1.addWidget(self.__pushbutton2) selectorsimplelayout.addLayout(layout1) layout3 = QVBoxLayout(None, 0, 6, "layout3") self._textlabel2 = QLabel(self, "textLabel2") layout3.addWidget(self._textlabel2) self._cajaseleccion = QListBox(self,"cajaseleccion") self._cajaseleccion.setMinimumSize(QSize(0, 60)) layout3.addWidget(self._cajaseleccion) selectorsimplelayout.addLayout(layout3) self._cajaseleccion.setSizePolicy(QSizePolicy(\ QSizePolicy.Expanding,QSizePolicy.Expanding, 0, 0, \ self._cajaseleccion.sizePolicy().hasHeightForWidth())) self.setCaption("Form1") self._textlabel2.setText(u"Selección") self.resize(QSize(294, 240).expandedTo(self.minimumSizeHint())) self.clearWState(Qt.WState_Polished) self.__conexiones() #Miembros !qt self.seleccion = [] self._dato = interfazdato
def set_ref(self, in_json_path, lin_num): my_box = QVBoxLayout() self.my_inner_table = ReindexTable(self) cwd_path = os.path.join(sys_arg.directory, "dui_files") full_json_path = os.path.join(cwd_path, in_json_path) self.my_inner_table.add_opts_lst(json_path=full_json_path) if self.my_inner_table.rec_col is not None: my_solu = self.my_inner_table.find_best_solu() self.my_inner_table.opt_clicked(my_solu, 0) recomd_str = "Select a bravais lattice to enforce: \n" try: recomd_str += "(best guess solution = row {})".format( self.my_inner_table.tmp_sel + 1) except BaseException as e: # Since we don't know exactly what this was supposed to be # - AttributeError? We don't know how to cleanly catch logger.error("Unknown exception catch caught. Was: %s", e) recomd_str += "(no best solution could be automatically determined)" bot_box = QHBoxLayout() bot_box.addWidget(QLabel(recomd_str)) bot_box.addStretch() ok_but = QPushButton(" OK ") ok_but.clicked.connect(self.my_inner_table.ok_clicked) bot_box.addWidget(ok_but) heather_text, v_heather_size = heather_text_from_lin( lin_num, full_json_path) my_box.addWidget(QLabel(heather_text)) my_box.addWidget(self.my_inner_table) my_box.addLayout(bot_box) self.setLayout(my_box) n_col = self.my_inner_table.columnCount() tot_width = 80 for col in range(n_col): loc_width = self.my_inner_table.columnWidth(col) tot_width += loc_width n_row = self.my_inner_table.rowCount() row_height = self.my_inner_table.rowHeight(1) tot_heght = int((float(n_row)) * float(row_height)) tot_heght += int( (float(v_heather_size + 2)) * float(row_height * 0.62)) self.resize(tot_width, tot_heght) # self.adjustSize() self.show()
def setupFrameControlFrame(self): # TODO: initialize the slider based on the contents of the labels array self.frameSlider = ctk.ctkSliderWidget() self.frameLabel = QLabel('Current frame number') self.playButton = QPushButton('Play') self.playButton.toolTip = 'Iterate over multivolume frames' self.playButton.checkable = True frameControlHBox = QHBoxLayout() frameControlHBox.addWidget(self.frameLabel) frameControlHBox.addWidget(self.frameSlider) frameControlHBox.addWidget(self.playButton) self.inputFrameLayout.addRow(frameControlHBox)
def __init__(self, scene): QWidget.__init__(self) self.scene = scene decorateWindow(self, m18n("Scoring for this Hand")) self.nameLabels = [None] * 4 self.spValues = [None] * 4 self.windLabels = [None] * 4 self.wonBoxes = [None] * 4 self.detailsLayout = [None] * 4 self.details = [None] * 4 self.__tilePixMaps = [] self.__meldPixMaps = [] grid = QGridLayout(self) pGrid = QGridLayout() grid.addLayout(pGrid, 0, 0, 2, 1) pGrid.addWidget(QLabel(m18nc("kajongg", "Player")), 0, 0) pGrid.addWidget(QLabel(m18nc("kajongg", "Wind")), 0, 1) pGrid.addWidget(QLabel(m18nc("kajongg", "Score")), 0, 2) pGrid.addWidget(QLabel(m18n("Winner")), 0, 3) self.detailTabs = QTabWidget() self.detailTabs.setDocumentMode(True) pGrid.addWidget(self.detailTabs, 0, 4, 8, 1) for idx in range(4): self.setupUiForPlayer(pGrid, idx) self.draw = QCheckBox(m18nc("kajongg", "Draw")) self.draw.clicked.connect(self.wonChanged) btnPenalties = QPushButton(m18n("&Penalties")) btnPenalties.clicked.connect(self.penalty) self.btnSave = QPushButton(m18n("&Save Hand")) self.btnSave.clicked.connect(self.game.nextScoringHand) self.btnSave.setEnabled(False) self.setupUILastTileMeld(pGrid) pGrid.setRowStretch(87, 10) pGrid.addWidget(self.draw, 7, 3) self.cbLastTile.currentIndexChanged.connect(self.slotLastTile) self.cbLastMeld.currentIndexChanged.connect(self.slotInputChanged) btnBox = QHBoxLayout() btnBox.addWidget(btnPenalties) btnBox.addWidget(self.btnSave) pGrid.addLayout(btnBox, 8, 4) StateSaver(self) self.refresh()
def __init__(self, scene): QWidget.__init__(self) self.scene = scene decorateWindow(self, i18n('Scoring for this Hand')) self.nameLabels = [None] * 4 self.spValues = [None] * 4 self.windLabels = [None] * 4 self.wonBoxes = [None] * 4 self.detailsLayout = [None] * 4 self.details = [None] * 4 self.__tilePixMaps = [] self.__meldPixMaps = [] grid = QGridLayout(self) pGrid = QGridLayout() grid.addLayout(pGrid, 0, 0, 2, 1) pGrid.addWidget(QLabel(i18nc('kajongg', "Player")), 0, 0) pGrid.addWidget(QLabel(i18nc('kajongg', "Wind")), 0, 1) pGrid.addWidget(QLabel(i18nc('kajongg', 'Score')), 0, 2) pGrid.addWidget(QLabel(i18n("Winner")), 0, 3) self.detailTabs = QTabWidget() self.detailTabs.setDocumentMode(True) pGrid.addWidget(self.detailTabs, 0, 4, 8, 1) for idx in range(4): self.setupUiForPlayer(pGrid, idx) self.draw = QCheckBox(i18nc('kajongg', 'Draw')) self.draw.clicked.connect(self.wonChanged) btnPenalties = QPushButton(i18n("&Penalties")) btnPenalties.clicked.connect(self.penalty) self.btnSave = QPushButton(i18n('&Save Hand')) self.btnSave.clicked.connect(self.game.nextScoringHand) self.btnSave.setEnabled(False) self.setupUILastTileMeld(pGrid) pGrid.setRowStretch(87, 10) pGrid.addWidget(self.draw, 7, 3) self.cbLastTile.currentIndexChanged.connect(self.slotLastTile) self.cbLastMeld.currentIndexChanged.connect(self.slotInputChanged) btnBox = QHBoxLayout() btnBox.addWidget(btnPenalties) btnBox.addWidget(self.btnSave) pGrid.addLayout(btnBox, 8, 4) StateSaver(self) self.refresh()
def __init__(self, parent=None): super(RefineBravaiSimplerParamTab, self).__init__() localLayout = QVBoxLayout() hbox_lay_outlier_algorithm = QHBoxLayout() label_outlier_algorithm = QLabel("Outlier rejection algorithm") hbox_lay_outlier_algorithm.addWidget(label_outlier_algorithm) box_outlier_algorithm = DefaultComboBox( "refinement.reflections.outlier.algorithm", ["null", "Auto", "mcd", "tukey", "sauter_poon"], default_index=1) box_outlier_algorithm.currentIndexChanged.connect( self.combobox_changed) hbox_lay_outlier_algorithm.addWidget(box_outlier_algorithm) localLayout.addLayout(hbox_lay_outlier_algorithm) self.inner_reset_btn = ResetButton() localLayout.addWidget(self.inner_reset_btn) localLayout.addStretch() self.setLayout(localLayout) self.lst_var_widg = [] self.lst_var_widg.append(box_outlier_algorithm) self.lst_var_widg.append(label_outlier_algorithm)
def __init__(self, parent=None): super(SymmetrySimplerParamTab, self).__init__() hbox_d_min = QHBoxLayout() localLayout = QVBoxLayout() label_d_min = QLabel("d_min") hbox_d_min.addWidget(label_d_min) d_min_spn_bx = QDoubleSpinBox() d_min_spn_bx.local_path = "d_min" d_min_spn_bx.setSpecialValueText("Auto") d_min_spn_bx.setValue(0.0) hbox_d_min.addWidget(d_min_spn_bx) d_min_spn_bx.valueChanged.connect(self.spnbox_changed) localLayout.addLayout(hbox_d_min) self.inner_reset_btn = ResetButton() localLayout.addWidget(self.inner_reset_btn) localLayout.addStretch() self.setLayout(localLayout) self.lst_var_widg = [] self.lst_var_widg.append(d_min_spn_bx) self.lst_var_widg.append(label_d_min)
def __init__(self, phl_obj=None, parent=None): super(IndexSimplerParamTab, self).__init__() # self.param_widget_parent = parent.param_widget_parent # indexing_method_check = QCheckBox("indexing.method") hbox_method = QHBoxLayout() label_method_62 = QLabel("Indexing Method") hbox_method.addWidget(label_method_62) box_method_62 = QComboBox() box_method_62.tmp_lst = [] box_method_62.local_path = "indexing.method" box_method_62.tmp_lst.append("fft3d") box_method_62.tmp_lst.append("fft1d") box_method_62.tmp_lst.append("real_space_grid_search") box_method_62.tmp_lst.append("low_res_spot_match") for lst_itm in box_method_62.tmp_lst: box_method_62.addItem(lst_itm) box_method_62.currentIndexChanged.connect(self.combobox_changed) hbox_method.addWidget(box_method_62) localLayout = QVBoxLayout() localLayout.addLayout(hbox_method) self.inner_reset_btn = ResetButton() localLayout.addWidget(self.inner_reset_btn) localLayout.addStretch() self.setLayout(localLayout) self.lst_var_widg = _get_all_direct_layout_widget_children(localLayout)
def __init__(self, parent): super(TilesetSelector, self).__init__(parent) loadUi(self) self.kcfg_tilesetName = QLineEdit(self) self.kcfg_tilesetName.setVisible(False) self.kcfg_tilesetName.setObjectName('kcfg_tilesetName') self.tileScene = SceneWithFocusRect() self.tileView = FittingView() self.tileView.setScene(self.tileScene) self.tileset = Tileset(Internal.Preferences.tilesetName) self.uiTiles = [UITile('w' + s.char.lower()) for s in Wind.all4] self.board = Board(2, 2, self.tileset) self.board.showShadows = True self.tileScene.addItem(self.board) self.tileView.setParent(self.tilesetPreview) layout = QHBoxLayout(self.tilesetPreview) layout.addWidget(self.tileView) for idx, offsets in enumerate([(0, 0), (0, 1), (1, 0), (1, 1)]): self.uiTiles[idx].setBoard(self.board, *offsets) self.uiTiles[idx].focusable = False self.setUp()
def __init__(self, phl_obj=None, parent=None): super(IndexSimplerParamTab, self).__init__() # self.param_widget_parent = parent.param_widget_parent # indexing_method_check = QCheckBox("indexing.method") hbox_method = QHBoxLayout() label_method_62 = QLabel("Indexing method") hbox_method.addWidget(label_method_62) box_method_62 = DefaultComboBox( "indexing.method", ["fft3d", "fft1d", "real_space_grid_search", "low_res_spot_match"]) box_method_62.currentIndexChanged.connect(self.combobox_changed) hbox_method.addWidget(box_method_62) max_cell_label = QLabel("Max cell") max_cell_spn_bx = QDoubleSpinBox() max_cell_spn_bx.setSingleStep(5.0) max_cell_spn_bx.local_path = "indexing.max_cell" max_cell_spn_bx.setSpecialValueText("Auto") max_cell_spn_bx.editingFinished.connect(self.spnbox_finished) space_group_label = QLabel("Space group") space_group_line = QLineEdit() # Simple validator to allow only characters in H-M symbols regex = QRegExp("[ABCPIFR][0-9a-d\-/:nmHR]+") validatorHM = QRegExpValidator(regex) space_group_line.setValidator(validatorHM) space_group_line.local_path = "indexing.known_symmetry.space_group" space_group_line.editingFinished.connect(self.line_changed) unit_cell_label = QLabel("Unit cell") unit_cell_line = QLineEdit() regex = QRegExp("[0-9\., ]+") validatorUC = QRegExpValidator(regex) unit_cell_line.setValidator(validatorUC) unit_cell_line.local_path = "indexing.known_symmetry.unit_cell" unit_cell_line.editingFinished.connect(self.line_changed) localLayout = QVBoxLayout() localLayout.addLayout(hbox_method) qf = QFormLayout() qf.addRow(max_cell_label, max_cell_spn_bx) qf.addRow(space_group_label, space_group_line) qf.addRow(unit_cell_label, unit_cell_line) localLayout.addLayout(qf) self.inner_reset_btn = ResetButton() localLayout.addWidget(self.inner_reset_btn) localLayout.addStretch() self.setLayout(localLayout) self.lst_var_widg = _get_all_direct_layout_widget_children(localLayout)
def __init__(self, parent=None): super(StopRunRetry, self).__init__() main_path = get_main_path() ctrl_box = QHBoxLayout() self.repeat_btn = QPushButton("\n Retry \n", self) re_try_icon_path = str(main_path + "/resources/re_try.png") re_try_grayed_path = str(main_path + "/resources/re_try_grayed.png") tmp_ico = QIcon() tmp_ico.addFile(re_try_icon_path, mode=QIcon.Normal) tmp_ico.addFile(re_try_grayed_path, mode=QIcon.Disabled) self.repeat_btn.setIcon(tmp_ico) self.repeat_btn.setIconSize(QSize(50, 38)) ctrl_box.addWidget(self.repeat_btn) self.run_btn = QPushButton("\n Run \n", self) self.dials_logo_path = str( main_path + "/resources/DIALS_Logo_smaller_centred.png" ) dials_grayed_path = str( main_path + "/resources/DIALS_Logo_smaller_centred_grayed.png" ) tmp_ico = QIcon() tmp_ico.addFile(self.dials_logo_path, mode=QIcon.Normal) tmp_ico.addFile(dials_grayed_path, mode=QIcon.Disabled) self.run_btn.setIcon(tmp_ico) self.run_btn.setIconSize(QSize(50, 50)) ctrl_box.addWidget(self.run_btn) self.stop_btn = QPushButton("\n Stop \n", self) stop_logo_path = str(main_path + "/resources/stop.png") stop_grayed_path = str(main_path + "/resources/stop_grayed.png") tmp_ico = QIcon() tmp_ico.addFile(stop_logo_path, mode=QIcon.Normal) tmp_ico.addFile(stop_grayed_path, mode=QIcon.Disabled) self.stop_btn.setIcon(tmp_ico) self.stop_btn.setIconSize(QSize(50, 38)) ctrl_box.addWidget(self.stop_btn) self.setLayout(ctrl_box)
def setupUi(self): """layout the window""" decorateWindow(self, i18n('Customize rulesets')) self.setObjectName('Rulesets') hlayout = QHBoxLayout(self) v1layout = QVBoxLayout() self.v1widget = QWidget() v1layout = QVBoxLayout(self.v1widget) v2layout = QVBoxLayout() hlayout.addWidget(self.v1widget) hlayout.addLayout(v2layout) for widget in [self.v1widget, hlayout, v1layout, v2layout]: widget.setContentsMargins(0, 0, 0, 0) hlayout.setStretchFactor(self.v1widget, 10) self.btnCopy = QPushButton() self.btnRemove = QPushButton() self.btnCompare = QPushButton() self.btnClose = QPushButton() self.rulesetView = RuleTreeView( i18ncE('kajongg', 'Rule'), self.btnCopy, self.btnRemove, self.btnCompare) v1layout.addWidget(self.rulesetView) self.rulesetView.setWordWrap(True) self.rulesetView.setMouseTracking(True) spacerItem = QSpacerItem( 20, 20, QSizePolicy.Minimum, QSizePolicy.Expanding) v2layout.addWidget(self.btnCopy) v2layout.addWidget(self.btnRemove) v2layout.addWidget(self.btnCompare) self.btnCopy.clicked.connect(self.rulesetView.copyRow) self.btnRemove.clicked.connect(self.rulesetView.removeRow) self.btnCompare.clicked.connect(self.rulesetView.compareRow) self.btnClose.clicked.connect(self.hide) v2layout.addItem(spacerItem) v2layout.addWidget(self.btnClose) self.retranslateUi() StateSaver(self) self.show()
def setupFrameControlFrame(self): qSlicerMultiVolumeExplorerSimplifiedModuleWidget.setupFrameControlFrame(self) self.frameCopySelector = slicer.qMRMLNodeComboBox() self.frameCopySelector.nodeTypes = ['vtkMRMLScalarVolumeNode'] self.frameCopySelector.setMRMLScene(slicer.mrmlScene) self.frameCopySelector.addEnabled = 1 self.frameCopySelector.enabled = 0 # do not show "children" of vtkMRMLScalarVolumeNode self.frameCopySelector.hideChildNodeTypes = ["vtkMRMLDiffusionWeightedVolumeNode", "vtkMRMLDiffusionTensorVolumeNode", "vtkMRMLVectorVolumeNode"] self.extractFrameCopy = False self.extractFrameCheckBox = QCheckBox('Enable copying') hbox = QHBoxLayout() hbox.addWidget(QLabel('Current frame copy')) hbox.addWidget(self.frameCopySelector) hbox.addWidget(self.extractFrameCheckBox) self.inputFrameLayout.addRow(hbox)
def __init__(self, parent=None): super(Games, self).__init__(parent) self.selectedGame = None self.onlyPending = True decorateWindow(self, i18nc('kajongg', 'Games')) self.setObjectName('Games') self.resize(700, 400) self.model = GamesModel() if Debug.modelTest: self.modelTest = ModelTest(self.model, self) self.view = MJTableView(self) self.view.setModel(self.model) self.selection = QItemSelectionModel(self.model, self.view) self.view.setSelectionModel(self.selection) self.view.setSelectionBehavior(QAbstractItemView.SelectRows) self.view.setSelectionMode(QAbstractItemView.SingleSelection) self.buttonBox = QDialogButtonBox(self) self.buttonBox.setStandardButtons(QDialogButtonBox.Cancel) self.newButton = self.buttonBox.addButton( i18nc('start a new game', "&New"), QDialogButtonBox.ActionRole) self.newButton.setIcon(KIcon("document-new")) self.newButton.clicked.connect(self.accept) self.loadButton = self.buttonBox.addButton( i18n("&Load"), QDialogButtonBox.AcceptRole) self.loadButton.clicked.connect(self.loadGame) self.loadButton.setIcon(KIcon("document-open")) self.deleteButton = self.buttonBox.addButton( i18n("&Delete"), QDialogButtonBox.ActionRole) self.deleteButton.setIcon(KIcon("edit-delete")) self.deleteButton.clicked.connect(self.delete) chkPending = QCheckBox(i18n("Show only pending games"), self) chkPending.setChecked(True) cmdLayout = QHBoxLayout() cmdLayout.addWidget(chkPending) cmdLayout.addWidget(self.buttonBox) layout = QVBoxLayout() layout.addWidget(self.view) layout.addLayout(cmdLayout) self.setLayout(layout) StateSaver(self) self.selection.selectionChanged.connect(self.selectionChanged) self.buttonBox.accepted.connect(self.accept) self.buttonBox.rejected.connect(self.reject) self.view.doubleClicked.connect(self.loadGame) chkPending.stateChanged.connect(self.pendingOrNot)
def setup(self): showPlusServerWidget = True if _platform == "linux" or _platform == "linux2" or _platform == "darwin": #linux or linux or OS X message = "Attention: You are running Slicer on Linux or OS X. Do you have PlusServer installed on the current OS?" result = QMessageBox.question(slicer.util.mainWindow(), 'ProstateTRUSNav', message, QMessageBox.Yes | QMessageBox.No) showPlusServerWidget = result == QMessageBox.Yes if _platform == "win32" or showPlusServerWidget: # Windows... plusServerCollapsibleButton = ctkCollapsibleButton() plusServerCollapsibleButton.text = "PlusServer" self.layout.addWidget(plusServerCollapsibleButton) self.configurationFileChooserButton = QPushButton(self.configurationFile) self.configurationFileChooserButton.connect('clicked()', self.onConfigFileSelected) self.runPlusServerButton = QPushButton("Run PlusServer") self.runPlusServerButton.setCheckable(True) self.runPlusServerButton.connect('clicked()', self.onRunPlusServerButtonClicked) self.serverFormLayout = QFormLayout(plusServerCollapsibleButton) self.serverExecutableChooserButton = QPushButton(self.serverExecutable) self.serverExecutableChooserButton.connect('clicked()', self.onServerExecutableSelected) hbox = QHBoxLayout() hbox.addWidget(self.serverExecutableChooserButton) self.serverFormLayout.addRow(hbox) hbox = QHBoxLayout() hbox.addWidget(self.configurationFileChooserButton) hbox.addWidget(self.runPlusServerButton) self.serverFormLayout.addRow(hbox) GuideletWidget.setup(self) # do specific setup here if _platform == "win32" or showPlusServerWidget: self.launchGuideletButton.setEnabled(False) self.checkExecutableAndArgument()
def setupUi(self): """layout the window""" decorateWindow(self, m18n('Customize rulesets')) self.setObjectName('Rulesets') hlayout = QHBoxLayout(self) v1layout = QVBoxLayout() self.v1widget = QWidget() v1layout = QVBoxLayout(self.v1widget) v2layout = QVBoxLayout() hlayout.addWidget(self.v1widget) hlayout.addLayout(v2layout) for widget in [self.v1widget, hlayout, v1layout, v2layout]: widget.setContentsMargins(0, 0, 0, 0) hlayout.setStretchFactor(self.v1widget, 10) self.btnCopy = QPushButton() self.btnRemove = QPushButton() self.btnCompare = QPushButton() self.btnClose = QPushButton() self.rulesetView = RuleTreeView( m18nc('kajongg', 'Rule'), self.btnCopy, self.btnRemove, self.btnCompare) v1layout.addWidget(self.rulesetView) self.rulesetView.setWordWrap(True) self.rulesetView.setMouseTracking(True) spacerItem = QSpacerItem( 20, 20, QSizePolicy.Minimum, QSizePolicy.Expanding) v2layout.addWidget(self.btnCopy) v2layout.addWidget(self.btnRemove) v2layout.addWidget(self.btnCompare) self.btnCopy.clicked.connect(self.rulesetView.copyRow) self.btnRemove.clicked.connect(self.rulesetView.removeRow) self.btnCompare.clicked.connect(self.rulesetView.compareRow) self.btnClose.clicked.connect(self.hide) v2layout.addItem(spacerItem) v2layout.addWidget(self.btnClose) self.retranslateUi() StateSaver(self) self.show()
def __init__(self, phl_obj=None, parent=None): super(ParamAdvancedWidget, self).__init__() self.scrollable_widget = PhilWidget(phl_obj, parent=self) scrollArea = QScrollArea() scrollArea.setWidget(self.scrollable_widget) vbox = QVBoxLayout() search_label = QLabel("Search:") search_edit = QLineEdit() search_edit.setPlaceholderText("Type search here") search_edit.textChanged.connect(self.scrollable_widget.user_searching) self.search_next_button = QPushButton("Find next") self.search_next_button.setEnabled(False) hbox = QHBoxLayout() hbox.addWidget(search_label) hbox.addWidget(search_edit) hbox.addWidget(self.search_next_button) self.search_next_button.clicked.connect(self.scrollable_widget.find_next) vbox.addLayout(hbox) vbox.addWidget(scrollArea) self.setLayout(vbox)
def setupUi(self): """layout the window""" self.setContentsMargins(0, 0, 0, 0) vlayout = QVBoxLayout(self) vlayout.setContentsMargins(0, 0, 0, 0) sliderLayout = QHBoxLayout() self.kcfg_showShadows = QCheckBox(i18n('Show tile shadows'), self) self.kcfg_showShadows.setObjectName('kcfg_showShadows') self.kcfg_rearrangeMelds = QCheckBox( i18n('Rearrange undisclosed tiles to melds'), self) self.kcfg_rearrangeMelds.setObjectName('kcfg_rearrangeMelds') self.kcfg_showOnlyPossibleActions = QCheckBox( i18n('Show only possible actions')) self.kcfg_showOnlyPossibleActions.setObjectName( 'kcfg_showOnlyPossibleActions') self.kcfg_propose = QCheckBox(i18n('Propose what to do')) self.kcfg_propose.setObjectName('kcfg_propose') self.kcfg_animationSpeed = QSlider(self) self.kcfg_animationSpeed.setObjectName('kcfg_animationSpeed') self.kcfg_animationSpeed.setOrientation(Qt.Horizontal) self.kcfg_animationSpeed.setSingleStep(1) lblSpeed = QLabel(i18n('Animation speed:')) lblSpeed.setBuddy(self.kcfg_animationSpeed) sliderLayout.addWidget(lblSpeed) sliderLayout.addWidget(self.kcfg_animationSpeed) self.kcfg_useSounds = QCheckBox(i18n('Use sounds if available'), self) self.kcfg_useSounds.setObjectName('kcfg_useSounds') self.kcfg_uploadVoice = QCheckBox(i18n('Let others hear my voice'), self) self.kcfg_uploadVoice.setObjectName('kcfg_uploadVoice') pol = QSizePolicy() pol.setHorizontalPolicy(QSizePolicy.Expanding) pol.setVerticalPolicy(QSizePolicy.Expanding) spacerItem = QSpacerItem(20, 20, QSizePolicy.Minimum, QSizePolicy.Expanding) vlayout.addWidget(self.kcfg_showShadows) vlayout.addWidget(self.kcfg_rearrangeMelds) vlayout.addWidget(self.kcfg_showOnlyPossibleActions) vlayout.addWidget(self.kcfg_propose) vlayout.addWidget(self.kcfg_useSounds) vlayout.addWidget(self.kcfg_uploadVoice) vlayout.addLayout(sliderLayout) vlayout.addItem(spacerItem) self.setSizePolicy(pol) self.retranslateUi()
def __init__(self, phl_obj=None, parent=None): super(ParamAdvancedWidget, self).__init__() self.scrollable_widget = PhilWidget(phl_obj, parent=self) scrollArea = QScrollArea() scrollArea.setWidget(self.scrollable_widget) vbox = QVBoxLayout() search_label = QLabel("search:") search_edit = QLineEdit("type search here") search_edit.textChanged.connect(self.scrollable_widget.user_searching) hbox = QHBoxLayout() hbox.addWidget(search_label) hbox.addWidget(search_edit) vbox.addLayout(hbox) vbox.addWidget(scrollArea) self.setLayout(vbox)
def __init__(self, app, parent, profile): KMainWindow.__init__(self, parent, 'TraitAssigner') self.page = QFrame(self) self.vbox = QVBoxLayout(self.page, 5, 7) self.listBox = KActionSelector(self.page) self.listBox.setShowUpDownButtons(True) self.setCentralWidget(self.page) self.vbox.addWidget(self.listBox) hbox = QHBoxLayout(self.page, 5, 7) self.vbox.addLayout(hbox) self.ok_button = KPushButton('ok', self.page) self.cancel_button = KPushButton('cancel', self.page) hbox.addWidget(self.ok_button) hbox.addWidget(self.cancel_button) self.app = app self.db = app.db self.profile = Profile(app.conn) self.profile.set_profile(profile) self.suite = self.profile.current.suite self.traits = StatementCursor(app.conn) self.traits.set_table('%s_traits' % self.suite) self.initlistView() self.show()
def __init__(self, parent=None): super(RefineBravaiSimplerParamTab, self).__init__() localLayout = QVBoxLayout() hbox_lay_outlier_algorithm = QHBoxLayout() label_outlier_algorithm = QLabel("Outlier Rejection Algorithm") hbox_lay_outlier_algorithm.addWidget(label_outlier_algorithm) box_outlier_algorithm = QComboBox() box_outlier_algorithm.local_path = "refinement.reflections.outlier.algorithm" box_outlier_algorithm.tmp_lst = [] box_outlier_algorithm.tmp_lst.append("null") box_outlier_algorithm.tmp_lst.append("auto") box_outlier_algorithm.tmp_lst.append("mcd") box_outlier_algorithm.tmp_lst.append("tukey") box_outlier_algorithm.tmp_lst.append("sauter_poon") for lst_itm in box_outlier_algorithm.tmp_lst: box_outlier_algorithm.addItem(lst_itm) box_outlier_algorithm.setCurrentIndex(1) box_outlier_algorithm.currentIndexChanged.connect( self.combobox_changed) hbox_lay_outlier_algorithm.addWidget(box_outlier_algorithm) localLayout.addLayout(hbox_lay_outlier_algorithm) self.inner_reset_btn = ResetButton() localLayout.addWidget(self.inner_reset_btn) localLayout.addStretch() self.setLayout(localLayout) self.lst_var_widg = [] self.lst_var_widg.append(box_outlier_algorithm) self.lst_var_widg.append(label_outlier_algorithm)
def __init__(self): super(MainWidget, self).__init__() self.my_pop = None # Any child popup windows. Only bravais_table ATM self.storage_path = sys_arg.directory refresh_gui = False # Load the previous state of DUI, if present dui_files_path = os.path.join(self.storage_path, "dui_files") if os.path.isfile(os.path.join(dui_files_path, "bkp.pickle")): try: self.idials_runner = load_previous_state(dui_files_path) except Exception as e: # Something went wrong - tell the user then close msg = traceback.format_exc() logger.error("ERROR LOADING PREVIOUS DATA:\n%s", msg) raise_from(DUIDataLoadingError(msg), e) refresh_gui = True else: # No dui_files path - start with a fresh state if not os.path.isdir(dui_files_path): os.mkdir(dui_files_path) self.idials_runner = Runner() self.gui2_log = {"pairs_list": []} self.cli_tree_output = TreeShow() self.cli_tree_output(self.idials_runner) self.cur_html = None self.cur_pick = None self.cur_json = None self.cur_log = None self.cur_cmd_name = "None" main_box = QVBoxLayout() self.centre_par_widget = ControlWidget() self.centre_par_widget.pass_sys_arg_object_to_import(sys_arg) self.stop_run_retry = StopRunRetry() self.tree_out = TreeNavWidget() left_control_box = QHBoxLayout() left_top_control_box = QVBoxLayout() left_top_control_box.addWidget(self.centre_par_widget) left_top_control_box.addStretch() left_control_box.addLayout(left_top_control_box) centre_control_box = QVBoxLayout() v_control_splitter = QSplitter() v_control_splitter.setOrientation(Qt.Vertical) v_control_splitter.addWidget(self.tree_out) v_control_splitter.addWidget(self.centre_par_widget.step_param_widg) centre_control_box.addWidget(v_control_splitter) centre_control_box.addWidget(self.stop_run_retry) left_control_box.addLayout(centre_control_box) dummy_left_widget = QWidget() dummy_h_layout = QHBoxLayout() dummy_h_layout.addLayout(left_control_box) dummy_left_widget.setLayout(dummy_h_layout) dummy_left_widget.setSizePolicy(QSizePolicy.Expanding, QSizePolicy.Expanding) h_main_splitter = QSplitter() h_main_splitter.setOrientation(Qt.Horizontal) h_main_splitter.addWidget(dummy_left_widget) self.cli_out = CliOutView() self.web_view = WebTab() self.img_view = MyImgWin() self.ext_view = OuterCaller() self.info_widget = InfoWidget() self.output_info_tabs = QTabWidget() self.output_info_tabs.addTab(self.img_view, "Image") self.output_info_tabs.addTab(self.cli_out, "Log") self.output_info_tabs.addTab(self.web_view, "Report") self.output_info_tabs.addTab(self.ext_view, "Tools") self.output_info_tabs.addTab(self.info_widget, "Experiment") self.view_tab_num = 0 self.output_info_tabs.currentChanged.connect(self.tab_changed) self.img_view.mask_applied.connect(self.pop_mask_list) self.img_view.predic_changed.connect(self.tab_changed) self.img_view.bc_applied.connect(self.pop_b_centr_coord) self.img_view.new_pars_applied.connect(self.pass_parmams) # self.ext_view.pass_parmam_lst.connect(self.pass_parmams) self.centre_par_widget.finished_masking.connect(self.img_view.unchec_my_mask) self.centre_par_widget.click_mask.connect(self.img_view.chec_my_mask) self.centre_par_widget.finished_b_centr.connect(self.img_view.unchec_b_centr) self.centre_par_widget.click_b_centr.connect(self.img_view.chec_b_centr) v_info_splitter = QSplitter() v_info_splitter.setOrientation(Qt.Vertical) v_info_splitter.addWidget(self.output_info_tabs) h_main_splitter.addWidget(v_info_splitter) main_box.addWidget(h_main_splitter) self.txt_bar = Text_w_Bar() main_box.addWidget(self.txt_bar) self.connect_all() self.custom_thread = CommandThread() self.custom_thread.finished.connect(self.update_after_finished) self.custom_thread.str_fail_signal.connect(self.after_failed) self.custom_thread.str_print_signal.connect(self.cli_out.add_txt) self.custom_thread.str_print_signal.connect(self.txt_bar.setText) self.custom_thread.busy_box_on.connect(self.pop_busy_box) self.custom_thread.busy_box_off.connect(self.close_busy_box) self.main_widget = QWidget() self.main_widget.setLayout(main_box) self.setCentralWidget(self.main_widget) self.setWindowTitle("CCP4 DUI - {}: {}".format(__version__, dui_files_path)) self.setWindowIcon(QIcon(self.stop_run_retry.dials_logo_path)) self.just_reindexed = False self.user_stoped = False self.reconnect_when_ready() self.my_pop = None if refresh_gui: self.refresh_my_gui()
def __init__(self, leftRulesets, rightRulesets, parent=None): QDialog.__init__(self, parent) if not isinstance(leftRulesets, list): leftRulesets = list([leftRulesets]) if not isinstance(rightRulesets, list): rightRulesets = list([rightRulesets]) leftRulesets, rightRulesets = leftRulesets[:], rightRulesets[:] # remove rulesets from right which are also on the left side for left in leftRulesets: left.load() for right in rightRulesets: right.load() for left in leftRulesets: for right in rightRulesets[:]: if left == right and left.name == right.name: # rightRulesets.remove(right) this is wrong because it # removes the first ruleset with the same hash rightRulesets = list( x for x in rightRulesets if id(x) != id(right)) self.leftRulesets = leftRulesets self.rightRulesets = rightRulesets self.model = None self.modelTest = None self.view = MJTableView(self) self.buttonBox = QDialogButtonBox() self.buttonBox.setStandardButtons(QDialogButtonBox.Ok) self.buttonBox.accepted.connect(self.accept) self.buttonBox.rejected.connect(self.reject) cbLayout = QHBoxLayout() self.cbRuleset1 = ListComboBox(self.leftRulesets) if len(self.leftRulesets) == 1: self.lblRuleset1 = QLabel(self.leftRulesets[0].name) cbLayout.addWidget(self.lblRuleset1) else: cbLayout.addWidget(self.cbRuleset1) self.cbRuleset2 = ListComboBox(self.rightRulesets) cbLayout.addWidget(self.cbRuleset2) cmdLayout = QHBoxLayout() cmdLayout.addWidget(self.buttonBox) layout = QVBoxLayout() layout.addLayout(cbLayout) layout.addWidget(self.view) layout.addLayout(cmdLayout) self.setLayout(layout) decorateWindow(self, i18n("Compare")) self.setObjectName('RulesetDiffer') self.cbRuleset1.currentIndexChanged.connect(self.leftRulesetChanged) self.cbRuleset2.currentIndexChanged.connect(self.rulesetChanged) self.leftRulesetChanged() StateSaver(self)
def setupPlotSettingsFrame(self): self.plotSettingsFrame = ctk.ctkCollapsibleButton() self.plotSettingsFrame.text = "Plotting Settings" self.plotSettingsFrame.collapsed = 1 plotSettingsFrameLayout = QFormLayout(self.plotSettingsFrame) self.layout.addWidget(self.plotSettingsFrame) # label map for probing self.labelMapSelector = slicer.qMRMLNodeComboBox() self.labelMapSelector.nodeTypes = ['vtkMRMLLabelMapVolumeNode'] self.labelMapSelector.toolTip = 'Label map to be probed' self.labelMapSelector.setMRMLScene(slicer.mrmlScene) self.labelMapSelector.addEnabled = 0 self.chartButton = QPushButton('Chart') self.chartButton.setEnabled(False) hbox = QHBoxLayout() hbox.addWidget(QLabel('Probed label volume')) hbox.addWidget(self.labelMapSelector) hbox.addWidget(self.chartButton) plotSettingsFrameLayout.addRow(hbox) self.iCharting = QCheckBox('Interactive charting') self.iCharting.setChecked(True) plotSettingsFrameLayout.addRow(self.iCharting) self.iChartingMode = QButtonGroup() self.iChartingIntensity = QRadioButton('Signal intensity') self.iChartingIntensityFixedAxes = QRadioButton('Fixed range intensity') self.iChartingPercent = QRadioButton('Percentage change') self.iChartingIntensity.setChecked(1) self.iChartingMode.addButton(self.iChartingIntensity) self.iChartingMode.addButton(self.iChartingIntensityFixedAxes) self.iChartingMode.addButton(self.iChartingPercent) hbox = QHBoxLayout() self.plottingModeGroupBox = QGroupBox('Plotting mode:') plottingModeLayout = QVBoxLayout() self.plottingModeGroupBox.setLayout(plottingModeLayout) plottingModeLayout.addWidget(self.iChartingIntensity) plottingModeLayout.addWidget(self.iChartingIntensityFixedAxes) plottingModeLayout.addWidget(self.iChartingPercent) hbox.addWidget(self.plottingModeGroupBox) self.showLegendCheckBox = QCheckBox('Display legend') self.showLegendCheckBox.setChecked(0) self.xLogScaleCheckBox = QCheckBox('Use log scale for X axis') self.xLogScaleCheckBox.setChecked(0) self.yLogScaleCheckBox = QCheckBox('Use log scale for Y axis') self.yLogScaleCheckBox.setChecked(0) self.plotGeneralSettingsGroupBox = QGroupBox('General Plot options:') plotGeneralSettingsLayout = QVBoxLayout() self.plotGeneralSettingsGroupBox.setLayout(plotGeneralSettingsLayout) plotGeneralSettingsLayout.addWidget(self.showLegendCheckBox) plotGeneralSettingsLayout.addWidget(self.xLogScaleCheckBox) plotGeneralSettingsLayout.addWidget(self.yLogScaleCheckBox) hbox.addWidget(self.plotGeneralSettingsGroupBox) plotSettingsFrameLayout.addRow(hbox) self.nFramesBaselineCalculation = QSpinBox() self.nFramesBaselineCalculation.minimum = 1 hbox = QHBoxLayout() hbox.addWidget(QLabel('Frame count(baseline calculation):')) hbox.addWidget(self.nFramesBaselineCalculation) plotSettingsFrameLayout.addRow(hbox)
def setupFrameControlFrame(self): qSlicerMultiVolumeExplorerSimplifiedModuleWidget.setupFrameControlFrame(self) self.frameCopySelector = slicer.qMRMLNodeComboBox() self.frameCopySelector.setSizePolicy(QSizePolicy.Ignored, QSizePolicy.Preferred) self.frameCopySelector.nodeTypes = ['vtkMRMLScalarVolumeNode'] self.frameCopySelector.setMRMLScene(slicer.mrmlScene) self.frameCopySelector.addEnabled = 1 self.frameCopySelector.enabled = 0 # do not show "children" of vtkMRMLScalarVolumeNode self.frameCopySelector.hideChildNodeTypes = ["vtkMRMLDiffusionWeightedVolumeNode", "vtkMRMLDiffusionTensorVolumeNode", "vtkMRMLVectorVolumeNode"] self.extractFrameCopy = False self.extractFrameCheckBox = QCheckBox('Enable copying while sliding') hbox = QHBoxLayout() hbox.addWidget(QLabel('Current frame copy')) hbox.addWidget(self.frameCopySelector) hbox.addWidget(self.extractFrameCheckBox) self.inputFrameLayout.addRow(hbox) self.currentFrameCopySelector = slicer.qMRMLNodeComboBox() self.currentFrameCopySelector.setSizePolicy(QSizePolicy.Ignored, QSizePolicy.Preferred) self.currentFrameCopySelector.nodeTypes = ['vtkMRMLScalarVolumeNode'] self.currentFrameCopySelector.setMRMLScene(slicer.mrmlScene) self.currentFrameCopySelector.addEnabled = 0 self.currentFrameCopySelector.enabled = 0 self.currentFrameCopyButton = QPushButton('Copy frame') self.currentFrameCopyButton.toolTip = 'Copy currently selected frame' hbox2 = QHBoxLayout() hbox2.addWidget(QLabel('Current frame click-to-copy')) hbox2.addWidget(self.currentFrameCopySelector) hbox2.addWidget(self.currentFrameCopyButton) self.inputFrameLayout.addRow(hbox2)
def __init__(self, parent=None): super(InfoWidget, self).__init__() empty_str = "__________" beam_group = QGroupBox(" Beam ") bm_v_layout = QVBoxLayout() bm_v_layout.addLayout(get_spacebox(130)) xb_label = QLabel(" X (mm) ") yb_label = QLabel(" Y (mm) ") bm_label_a_layout = QHBoxLayout() bm_label_a_layout.addWidget(xb_label) bm_label_a_layout.addWidget(yb_label) bm_v_layout.addLayout(bm_label_a_layout) self.xb_data = QLabel(empty_str) self.yb_data = QLabel(empty_str) bm_data_layout = QHBoxLayout() bm_data_layout.addWidget(self.xb_data) bm_data_layout.addWidget(self.yb_data) bm_v_layout.addLayout(bm_data_layout) bm_v_layout.addWidget(QLabel(" ")) tmp_str = " Wavelength (" + u"\u212B" + ") " w_lambda_label = QLabel(tmp_str) bm_v_layout.addWidget(w_lambda_label) self.w_lambda_data = QLabel(empty_str) bm_v_layout.addWidget(self.w_lambda_data) # bm_v_layout.addWidget(QLabel(" ")) # bm_v_layout.addStretch() beam_group.setLayout(bm_v_layout) cell_group = QGroupBox(" Crystal ") cell_v_layout = QVBoxLayout() cell_v_layout.addLayout(get_spacebox(160)) a_label = QLabel(" a ") b_label = QLabel(" b ") c_label = QLabel(" c ") cell_label_d_layout = QHBoxLayout() cell_label_d_layout.addWidget(a_label) cell_label_d_layout.addWidget(b_label) cell_label_d_layout.addWidget(c_label) cell_v_layout.addLayout(cell_label_d_layout) self.a_data = QLabel(empty_str) self.b_data = QLabel(empty_str) self.c_data = QLabel(empty_str) cell_data_layout = QHBoxLayout() cell_data_layout.addWidget(self.a_data) cell_data_layout.addWidget(self.b_data) cell_data_layout.addWidget(self.c_data) cell_v_layout.addLayout(cell_data_layout) cell_v_layout.addWidget(QLabel(" ")) left_margin_str = " " alpha_str = left_margin_str + u"\u03B1" beta_str = left_margin_str + u"\u03B2" gamma_str = left_margin_str + u"\u03B3" alpha_label = QLabel(alpha_str) beta_label = QLabel(beta_str) gamma_label = QLabel(gamma_str) cell_label_a_layout = QHBoxLayout() cell_label_a_layout.addWidget(alpha_label) cell_label_a_layout.addWidget(beta_label) cell_label_a_layout.addWidget(gamma_label) cell_v_layout.addLayout(cell_label_a_layout) self.alpha_data = QLabel(empty_str) self.beta_data = QLabel(empty_str) self.gamma_data = QLabel(empty_str) cell_data_layout = QHBoxLayout() cell_data_layout.addWidget(self.alpha_data) cell_data_layout.addWidget(self.beta_data) cell_data_layout.addWidget(self.gamma_data) cell_v_layout.addLayout(cell_data_layout) cell_v_layout.addWidget(QLabel(" ")) spgrp_label = QLabel(" Space Group") self.spgrp_data = QLabel(empty_str) spgrp_hbox = QHBoxLayout() spgrp_hbox.addWidget(spgrp_label) spgrp_hbox.addWidget(self.spgrp_data) cell_v_layout.addLayout(spgrp_hbox) r_layout = QVBoxLayout() r_layout.addWidget(QLabel(" ")) r_layout.addWidget(QLabel(" Orientation (deg) ")) r_label_layout = QHBoxLayout() r1_label = QLabel(" rot X") r2_label = QLabel(" rot Y") r3_label = QLabel(" rot Z") r_label_layout.addWidget(r1_label) r_label_layout.addWidget(r2_label) r_label_layout.addWidget(r3_label) r_data_layout = QHBoxLayout() self.r1_data = QLabel(empty_str) self.r2_data = QLabel(empty_str) self.r3_data = QLabel(empty_str) r_data_layout.addWidget(self.r1_data) r_data_layout.addWidget(self.r2_data) r_data_layout.addWidget(self.r3_data) r_layout.addLayout(r_label_layout) r_layout.addLayout(r_data_layout) crys_v_layout = QVBoxLayout() crys_v_layout.addLayout(cell_v_layout) crys_v_layout.addLayout(r_layout) # crys_v_layout.addStretch() cell_group.setLayout(crys_v_layout) scan_group = QGroupBox(" Scan ") scan_v_layout = QVBoxLayout() scan_v_layout.addLayout(get_spacebox(180)) scan_v_layout.addWidget(QLabel(" Image Range ")) img_ran_h_layout = QHBoxLayout() img_ran1_v_layout = QVBoxLayout() # img_ran1_label = QLabel(" from") self.img_ran1_data = QLabel(empty_str) # img_ran1_v_layout.addWidget(img_ran1_label) img_ran1_v_layout.addWidget(self.img_ran1_data) img_ran2_v_layout = QVBoxLayout() # img_ran2_label = QLabel(" to") self.img_ran2_data = QLabel(empty_str) # img_ran2_v_layout.addWidget(img_ran2_label) img_ran2_v_layout.addWidget(self.img_ran2_data) img_ran_h_layout.addLayout(img_ran1_v_layout) img_ran_h_layout.addLayout(img_ran2_v_layout) scan_v_layout.addLayout(img_ran_h_layout) scan_v_layout.addWidget(QLabel(" ")) oscil_h_layout = QHBoxLayout() oscil1_v_layout = QVBoxLayout() oscil_h_layout.addWidget(QLabel("Oscillation ")) oscil2_v_layout = QVBoxLayout() # oscil2_label = QLabel(" to ") self.oscil2_data = QLabel(empty_str) # oscil2_v_layout.addWidget(oscil2_label) oscil2_v_layout.addWidget(self.oscil2_data) oscil_h_layout.addLayout(oscil1_v_layout) oscil_h_layout.addLayout(oscil2_v_layout) scan_v_layout.addLayout(oscil_h_layout) e_time_label = QLabel("Exposure Time") self.e_time_data = QLabel(empty_str) e_time_hbox = QHBoxLayout() e_time_hbox.addWidget(e_time_label) e_time_hbox.addWidget(self.e_time_data) scan_v_layout.addLayout(e_time_hbox) scan_v_layout.addWidget(QLabel(" ")) strn_sp_label = QLabel("Strong Spots") self.strn_sp_data = QLabel(empty_str) strn_hbox = QHBoxLayout() strn_hbox.addWidget(strn_sp_label) strn_hbox.addWidget(self.strn_sp_data) scan_v_layout.addLayout(strn_hbox) # scan_v_layout.addWidget(QLabel(" ")) indx_sp_label = QLabel("Indexed Spots") self.indx_sp_data = QLabel(empty_str) indx_hbox = QHBoxLayout() indx_hbox.addWidget(indx_sp_label) indx_hbox.addWidget(self.indx_sp_data) scan_v_layout.addLayout(indx_hbox) # scan_v_layout.addWidget(QLabel(" ")) refn_sp_label = QLabel("Refined Spots") self.refn_sp_data = QLabel(empty_str) refn_hbox = QHBoxLayout() refn_hbox.addWidget(refn_sp_label) refn_hbox.addWidget(self.refn_sp_data) scan_v_layout.addLayout(refn_hbox) # scan_v_layout.addWidget(QLabel(" ")) itgr_prf_label = QLabel("Prof int Spots") self.itgr_prf_data = QLabel(empty_str) itgr_prf_hbox = QHBoxLayout() itgr_prf_hbox.addWidget(itgr_prf_label) itgr_prf_hbox.addWidget(self.itgr_prf_data) scan_v_layout.addLayout(itgr_prf_hbox) # scan_v_layout.addWidget(QLabel(" ")) itgr_sum_label = QLabel("Sum int Spots") self.itgr_sum_data = QLabel(empty_str) itgr_sum_hbox = QHBoxLayout() itgr_sum_hbox.addWidget(itgr_sum_label) itgr_sum_hbox.addWidget(self.itgr_sum_data) scan_v_layout.addLayout(itgr_sum_hbox) scan_v_layout.addStretch() scan_group.setLayout(scan_v_layout) detec_group = QGroupBox(" Detector ") detec_v_layout = QVBoxLayout() detec_v_layout.addLayout(get_spacebox(160)) # detec_v_layout.addWidget(QLabel(" ")) d_dist_label = QLabel(" Distance (mm)") self.d_dist_data = QLabel(empty_str) d_dist_hbox = QHBoxLayout() d_dist_hbox.addWidget(d_dist_label) d_dist_hbox.addWidget(self.d_dist_data) detec_v_layout.addLayout(d_dist_hbox) # detec_v_layout.addWidget(QLabel(" ")) n_pans_label = QLabel(" Number of Panels ") self.n_pans_data = QLabel(empty_str) n_pans_hbox = QHBoxLayout() n_pans_hbox.addWidget(n_pans_label) n_pans_hbox.addWidget(self.n_pans_data) detec_v_layout.addLayout(n_pans_hbox) # detec_v_layout.addWidget(QLabel(" ")) gain_label = QLabel(" Gain ") self.gain_data = QLabel(empty_str) gain_hbox = QHBoxLayout() gain_hbox.addWidget(gain_label) gain_hbox.addWidget(self.gain_data) detec_v_layout.addLayout(gain_hbox) # detec_v_layout.addWidget(QLabel(" ")) max_res_label = QLabel(" Max res (" + u"\u212B" + ")") self.max_res_data = QLabel(empty_str) max_res_hbox = QHBoxLayout() max_res_hbox.addWidget(max_res_label) max_res_hbox.addWidget(self.max_res_data) detec_v_layout.addLayout(max_res_hbox) detec_v_layout.addWidget(QLabel(" ")) pix_size_label = QLabel(" Pixel Size ") detec_v_layout.addWidget(pix_size_label) px_h_layout = QHBoxLayout() px_x_v_layout = QVBoxLayout() x_px_size_label = QLabel(" X (mm)") self.x_px_size_data = QLabel(empty_str) px_x_v_layout.addWidget(x_px_size_label) px_x_v_layout.addWidget(self.x_px_size_data) px_y_v_layout = QVBoxLayout() y_px_size_label = QLabel(" Y (mm)") self.y_px_size_data = QLabel(empty_str) px_y_v_layout.addWidget(y_px_size_label) px_y_v_layout.addWidget(self.y_px_size_data) px_h_layout.addLayout(px_x_v_layout) px_h_layout.addLayout(px_y_v_layout) detec_v_layout.addLayout(px_h_layout) # detec_v_layout.addWidget(QLabel(" ")) # detec_v_layout.addStretch() detec_group.setLayout(detec_v_layout) left_big_box = QHBoxLayout() left_big_box.addWidget(beam_group) left_big_box.addWidget(cell_group) left_big_box.addStretch() right_big_box = QHBoxLayout() right_big_box.addWidget(detec_group) right_big_box.addWidget(scan_group) right_big_box.addStretch() inner_main_h_box = QVBoxLayout() inner_main_h_box.addLayout(left_big_box) inner_main_h_box.addLayout(right_big_box) self.my_json_path = None self.my_pikl_path = None self.update_data(exp_json_path=self.my_json_path, refl_pikl_path=self.my_pikl_path) self.my_scrollable = QScrollArea() tmp_widget = QWidget() tmp_widget.setLayout(inner_main_h_box) self.my_scrollable.setWidget(tmp_widget) main_v_box = QVBoxLayout() main_v_box.addWidget(self.my_scrollable) self.setLayout(main_v_box)
def __init__(self, client): super(TableList, self).__init__(None) self.autoStarted = False self.client = client self.setObjectName('TableList') self.resize(700, 400) self.view = MJTableView(self) self.differ = None self.debugModelTest = None self.requestedNewTable = False self.view.setItemDelegateForColumn( 2, RichTextColumnDelegate(self.view)) buttonBox = QDialogButtonBox(self) self.newButton = buttonBox.addButton( m18nc('allocate a new table', "&New"), QDialogButtonBox.ActionRole) self.newButton.setIcon(KIcon("document-new")) self.newButton.setToolTip(m18n("Allocate a new table")) self.newButton.clicked.connect(self.client.newTable) self.joinButton = buttonBox.addButton( m18n("&Join"), QDialogButtonBox.AcceptRole) self.joinButton.clicked.connect(client.joinTable) self.joinButton.setIcon(KIcon("list-add-user")) self.joinButton.setToolTip(m18n("Join a table")) self.leaveButton = buttonBox.addButton( m18n("&Leave"), QDialogButtonBox.AcceptRole) self.leaveButton.clicked.connect(self.leaveTable) self.leaveButton.setIcon(KIcon("list-remove-user")) self.leaveButton.setToolTip(m18n("Leave a table")) self.compareButton = buttonBox.addButton( m18nc('Kajongg-Ruleset', 'Compare'), QDialogButtonBox.AcceptRole) self.compareButton.clicked.connect(self.compareRuleset) self.compareButton.setIcon(KIcon("preferences-plugin-script")) self.compareButton.setToolTip( m18n('Compare the rules of this table with my own rulesets')) self.chatButton = buttonBox.addButton( m18n('&Chat'), QDialogButtonBox.AcceptRole) self.chatButton.setIcon(KIcon("call-start")) self.chatButton.clicked.connect(self.chat) self.startButton = buttonBox.addButton( m18n('&Start'), QDialogButtonBox.AcceptRole) self.startButton.clicked.connect(self.startGame) self.startButton.setIcon(KIcon("arrow-right")) self.startButton.setToolTip( m18n("Start playing on a table. " "Empty seats will be taken by robot players.")) cmdLayout = QHBoxLayout() cmdLayout.addWidget(buttonBox) layout = QVBoxLayout() layout.addWidget(self.view) layout.addLayout(cmdLayout) self.setLayout(layout) self.view.doubleClicked.connect(client.joinTable) StateSaver(self, self.view.horizontalHeader()) self.updateButtonsForTable(None)
def get_spacebox(size): space_box = QHBoxLayout() space_box.insertSpacing(1, size) return space_box
class ScoreTable(QWidget): """show scores of current or last game, even if the last game is finished. To achieve this we keep our own reference to game.""" def __init__(self, scene): super(ScoreTable, self).__init__(None) self.setObjectName("ScoreTable") self.scene = scene self.scoreModel = None self.scoreModelTest = None decorateWindow(self, m18nc("kajongg", "Scores")) self.setAttribute(Qt.WA_AlwaysShowToolTips) self.setMouseTracking(True) self.__tableFields = ["prevailing", "won", "wind", "points", "payments", "balance", "hand", "manualrules"] self.setupUi() self.refresh() StateSaver(self, self.splitter) @property def game(self): """a proxy""" return self.scene.game def setColWidth(self): """we want to accommodate for 5 digits plus minus sign and all column widths should be the same, making horizontal scrolling per item more pleasant""" self.viewRight.setColWidth() def setupUi(self): """setup UI elements""" self.viewLeft = ScoreViewLeft(self) self.viewRight = ScoreViewRight(self) self.viewRight.setHorizontalScrollBar(HorizontalScrollBar(self)) self.viewRight.setHorizontalScrollMode(QAbstractItemView.ScrollPerItem) self.viewRight.setFocusPolicy(Qt.NoFocus) if usingQt5: self.viewRight.header().setSectionsClickable(False) self.viewRight.header().setSectionsMovable(False) else: self.viewRight.header().setClickable(False) self.viewRight.header().setMovable(False) self.viewRight.setSelectionMode(QAbstractItemView.NoSelection) windowLayout = QVBoxLayout(self) self.splitter = QSplitter(Qt.Vertical) self.splitter.setObjectName("ScoreTableSplitter") windowLayout.addWidget(self.splitter) scoreWidget = QWidget() self.scoreLayout = QHBoxLayout(scoreWidget) leftLayout = QVBoxLayout() leftLayout.addWidget(self.viewLeft) self.leftLayout = leftLayout self.scoreLayout.addLayout(leftLayout) self.scoreLayout.addWidget(self.viewRight) self.splitter.addWidget(scoreWidget) self.ruleTree = RuleTreeView(m18nc("kajongg", "Used Rules")) self.splitter.addWidget(self.ruleTree) # this shows just one line for the ruleTree - so we just see the # name of the ruleset: self.splitter.setSizes(list([1000, 1])) def sizeHint(self): """give the scoring table window a sensible default size""" result = QWidget.sizeHint(self) result.setWidth(result.height() * 3 / 2) # the default is too small. Use at least 2/5 of screen height and 1/4 # of screen width: available = KApplication.kApplication().desktop().availableGeometry() height = max(result.height(), available.height() * 2 / 5) width = max(result.width(), available.width() / 4) result.setHeight(height) result.setWidth(width) return result def refresh(self): """load this game and this player. Keep parameter list identical with ExplainView""" if not self.game: # keep scores of previous game on display return if self.scoreModel: expandGroups = [self.viewLeft.isExpanded(self.scoreModel.index(x, 0, QModelIndex())) for x in range(4)] else: expandGroups = [True, False, True, True] gameid = str(self.game.seed or self.game.gameid) if self.game.finished(): title = m18n("Final scores for game <numid>%1</numid>", gameid) else: title = m18n("Scores for game <numid>%1</numid>", gameid) decorateWindow(self, title) self.ruleTree.rulesets = list([self.game.ruleset]) self.scoreModel = ScoreModel(self) if Debug.modelTest: self.scoreModelTest = ModelTest(self.scoreModel, self) for view in [self.viewLeft, self.viewRight]: view.setModel(self.scoreModel) header = view.header() header.setStretchLastSection(False) view.setAlternatingRowColors(True) if usingQt5: self.viewRight.header().setSectionResizeMode(QHeaderView.Fixed) else: self.viewRight.header().setResizeMode(QHeaderView.Fixed) for col in range(self.viewLeft.header().count()): self.viewLeft.header().setSectionHidden(col, col > 0) self.viewRight.header().setSectionHidden(col, col == 0) self.scoreLayout.setStretch(1, 100) self.scoreLayout.setSpacing(0) self.viewLeft.setFrameStyle(QFrame.NoFrame) self.viewRight.setFrameStyle(QFrame.NoFrame) self.viewLeft.setVerticalScrollBarPolicy(Qt.ScrollBarAlwaysOff) for master, slave in ((self.viewRight, self.viewLeft), (self.viewLeft, self.viewRight)): master.expanded.connect(slave.expand) master.collapsed.connect(slave.collapse) master.verticalScrollBar().valueChanged.connect(slave.verticalScrollBar().setValue) for row, expand in enumerate(expandGroups): self.viewLeft.setExpanded(self.scoreModel.index(row, 0, QModelIndex()), expand) self.viewLeft.resizeColumnToContents(0) self.viewRight.setColWidth() # we need a timer since the scrollbar is not yet visible QTimer.singleShot(0, self.scrollRight) def scrollRight(self): """make sure the latest hand is visible""" scrollBar = self.viewRight.horizontalScrollBar() scrollBar.setValue(scrollBar.maximum()) def showEvent(self, dummyEvent): """Only now the views and scrollbars have useful sizes, so we can compute the spacer for the left view""" self.adaptLeftViewHeight() def adaptLeftViewHeight(self): """if the right view has a horizontal scrollbar, make sure both view have the same vertical scroll area. Otherwise scrolling to bottom results in unsyncronized views.""" if self.viewRight.horizontalScrollBar().isVisible(): height = self.viewRight.horizontalScrollBar().height() else: height = 0 if self.leftLayout.count() > 1: # remove previous spacer self.leftLayout.takeAt(1) if height: self.leftLayout.addSpacing(height)
def setupPlotSettingsFrame(self): self.plotSettingsFrame = ctk.ctkCollapsibleButton() self.plotSettingsFrame.text = "Plotting Settings" self.plotSettingsFrame.collapsed = 1 plotSettingsFrameLayout = QFormLayout(self.plotSettingsFrame) self.layout.addWidget(self.plotSettingsFrame) # label map for probing self.labelMapSelector = slicer.qMRMLNodeComboBox() self.labelMapSelector.nodeTypes = ['vtkMRMLLabelMapVolumeNode'] self.labelMapSelector.toolTip = 'Label map to be probed' self.labelMapSelector.setMRMLScene(slicer.mrmlScene) self.labelMapSelector.addEnabled = 0 self.chartButton = QPushButton('Chart') self.chartButton.setEnabled(False) hbox = QHBoxLayout() hbox.addWidget(QLabel('Probed label volume')) hbox.addWidget(self.labelMapSelector) hbox.addWidget(self.chartButton) plotSettingsFrameLayout.addRow(hbox) self.iCharting = QCheckBox('Interactive charting') self.iCharting.setChecked(True) plotSettingsFrameLayout.addRow(self.iCharting) self.iChartingMode = QButtonGroup() self.iChartingIntensity = QRadioButton('Signal intensity') self.iChartingIntensityFixedAxes = QRadioButton( 'Fixed range intensity') self.iChartingPercent = QRadioButton('Percentage change') self.iChartingIntensity.setChecked(1) self.iChartingMode.addButton(self.iChartingIntensity) self.iChartingMode.addButton(self.iChartingIntensityFixedAxes) self.iChartingMode.addButton(self.iChartingPercent) hbox = QHBoxLayout() self.plottingModeGroupBox = QGroupBox('Plotting mode:') plottingModeLayout = QVBoxLayout() self.plottingModeGroupBox.setLayout(plottingModeLayout) plottingModeLayout.addWidget(self.iChartingIntensity) plottingModeLayout.addWidget(self.iChartingIntensityFixedAxes) plottingModeLayout.addWidget(self.iChartingPercent) hbox.addWidget(self.plottingModeGroupBox) self.showLegendCheckBox = QCheckBox('Display legend') self.showLegendCheckBox.setChecked(0) self.xLogScaleCheckBox = QCheckBox('Use log scale for X axis') self.xLogScaleCheckBox.setChecked(0) self.yLogScaleCheckBox = QCheckBox('Use log scale for Y axis') self.yLogScaleCheckBox.setChecked(0) self.plotGeneralSettingsGroupBox = QGroupBox('General Plot options:') plotGeneralSettingsLayout = QVBoxLayout() self.plotGeneralSettingsGroupBox.setLayout(plotGeneralSettingsLayout) plotGeneralSettingsLayout.addWidget(self.showLegendCheckBox) plotGeneralSettingsLayout.addWidget(self.xLogScaleCheckBox) plotGeneralSettingsLayout.addWidget(self.yLogScaleCheckBox) hbox.addWidget(self.plotGeneralSettingsGroupBox) plotSettingsFrameLayout.addRow(hbox) self.nFramesBaselineCalculation = QSpinBox() self.nFramesBaselineCalculation.minimum = 1 hbox = QHBoxLayout() hbox.addWidget(QLabel('Frame count(baseline calculation):')) hbox.addWidget(self.nFramesBaselineCalculation) plotSettingsFrameLayout.addRow(hbox)
def setupPanel(self, parentWidget): logging.debug('ProstateTRUSNavUltrasound.setupPanel') self.connectorNode = self.guideletParent.connectorNode self.connectorNodeConnected = False collapsibleButton = ctkCollapsibleButton() collapsibleButton.setProperty('collapsedHeight', 20) setButtonStyle(collapsibleButton, 2.0) collapsibleButton.text = "Ultrasound" parentWidget.addWidget(collapsibleButton) ultrasoundLayout = QFormLayout(collapsibleButton) ultrasoundLayout.setContentsMargins(12,4,4,4) ultrasoundLayout.setSpacing(4) self.connectDisconnectButton = QPushButton("Connect") self.connectDisconnectButton.setToolTip("If clicked, connection OpenIGTLink") hbox = QHBoxLayout() hbox.addWidget(self.connectDisconnectButton) ultrasoundLayout.addRow(hbox) self.setupIcons() self.captureIDSelector = QComboBox() self.captureIDSelector.setToolTip("Pick capture device ID") self.captureIDSelector.setSizePolicy(QSizePolicy.Expanding, QSizePolicy.Expanding) self.volumeReconstructorIDSelector = QComboBox() self.volumeReconstructorIDSelector.setToolTip( "Pick volume reconstructor device ID" ) self.volumeReconstructorIDSelector.setSizePolicy(QSizePolicy.Expanding, QSizePolicy.Expanding) self.startStopRecordingButton = QPushButton(" Start Recording") self.startStopRecordingButton.setCheckable(True) self.startStopRecordingButton.setIcon(self.recordIcon) self.startStopRecordingButton.setEnabled(False) self.startStopRecordingButton.setToolTip("If clicked, start recording") self.startStopRecordingButton.setSizePolicy(QSizePolicy.Expanding, QSizePolicy.Expanding) recordParametersControlsLayout = QGridLayout() self.filenameLabel = self.createLabel("Filename:", visible=False) recordParametersControlsLayout.addWidget(self.filenameLabel, 1, 0) # Offline Reconstruction self.offlineReconstructButton = QPushButton(" Offline Reconstruction") self.offlineReconstructButton.setCheckable(True) self.offlineReconstructButton.setIcon(self.recordIcon) self.offlineReconstructButton.setEnabled(False) self.offlineReconstructButton.setToolTip("If clicked, reconstruct recorded volume") self.offlineReconstructButton.setSizePolicy(QSizePolicy.Expanding, QSizePolicy.Expanding) self.offlineVolumeToReconstructSelector = QComboBox() self.offlineVolumeToReconstructSelector.setEditable(True) self.offlineVolumeToReconstructSelector.setToolTip( "Pick/set volume to reconstruct" ) self.offlineVolumeToReconstructSelector.visible = False hbox = QHBoxLayout() hbox.addWidget(self.startStopRecordingButton) hbox.addWidget(self.offlineReconstructButton) ultrasoundLayout.addRow(hbox) # Scout scan (record and low resolution reconstruction) and live reconstruction # Scout scan part self.startStopScoutScanButton = QPushButton(" Scout scan\n Start recording") self.startStopScoutScanButton.setCheckable(True) self.startStopScoutScanButton.setIcon(self.recordIcon) self.startStopScoutScanButton.setToolTip("If clicked, start recording") self.startStopScoutScanButton.setEnabled(False) self.startStopScoutScanButton.setSizePolicy(QSizePolicy.Expanding, QSizePolicy.Expanding) self.startStopLiveReconstructionButton = QPushButton(" Start live reconstruction") self.startStopLiveReconstructionButton.setCheckable(True) self.startStopLiveReconstructionButton.setIcon(self.recordIcon) self.startStopLiveReconstructionButton.setToolTip("If clicked, start live reconstruction") self.startStopLiveReconstructionButton.setEnabled(False) self.startStopLiveReconstructionButton.setSizePolicy(QSizePolicy.Expanding, QSizePolicy.Expanding) self.displayRoiButton = QToolButton() self.displayRoiButton.setCheckable(True) self.displayRoiButton.setIcon(self.visibleOffIcon) self.displayRoiButton.setToolTip("If clicked, display ROI") hbox = QHBoxLayout() hbox.addWidget(self.startStopScoutScanButton) hbox.addWidget(self.startStopLiveReconstructionButton) # hbox.addWidget(self.displayRoiButton) ultrasoundLayout.addRow(hbox) self.snapshotTimer = QTimer() self.snapshotTimer.setSingleShot(True) self.onParameterSetSelected() return collapsibleButton