def setup(self): self.widget = QWidget() layout = QGridLayout() self.widget.setLayout(layout) self.layout.addWidget(self.widget) self.widget.show() self.layout = layout self.setupInputFrame() self.setupFrameControlFrame() self.setupAdditionalFrames() self.setupPlottingFrame() self.setFramesEnabled(False) self.timer = QTimer() self.timer.setInterval(50) self.setupConnections() # initialize slice observers (from DataProbe.py) # keep list of pairs: [observee,tag] so they can be removed easily self.styleObserverTags = [] # keep a map of interactor styles to sliceWidgets so we can easily get sliceLogic self.sliceWidgetsPerStyle = {} self.refreshObservers()
def setupPlottingFrame(self, parent=None): self.plotFrame = ctk.ctkCollapsibleButton() self.plotFrame.text = "Plotting" self.plotFrame.collapsed = 0 plotFrameLayout = QGridLayout(self.plotFrame) self.layout.addWidget(self.plotFrame) qSlicerMultiVolumeExplorerSimplifiedModuleWidget.setupPlottingFrame(self, parent=plotFrameLayout)
def __init__(self, parent, umlmachines, name='InstallerWidget'): QWidget.__init__(self, parent, name) self.resize(600, 600) self.app = get_application_pointer() self.conn = self.app.conn self.umlmachines = umlmachines self.machine = self.umlmachines.current self.current_machine_process = 'start' self.current_profile = None self.current_trait = None self.traitlist = [] self.curenv = CurrentEnvironment(self.conn, self.machine) self.curenv['current_profile'] = 'None' self.curenv['current_trait'] = 'None' self.curenv['current_machine_process'] = self.current_machine_process self.timer = QTimer(self) self.connect(self.timer, SIGNAL('timeout()'), self.update_progress) self.timer.startTimer(1000) self.grid = QGridLayout(self, 4, 1, 5, 7) self.main_label = QLabel(self) self.main_label.setText(self._msg()) self.grid.addWidget(self.main_label, 0, 0) self.profile_progress_lbl = QLabel(self) self.grid.addWidget(self.profile_progress_lbl, 1, 0) self.profile_progress = KProgress(self) self.grid.addWidget(self.profile_progress, 2, 0) self.logview = LogBrowser(self, '/tmp/uml-installer.log') self.grid.addWidget(self.logview, 3, 0) #self.console_view = StdOutBrowser(self) #self.console_view = KTextBrowser(self) #self.grid.addWidget(self.console_view, 4, 0) self.console_text = ''
def __init__(self, parent, text='', name='LabeledProgress'): QWidget.__init__(self, parent, name) self.grid = QGridLayout(self, 2, 1, 5, 7) self.label = QLabel(self) if text: self.label.setText(text) self.progressbar = SimpleProgress(self) self.grid.addWidget(self.label, 0, 0) self.grid.addWidget(self.progressbar, 1, 0)
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 setupPlottingFrame(self, parent=None): if not parent: parent = self.layout self.plottingFrameWidget = QWidget() self.plottingFrameLayout = QGridLayout() self.plottingFrameWidget.setLayout(self.plottingFrameLayout) self._multiVolumeIntensityChart = MultiVolumeIntensityChartView() self.popupChartButton = QPushButton("Undock chart") self.popupChartButton.setCheckable(True) self.plottingFrameLayout.addWidget(self._multiVolumeIntensityChart.chartView) self.plottingFrameLayout.addWidget(self.popupChartButton) parent.addWidget(self.plottingFrameWidget)
def __init__(self, parent, fields, text=None, name='EditableRecordFrame'): QFrame.__init__(self, parent, name) numrows = len(fields) + 2 numcols = 2 self.grid = QGridLayout(self, numrows, numcols, 1, -1, name) self.fields = fields self.entries = {} self._setupfields() self.grid.setSpacing(7) self.grid.setMargin(10) self.text_label = QLabel(text, self) self.grid.addMultiCellWidget(self.text_label, 0, 0, 0, 1)
def __init__(self, game): """selection for this player, tiles are the still available tiles""" QDialog.__init__(self, None) decorateWindow(self, i18n("Penalty")) self.game = game grid = QGridLayout(self) lblOffense = QLabel(i18n('Offense:')) crimes = list([ x for x in game.ruleset.penaltyRules if not ('absolute' in x.options and game.winner) ]) self.cbCrime = ListComboBox(crimes) lblOffense.setBuddy(self.cbCrime) grid.addWidget(lblOffense, 0, 0) grid.addWidget(self.cbCrime, 0, 1, 1, 4) lblPenalty = QLabel(i18n('Total Penalty')) self.spPenalty = PenaltyBox(2) self.spPenalty.setRange(0, 9999) lblPenalty.setBuddy(self.spPenalty) self.lblUnits = QLabel(i18n('points')) grid.addWidget(lblPenalty, 1, 0) grid.addWidget(self.spPenalty, 1, 1) grid.addWidget(self.lblUnits, 1, 2) self.payers = [] self.payees = [] # a penalty can never involve the winner, neither as payer nor as payee for idx in range(3): self.payers.append(ListComboBox(game.losers())) self.payees.append(ListComboBox(game.losers())) for idx, payer in enumerate(self.payers): grid.addWidget(payer, 3 + idx, 0) payer.lblPayment = QLabel() grid.addWidget(payer.lblPayment, 3 + idx, 1) for idx, payee in enumerate(self.payees): grid.addWidget(payee, 3 + idx, 3) payee.lblPayment = QLabel() grid.addWidget(payee.lblPayment, 3 + idx, 4) grid.addWidget(QLabel(''), 6, 0) grid.setRowStretch(6, 10) for player in self.payers + self.payees: player.currentIndexChanged.connect(self.playerChanged) self.spPenalty.valueChanged.connect(self.penaltyChanged) self.cbCrime.currentIndexChanged.connect(self.crimeChanged) buttonBox = KDialogButtonBox(self) grid.addWidget(buttonBox, 7, 0, 1, 5) buttonBox.setStandardButtons(QDialogButtonBox.Cancel) buttonBox.rejected.connect(self.reject) self.btnExecute = buttonBox.addButton(i18n("&Execute"), QDialogButtonBox.AcceptRole) self.btnExecute.clicked.connect(self.accept) self.crimeChanged() StateSaver(self)
def __init__(self, server=None): QDialog.__init__(self, None) decorateWindow(self, i18n('Select a ruleset')) self.buttonBox = KDialogButtonBox(self) self.buttonBox.setStandardButtons(QDialogButtonBox.Cancel | QDialogButtonBox.Ok) self.buttonBox.accepted.connect(self.accept) self.buttonBox.rejected.connect(self.reject) self.cbRuleset = ListComboBox(Ruleset.selectableRulesets(server)) self.grid = QGridLayout() # our child SelectPlayers needs this self.grid.setColumnStretch(0, 1) self.grid.setColumnStretch(1, 6) vbox = QVBoxLayout(self) vbox.addLayout(self.grid) vbox.addWidget(self.cbRuleset) vbox.addWidget(self.buttonBox)
def onDockChartViewToggled(self, checked): if checked: self.chartPopupWindow = QDialog() self.chartPopupWindow.setWindowFlags(PythonQt.QtCore.Qt.WindowStaysOnTopHint) layout = QGridLayout() self.chartPopupWindow.setLayout(layout) layout.addWidget(self._multiVolumeIntensityChart.chartView) layout.addWidget(self.popupChartButton) self.chartPopupWindow.finished.connect(self.dockChartView) self.chartPopupWindow.resize(self.chartPopupSize) self.chartPopupWindow.move(self.chartPopupPosition) self.chartPopupWindow.show() self.popupChartButton.setText("Dock chart") self._multiVolumeIntensityChart.chartView.show() else: self.chartPopupWindow.close()
def __init__(self, client, parent=None): QDialog.__init__(self, parent) decorateWindow(self, i18n('Choose')) self.setObjectName('ClientDialog') self.client = client self.layout = QGridLayout(self) self.progressBar = QProgressBar() self.progressBar.setMinimumHeight(25) self.timer = QTimer() if not client.game.autoPlay: self.timer.timeout.connect(self.timeout) self.deferred = None self.buttons = [] self.setWindowFlags(Qt.SubWindow | Qt.WindowStaysOnTopHint) self.setModal(False) self.btnHeight = 0 self.answered = False self.move = None self.sorry = None
def setupUi(self): """create all other widgets we could make the scene view the central widget but I did not figure out how to correctly draw the background with QGraphicsView/QGraphicsScene. QGraphicsView.drawBackground always wants a pixmap for a huge rect like 4000x3000 where my screen only has 1920x1200""" # pylint: disable=too-many-statements self.setObjectName("MainWindow") centralWidget = QWidget() self.centralView = FittingView() layout = QGridLayout(centralWidget) layout.setContentsMargins(0, 0, 0, 0) layout.addWidget(self.centralView) self.setCentralWidget(centralWidget) self.centralView.setFocusPolicy(Qt.StrongFocus) self.background = None # just for pylint self.windTileset = Tileset(Internal.Preferences.windTilesetName) self.adjustMainView() self.actionScoreGame = self.kajonggAction("scoreGame", "draw-freehand", self.scoringScene, Qt.Key_C) self.actionPlayGame = self.kajonggAction("play", "arrow-right", self.playGame, Qt.Key_N) self.actionAbortGame = self.kajonggAction("abort", "dialog-close", self.abortAction, Qt.Key_W) self.actionAbortGame.setEnabled(False) self.actionQuit = self.kajonggAction("quit", "application-exit", self.close, Qt.Key_Q) self.actionPlayers = self.kajonggAction("players", "im-user", self.slotPlayers) self.actionRulesets = self.kajonggAction("rulesets", "games-kajongg-law", self.slotRulesets) self.actionChat = self._kajonggToggleAction("chat", "call-start", shortcut=Qt.Key_H, actionData=ChatWindow) self.actionChat.setEnabled(False) self.actionAngle = self.kajonggAction("angle", "object-rotate-left", self.changeAngle, Qt.Key_G) self.actionAngle.setEnabled(False) self.actionScoreTable = self._kajonggToggleAction( "scoreTable", "format-list-ordered", Qt.Key_T, actionData=ScoreTable) self.actionScoreTable.setEnabled(False) self.actionExplain = self._kajonggToggleAction( "explain", "applications-education", Qt.Key_E, actionData=ExplainView) self.actionExplain.setEnabled(False) self.actionFullscreen = self._kajonggToggleAction("fullscreen", "view-fullscreen", shortcut=Qt.Key_F + Qt.ShiftModifier) self.actionFullscreen.toggled.connect(self.fullScreen) self.actionAutoPlay = self.kajonggAction("demoMode", "arrow-right-double", None, Qt.Key_D) self.actionAutoPlay.setCheckable(True) self.actionAutoPlay.setEnabled(True) self.actionAutoPlay.toggled.connect(self._toggleDemoMode) self.actionAutoPlay.setChecked(Internal.autoPlay) QMetaObject.connectSlotsByName(self)
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
def __init__(self, repositoryManager): """ Constructor. """ # Init GUI AdminWindow.__init__(self) # set icon in window-title: self.setIcon(QPixmap.fromMimeSource("DF_Logo_24x24.png")) iconSet = QIconSet(QPixmap.fromMimeSource("dataType16.png")) self.dataNavigator.setTabIconSet(self.dataTypes, iconSet) iconSet = QIconSet(QPixmap.fromMimeSource("relationType16.png")) self.dataNavigator.setTabIconSet(self.relationTypes, iconSet) iconSet = QIconSet(QPixmap.fromMimeSource("dataStore16.png")) self.dataNavigator.setTabIconSet(self.dataStores, iconSet) logger_handler.installGuiLoggingHandler(self.__logger, self.logList) self.myStatusBar = self.statusBar() self.statusLabel1 = QLabel("DataFinder", self.myStatusBar) self.statusLabel2 = QLabel("OK", self.myStatusBar) self.myStatusBar.addWidget(self.statusLabel1, 80) self.myStatusBar.addWidget(self.statusLabel2, 20) self.statusLabel1.show() self.statusLabel2.show() self.myStatusBar.show() # prepare "About"-dialog: self.dfAboutDialog = about_dialog.AboutDialog() self.dfAboutDialog.setPixmap( QPixmap.fromMimeSource("about_datafinder_admin.png")) # Login-dialog: self.dfLoginDialog = login_dialog.LoginDialog( repositoryManager.preferences, parent=self, showurl=True) # IconView: propertyPanelLayout = QGridLayout(self.propertyPanel, 1, 1, 2, 6, "propertyPanelLayout") self.iconView = canvas_view.CanvasView(self.propertyPanel, self, "iconView", 0) propertyPanelLayout.addWidget(self.iconView, 0, 0) self.iconViewCanvas = self.iconView.canvas() self.connect(self.dfLoginDialog.okPushButton, PYSIGNAL("updateWebdavServerView"), self.updateWebdavServerSlot) self.connect(self.dataTypeBrowser, SIGNAL("doubleClicked(QListViewItem*)"), self.__addDataTypeIconSlot) self.connect(self.relationTypeBrowser, SIGNAL("doubleClicked(QListViewItem*)"), self.__addRelationTypeIconSlot) self.connect(self.dataStoreBrowser, SIGNAL("clicked(QListViewItem*)"), self.iconView.updateCanvasView) self.connect(self.dataStoreBrowser, SIGNAL("doubleClicked(QListViewItem*)"), self.editSlot) # Init model self._repositoryManager = repositoryManager self.repositoryConfiguration = None self._preferences = self._repositoryManager.preferences self._lastUploadDirectory = os.path.expanduser("~") self._dataTypes = list() self._relationTypes = list() self._dataStores = list() self.__setConnectionState(False)