コード例 #1
0
ファイル: installer.py プロジェクト: joelsefus/paella
 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 = ""
コード例 #2
0
 def closeEvent( self, event ):
     """Redefinicion del closeEvent de qt"""
     QWidget.closeEvent( self, event )
     if not self.parent.vprincipal.isVisible():
         qApp.exit(0)
     else:
         self.hide()
コード例 #3
0
ファイル: installer.py プロジェクト: pombredanne/paella-svn
 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 = ''
コード例 #4
0
ファイル: dynamic_reindex_gui.py プロジェクト: luisodls/DUI
class MainWindow(QMainWindow):
    def __init__(self, parent=None):
        super(MainWindow, self).__init__(parent)

        self.btn1 = QPushButton("Click me", self)

        vbox = QVBoxLayout()
        vbox.addWidget(QLabel("A1"))
        vbox.addWidget(self.btn1)
        vbox.addWidget(QLabel("B2"))

        self.btn1.clicked.connect(self.doit)
        self.my_pop = None

        self.main_widget = QWidget(self)
        self.main_widget.setLayout(vbox)
        self.setCentralWidget(self.main_widget)

    def doit(self):
        logger.debug("Opening a new popup window")
        self.my_pop = MyReindexOpts()
        self.my_pop.set_ref(
            in_json_path="/tmp/dui2run/dui_files/lin_4_bravais_summary.json",
            lin_num=4)
        #in_json_path="/tmp/dui_run/dui_files/lin_4_bravais_summary.json"

    def opt_picked(self, opt_num):
        logger.debug("\n from dynamic_reindex_gui.py MainWindow")
        logger.debug("opt_num = %s %s", opt_num, "\n")

    def closeEvent(self, event):
        logger.debug("<< closeEvent ( from QMainWindow) >>")
        if self.my_pop is not None:
            self.my_pop.close()
    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()
コード例 #6
0
ファイル: qt3_qproc.py プロジェクト: emayssat/sandbox
    def __init__(self):

        QWidget.__init__(self)

        self.textBrowser = QTextBrowser(self)
        self.textBrowser.setTextFormat(QTextBrowser.LogText)
        self.lineEdit = QLineEdit(self)
        self.startButton = QPushButton(self.tr("Start"), self)
        self.stopButton = QPushButton(self.tr("Stop"), self)
        self.stopButton.setEnabled(False)

        self.connect(self.lineEdit, SIGNAL("returnPressed()"), self.startCommand)
        self.connect(self.startButton, SIGNAL("clicked()"), self.startCommand)
        self.connect(self.stopButton, SIGNAL("clicked()"), self.stopCommand)
        layout = QGridLayout(self, 2, 3)
        layout.setSpacing(8)
        layout.addMultiCellWidget(self.textBrowser, 0, 0, 0, 2)
        layout.addWidget(self.lineEdit, 1, 0)
        layout.addWidget(self.startButton, 1, 1)
        layout.addWidget(self.stopButton, 1, 2)



        self.process = QProcess()
        self.connect(self.process, SIGNAL("readyReadStdout()"), self.readOutput)
        self.connect(self.process, SIGNAL("readyReadStderr()"), self.readErrors)
        self.connect(self.process, SIGNAL("processExited()"), self.resetButtons)
コード例 #7
0
ファイル: login.py プロジェクト: zero804/kajongg
    def __init__(self, url, username, password):
        KDialog.__init__(self)
        decorateWindow(self, i18n('Create User Account'))
        self.setButtons(KDialog.ButtonCode(KDialog.Ok | KDialog.Cancel))
        vbox = QVBoxLayout()
        grid = QFormLayout()
        self.lbServer = QLabel()
        self.lbServer.setText(url)
        grid.addRow(i18n('Game server:'), self.lbServer)
        self.lbUser = QLabel()
        grid.addRow(i18n('Username:'******'Password:'******'Repeat password:'), self.edPassword2)
        vbox.addLayout(grid)
        widget = QWidget(self)
        widget.setLayout(vbox)
        self.setMainWidget(widget)
        pol = QSizePolicy()
        pol.setHorizontalPolicy(QSizePolicy.Expanding)
        self.lbUser.setSizePolicy(pol)

        self.edPassword.textChanged.connect(self.passwordChanged)
        self.edPassword2.textChanged.connect(self.passwordChanged)
        StateSaver(self)
        self.username = username
        self.password = password
        self.passwordChanged()
        self.edPassword2.setFocus()
コード例 #8
0
    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
コード例 #9
0
 def __init__(self, parent, name='TestConfigTab'):
     QWidget.__init__(self, parent, name)
     self.grid = QGridLayout(self, 2, 1, 0, 1, 'TestConfigTabLayout')
     self.textbrowser = KTextBrowser(self)
     self.grid.addWidget(self.textbrowser, 0, 0)
     self.button = KPushButton(self)
     self.button.setText('test get_config')
     self.grid.addWidget(self.button, 1, 0)
コード例 #10
0
 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)
コード例 #11
0
ファイル: progress.py プロジェクト: pombredanne/paella-svn
 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)
コード例 #12
0
 def closeEvent(self, event):
     """Acciones que se realizaran cuando el usuario cierre la ventana. Guarda el estado de la configuración,
     incluyendo los ficheros recientemente abiertos"""
     if not self.__dproyecto_modificado(): 
         return
     QWidget.closeEvent(self, event)
     if not self.parent.vsalida.isVisible():
         self.__config.guardar()
         qApp.exit(0)
     else:
         self.hide()
コード例 #13
0
ファイル: window.py プロジェクト: oleglite/checkers
    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()
コード例 #14
0
 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)
コード例 #15
0
 def __init__(self, parent, name="SoundBlasterHardwareOptions"):
     QWidget.__init__(self, parent, name)
     numrows = 2
     numcols = 1
     margin = 0
     space = 1
     self.grid = QGridLayout(self, numrows, numcols, margin, space, "SoundBlasterHardwareOptionsLayout")
     self._default_oplmodes = ["auto", "cms", "opl2", "dualopl2", "opl3"]
     self.oplmode_box = ConfigComboBoxWidget(self, "OPL mode", self._default_oplmodes)
     self.grid.addWidget(self.oplmode_box, 0, 0)
     self.oplrate_box = SampleRateOption(self, "OPL sample rate")
     self.grid.addWidget(self.oplrate_box, 1, 0)
コード例 #16
0
ファイル: recordedit.py プロジェクト: joelsefus/paella
 def __init__(self, parent, fields=[], data={}, name='VariablesEditor'):
     QWidget.__init__(self, parent, name)
     self.initPaellaCommon()
     self.grid = QGridLayout(self, len(fields), 2, 1, -1, 'VariablesEditorLayout')
     self.fields = fields
     self.fields.sort()
     self._data = data
     self.entries = {}
     self._labels = {}
     if fields:
         self._setup_grid()
     self.grid.setSpacing(7)
     self.grid.setMargin(10)
コード例 #17
0
 def setupInputFrame(self, parent=None):
   if not parent:
     parent = self.layout
   self.bgMultiVolumeSelector = slicer.qMRMLNodeComboBox()
   self.bgMultiVolumeSelector.nodeTypes = ['vtkMRMLMultiVolumeNode']
   self.bgMultiVolumeSelector.setMRMLScene(slicer.mrmlScene)
   self.bgMultiVolumeSelector.addEnabled = 0
   self._bgMultiVolumeSelectorLabel = QLabel('Input multivolume')
   inputFrameWidget = QWidget()
   self.inputFrameLayout = QFormLayout()
   inputFrameWidget.setLayout(self.inputFrameLayout)
   self.inputFrameLayout.addRow(self._bgMultiVolumeSelectorLabel, self.bgMultiVolumeSelector)
   parent.addWidget(inputFrameWidget)
コード例 #18
0
ファイル: differ.py プロジェクト: pombredanne/paella-svn
 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)
コード例 #19
0
ファイル: differ.py プロジェクト: BackupTheBerlios/paella-svn
 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)
コード例 #20
0
 def __init__(self, parent, name="SoundBlasterHardwareOptions"):
     QWidget.__init__(self, parent, name)
     numrows = 2
     numcols = 3
     margin = 0
     space = 1
     self.grid = QGridLayout(self, numrows, numcols, margin, space, "SoundBlasterHardwareOptionsLayout")
     self.base_box = ConfigSpinWidget(self, "I/O address", max=1000)
     self.grid.addWidget(self.base_box, 0, 0)
     self.irq_box = ConfigSpinWidget(self, "IRQ", min=3, max=15)
     self.grid.addWidget(self.irq_box, 1, 0)
     self.dma_box = ConfigSpinWidget(self, "DMA")
     self.grid.addWidget(self.dma_box, 0, 2)
     self.hdma_box = ConfigSpinWidget(self, "High DMA")
     self.grid.addWidget(self.hdma_box, 1, 2)
コード例 #21
0
ファイル: scoringdialog.py プロジェクト: zero804/kajongg
 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]))
コード例 #22
0
ファイル: dynamic_reindex_gui.py プロジェクト: luisodls/DUI
    def __init__(self, parent=None):
        super(MainWindow, self).__init__(parent)

        self.btn1 = QPushButton("Click me", self)

        vbox = QVBoxLayout()
        vbox.addWidget(QLabel("A1"))
        vbox.addWidget(self.btn1)
        vbox.addWidget(QLabel("B2"))

        self.btn1.clicked.connect(self.doit)
        self.my_pop = None

        self.main_widget = QWidget(self)
        self.main_widget.setLayout(vbox)
        self.setCentralWidget(self.main_widget)
コード例 #23
0
ファイル: window.py プロジェクト: oleglite/checkers
    def create_sidebar_widget(self):
        self.lcd_widget = QLCDNumber(self)
        self.lcd_widget.setFixedHeight(100)
        self.set_score(0, 0)
        self.log_widget = QPlainTextEdit(self)

        sidebar = QWidget(self)
        sidebar_layout = QVBoxLayout()
        sidebar_layout.addWidget(self.lcd_widget)
        sidebar_layout.addWidget(self.log_widget)
        sidebar.setLayout(sidebar_layout)

        sidebar.setFixedWidth(250)


        return sidebar
  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()
コード例 #25
0
 def sizeHint(self):
     """we never want a horizontal scrollbar for player names,
     we always want to see them in full"""
     result = QWidget.sizeHint(self)
     available = Internal.app.desktop().availableGeometry()
     height = max(result.height(), available.height() * 2 // 3)
     width = max(result.width(), available.width() // 2)
     return QSize(width, height)
コード例 #26
0
 def __init__(self, parent, name="GusHardwareOptions"):
     QWidget.__init__(self, parent, name)
     numrows = 2
     numcols = 3
     margin = 0
     space = 1
     self.grid = QGridLayout(self, numrows, numcols, margin, space, "GusHardwareOptionsLayout")
     self.base_box = ConfigSpinWidget(self, "I/O address", max=1000)
     self.grid.addWidget(self.base_box, 0, 0)
     self.irq1_box = ConfigSpinWidget(self, "IRQ 1", min=3, max=15)
     self.grid.addWidget(self.irq1_box, 0, 1)
     self.irq2_box = ConfigSpinWidget(self, "IRQ 2", min=3, max=15)
     self.grid.addWidget(self.irq2_box, 1, 1)
     self.dma1_box = ConfigSpinWidget(self, "DMA 1")
     self.grid.addWidget(self.dma1_box, 0, 2)
     self.dma2_box = ConfigSpinWidget(self, "DMA 2")
     self.grid.addWidget(self.dma2_box, 1, 2)
コード例 #27
0
ファイル: runner.py プロジェクト: joelsefus/paella
 def __init__(self, parent, umlmachines, name='RunnerWidget'):
     QWidget.__init__(self, parent, name)
     self.app = get_application_pointer()
     self.umlmachines = umlmachines
     self.proc = self.umlmachines.run_machine()
     self._mainbox = QVBoxLayout(self, 5, 7)
     # add label
     self.mainlabel = QLabel(self)
     self.mainlabel.setText('Running Umlmachine %s' % self.umlmachines.current)
     self._mainbox.addWidget(self.mainlabel)
     # add stdout viewer
     logfile = self.umlmachines.stdout_logfile.name
     self.logbrowser = LogBrowser(self, logfile)
     self._mainbox.addWidget(self.logbrowser)
     self.timer = QTimer(self)
     self.connect(self.timer, SIGNAL('timeout()'), self.update_progress)
     self.timer.startTimer(1000)
コード例 #28
0
ファイル: rulesetselector.py プロジェクト: KDE/kajongg
 def sizeHint(self):
     """we never want a horizontal scrollbar for player names,
     we always want to see them in full"""
     result = QWidget.sizeHint(self)
     available = KApplication.kApplication().desktop().availableGeometry()
     height = max(result.height(), available.height() * 2 // 3)
     width = max(result.width(), available.width() // 2)
     return QSize(width, height)
コード例 #29
0
ファイル: bootstrapper.py プロジェクト: joelsefus/paella
 def __init__(self, parent, suite, name="RunnerWidget"):
     QWidget.__init__(self, parent, name)
     self.app = get_application_pointer()
     cfg = self.app.umlcfg
     basefile = make_base_filesystem(suite, "%s.base" % suite, cfg=cfg, size=300, mkfs="mke2fs")
     self.bootstrapper = UmlBootstrapper(suite, basefile, cfg=self.cfg)
     self._mainbox = QVBoxLayout(self, 5, 7)
     # add label
     self.mainlabel = QLabel(self)
     self.mainlabel.setText("Bootstrapping suite %s" % suite)
     self._mainbox.addWidget(self.mainlabel)
     # add stdout viewer
     logfile = self.umlmachines.stdout_logfile.name
     self.logbrowser = LogBrowser(self, logfile)
     self._mainbox.addWidget(self.logbrowser)
     self.timer = QTimer(self)
     self.connect(self.timer, SIGNAL("timeout()"), self.update_progress)
     self.timer.startTimer(1000)
コード例 #30
0
ファイル: runner.py プロジェクト: pombredanne/paella-svn
 def __init__(self, parent, umlmachines, name='RunnerWidget'):
     QWidget.__init__(self, parent, name)
     self.app = get_application_pointer()
     self.umlmachines = umlmachines
     self.proc = self.umlmachines.run_machine()
     self._mainbox = QVBoxLayout(self, 5, 7)
     # add label
     self.mainlabel = QLabel(self)
     self.mainlabel.setText('Running Umlmachine %s' %
                            self.umlmachines.current)
     self._mainbox.addWidget(self.mainlabel)
     # add stdout viewer
     logfile = self.umlmachines.stdout_logfile.name
     self.logbrowser = LogBrowser(self, logfile)
     self._mainbox.addWidget(self.logbrowser)
     self.timer = QTimer(self)
     self.connect(self.timer, SIGNAL('timeout()'), self.update_progress)
     self.timer.startTimer(1000)
コード例 #31
0
ファイル: differ.py プロジェクト: pombredanne/paella-svn
 def __init__(self, app, parent, name='SuiteTraitCombo'):
     QWidget.__init__(self, parent, name)
     dbwidget(self, app)
     self.suiteCursor = Suites(self.conn)
     self.suites = self.suiteCursor.list()
     self.traits = Traits(self.conn, self.suites[0])
     self.scombo = SuiteCombo(self, self.suites)
     self.tcombo = MyCombo(self, 'TypeCombo')
     self.tcombo.fill(['template', 'script'])
     self.ubutton = KPushButton('update', self)
     self.listView = TraitList(self.app, self)
     self.vbox = QVBoxLayout(self)
     for member in ['listView', 'scombo', 'tcombo', 'ubutton']:
         widget = getattr(self, member)
         self.vbox.addWidget(widget)
     self.connect(self.scombo, SIGNAL('highlighted(int)'),
                  self.update_traits)
     self.connect(self.ubutton, SIGNAL('clicked()'), self.refreshlistView)
コード例 #32
0
 def __init__(self, parent, name='WinSizeEntryWidget'):
     QWidget.__init__(self, parent, name)
     numrows = 2
     numcols = 2
     margin = 0
     space = 1
     self.grid = QGridLayout(self, numrows, numcols,
                             margin, space, 'WinSizeEntryWidgetLayout')
     self.w_label = QLabel('width', self)
     self.grid.addWidget(self.w_label, 0, 0)
     # should be using KIntSpinBox instead of text entry
     self.w_entry = KLineEdit(self)
     self.grid.addWidget(self.w_entry, 1, 0)
     self.h_label = QLabel('height', self)
     self.grid.addWidget(self.h_label, 0, 1)
     # should be using KIntSpinBox instead of text entry
     self.h_entry = KLineEdit(self)
     self.grid.addWidget(self.h_entry, 1, 1)
コード例 #33
0
ファイル: differ.py プロジェクト: BackupTheBerlios/paella-svn
 def __init__(self, app, parent, name='SuiteTraitCombo'):
     QWidget.__init__(self, parent, name)
     dbwidget(self, app)
     self.suiteCursor = Suites(self.conn)
     self.suites = self.suiteCursor.list()
     self.traits = Traits(self.conn, self.suites[0])
     self.scombo = SuiteCombo(self, self.suites)
     self.tcombo = MyCombo(self, 'TypeCombo')
     self.tcombo.fill(['template', 'script'])
     self.ubutton = KPushButton('update', self)
     self.listView = TraitList(self.app, self)
     self.vbox = QVBoxLayout(self)
     for member in ['listView', 'scombo', 'tcombo', 'ubutton']:
         widget = getattr(self, member)
         self.vbox.addWidget(widget)
     self.connect(self.scombo,
                  SIGNAL('highlighted(int)'), self.update_traits)
     self.connect(self.ubutton,
                  SIGNAL('clicked()'), self.refreshlistView)
コード例 #34
0
ファイル: scoringdialog.py プロジェクト: zero804/kajongg
 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()
コード例 #35
0
ファイル: scoringdialog.py プロジェクト: KDE/kajongg
 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()
コード例 #36
0
ファイル: humanclient.py プロジェクト: KDE/kajongg
 def __init__(self, kongs, deferred):
     KDialogIgnoringEscape.__init__(self)
     decorateWindow(self)
     self.setButtons(0)
     self.kongs = kongs
     self.selectedKong = None
     self.deferred = deferred
     layout = QVBoxLayout()
     label = QLabel(m18n('Which kong do you want to declare?'))
     layout.addWidget(label)
     layout.setAlignment(label, Qt.AlignHCenter)
     self.buttons = []
     for kong in kongs:
         button = QRadioButton((kong[0].name()), self)
         self.buttons.append(button)
         layout.addWidget(button)
         button.toggled.connect(self.toggled)
     widget = QWidget(self)
     widget.setLayout(layout)
     self.setMainWidget(widget)
コード例 #37
0
 def __init__(self, parent, action, name='MultiGameProgress'):
     QWidget.__init__(self, parent, name)
     self.app = get_application_pointer()
     self.fhandler = self.app.make_new_fileshandler()
     self.action = action
     self.game_progressBar = KProgress(self)
     self.file_progressBar = KProgress(self)
     self.file_progressBarLbl = QLabel(self)
     self.game_progressBarLbl = QLabel(self)
     self.grid = QGridLayout(self, 4, 1, 5, 7)
     self.grid.addWidget(self.file_progressBarLbl, 0, 0)
     self.grid.addWidget(self.file_progressBar, 1, 0)
     self.grid.addWidget(self.game_progressBarLbl, 2, 0)
     self.grid.addWidget(self.game_progressBar, 3, 0)
     if action == 'prepare_game':
         self.game_action = 'Prepare'
         self.fhandler._report_extract_from_installed_archive = self.report_file_extracted
     else:
         self.game_action = 'Clean up'
         self.fhandler.archivehelper.report_installed_file_handled = self.report_file_handled
コード例 #38
0
 def show(self):
     """prepare the view and show it"""
     if self.client.hasLocalServer():
         title = i18n('Local Games with Ruleset %1',
                      self.client.ruleset.name)
     else:
         title = i18n('Tables at %1', self.client.connection.url)
     decorateWindow(self, ' - '.join([self.client.name, title]))
     self.view.hideColumn(1)
     tableCount = self.view.model().rowCount(
         None) if self.view.model() else 0
     self.view.showColumn(0)
     self.view.showColumn(2)
     self.view.showColumn(4)
     if tableCount or not self.client.hasLocalServer():
         QWidget.show(self)
         if self.client.hasLocalServer():
             self.view.hideColumn(0)
             self.view.hideColumn(2)
             self.view.hideColumn(4)
コード例 #39
0
ファイル: humanclient.py プロジェクト: zero804/kajongg
 def __init__(self, kongs, deferred):
     KDialogIgnoringEscape.__init__(self)
     decorateWindow(self)
     self.setButtons(0)
     self.kongs = kongs
     self.selectedKong = None
     self.deferred = deferred
     layout = QVBoxLayout()
     label = QLabel(i18n('Which kong do you want to declare?'))
     layout.addWidget(label)
     layout.setAlignment(label, Qt.AlignHCenter)
     self.buttons = []
     for kong in kongs:
         button = QRadioButton((kong[0].name()), self)
         self.buttons.append(button)
         layout.addWidget(button)
         button.toggled.connect(self.toggled)
     widget = QWidget(self)
     widget.setLayout(layout)
     self.setMainWidget(widget)
コード例 #40
0
ファイル: scoringdialog.py プロジェクト: zero804/kajongg
 def setupUiForPlayer(self, pGrid, idx):
     """setup UI elements for a player"""
     self.spValues[idx] = QSpinBox()
     self.nameLabels[idx] = QLabel()
     self.nameLabels[idx].setBuddy(self.spValues[idx])
     self.windLabels[idx] = WindLabel()
     pGrid.addWidget(self.nameLabels[idx], idx + 2, 0)
     pGrid.addWidget(self.windLabels[idx], idx + 2, 1)
     pGrid.addWidget(self.spValues[idx], idx + 2, 2)
     self.wonBoxes[idx] = QCheckBox("")
     pGrid.addWidget(self.wonBoxes[idx], idx + 2, 3)
     self.wonBoxes[idx].clicked.connect(self.wonChanged)
     self.spValues[idx].valueChanged.connect(self.slotInputChanged)
     detailTab = QWidget()
     self.detailTabs.addTab(detailTab, '')
     self.details[idx] = QWidget()
     detailTabLayout = QVBoxLayout(detailTab)
     detailTabLayout.addWidget(self.details[idx])
     detailTabLayout.addStretch()
     self.detailsLayout[idx] = QVBoxLayout(self.details[idx])
コード例 #41
0
ファイル: scoringdialog.py プロジェクト: zero804/kajongg
 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 = Internal.app.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
コード例 #42
0
ファイル: tables.py プロジェクト: KDE/kajongg
 def show(self):
     """prepare the view and show it"""
     if self.client.hasLocalServer():
         title = m18n(
             'Local Games with Ruleset %1',
             self.client.ruleset.name)
     else:
         title = m18n('Tables at %1', self.client.connection.url)
     decorateWindow(self, ' - '.join([self.client.name, title]))
     self.view.hideColumn(1)
     tableCount = self.view.model().rowCount(
         None) if self.view.model() else 0
     self.view.showColumn(0)
     self.view.showColumn(2)
     self.view.showColumn(4)
     if tableCount or not self.client.hasLocalServer():
         QWidget.show(self)
         if self.client.hasLocalServer():
             self.view.hideColumn(0)
             self.view.hideColumn(2)
             self.view.hideColumn(4)
コード例 #43
0
ファイル: scoringdialog.py プロジェクト: KDE/kajongg
 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
コード例 #44
0
 def __init__(self, parent, suite, name='RunnerWidget'):
     QWidget.__init__(self, parent, name)
     self.app = get_application_pointer()
     cfg = self.app.umlcfg
     basefile = make_base_filesystem(suite,
                                     '%s.base' % suite,
                                     cfg=cfg,
                                     size=300,
                                     mkfs='mke2fs')
     self.bootstrapper = UmlBootstrapper(suite, basefile, cfg=self.cfg)
     self._mainbox = QVBoxLayout(self, 5, 7)
     # add label
     self.mainlabel = QLabel(self)
     self.mainlabel.setText('Bootstrapping suite %s' % suite)
     self._mainbox.addWidget(self.mainlabel)
     # add stdout viewer
     logfile = self.umlmachines.stdout_logfile.name
     self.logbrowser = LogBrowser(self, logfile)
     self._mainbox.addWidget(self.logbrowser)
     self.timer = QTimer(self)
     self.connect(self.timer, SIGNAL('timeout()'), self.update_progress)
     self.timer.startTimer(1000)
コード例 #45
0
ファイル: humanclient.py プロジェクト: zero804/kajongg
 def __init__(self, chows, propose, deferred):
     KDialogIgnoringEscape.__init__(self)
     decorateWindow(self)
     self.setButtons(KDialog.NoButton)
     self.chows = chows
     self.selectedChow = None
     self.deferred = deferred
     layout = QVBoxLayout()
     label = QLabel(i18n('Which chow do you want to expose?'))
     layout.addWidget(label)
     layout.setAlignment(label, Qt.AlignHCenter)
     self.buttons = []
     for chow in chows:
         button = QRadioButton('{}-{}-{}'.format(*(x.value for x in chow)))
         self.buttons.append(button)
         layout.addWidget(button)
         layout.setAlignment(button, Qt.AlignHCenter)
         button.toggled.connect(self.toggled)
     widget = QWidget(self)
     widget.setLayout(layout)
     self.setMainWidget(widget)
     for idx, chow in enumerate(chows):
         if chow == propose:
             self.buttons[idx].setFocus()
コード例 #46
0
ファイル: Part.py プロジェクト: patrickkidd/pksampler-0.3
 def paintEvent(self, e):
     """ Draw the border. """
     if self.drawBorder:
         p = QPainter(self)
         if self.roundCorners:
             # draw quarter-circles for borders
             p.drawArc(0, 0, self.cornerRadius, self.cornerRadius, 1440, 1440)
             p.drawArc(0, self.height() - self.cornerRadius,
                       self.cornerRadius, self.cornerRadius, 2880, 1440)
             p.drawArc(self.width() - self.cornerRadius,
                       self.height() - self.cornerRadius,
                       self.cornerRadius, self.cornerRadius, 4320, 1440)
             p.drawArc(self.width() - self.cornerRadius,
                       0, self.cornerRadius, self.cornerRadius, 5760, 1440)
             corner = self.cornerRadius / 2
             p.drawLine(corner, 0, self.width() - corner, 0)
             p.drawLine(0, corner, 0, self.height() - corner)
             p.drawLine(corner, self.height()-1,
                        self.width() - corner, self.height()-1)
             p.drawLine(self.width()-1, corner, self.width()-1,
                        self.height() - corner)
         else:
             p.drawRect(0, 0, self.width(), self.height())
     QWidget.paintEvent(self, e)
コード例 #47
0
ファイル: humanclient.py プロジェクト: KDE/kajongg
 def __init__(self, chows, propose, deferred):
     KDialogIgnoringEscape.__init__(self)
     decorateWindow(self)
     self.setButtons(KDialog.NoButton)
     self.chows = chows
     self.selectedChow = None
     self.deferred = deferred
     layout = QVBoxLayout()
     label = QLabel(m18n('Which chow do you want to expose?'))
     layout.addWidget(label)
     layout.setAlignment(label, Qt.AlignHCenter)
     self.buttons = []
     for chow in chows:
         button = QRadioButton('{}-{}-{}'.format(*(x.value for x in chow)))
         self.buttons.append(button)
         layout.addWidget(button)
         layout.setAlignment(button, Qt.AlignHCenter)
         button.toggled.connect(self.toggled)
     widget = QWidget(self)
     widget.setLayout(layout)
     self.setMainWidget(widget)
     for idx, chow in enumerate(chows):
         if chow == propose:
             self.buttons[idx].setFocus()
コード例 #48
0
 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()
class qSlicerMultiVolumeExplorerSimplifiedModuleWidget:
    def __init__(self, parent=None):
        logging.debug(
            "qSlicerMultiVolumeExplorerSimplifiedModuleWidget:init() called")
        if not parent or not hasattr(parent, "layout"):
            self.parent = slicer.qMRMLWidget()
            self.parent.setLayout(QVBoxLayout())
        else:
            self.parent = parent

        self.layout = self.parent.layout()

        self._bgMultiVolumeNode = None
        self._fgMultiVolumeNode = None

        self.styleObserverTags = []
        self.sliceWidgetsPerStyle = {}

        self.chartPopupWindow = None
        self.chartPopupSize = QSize(600, 300)
        self.chartPopupPosition = QPoint(0, 0)

    def hide(self):
        self.widget.hide()

    def show(self):
        self.widget.show()

    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 setupInputFrame(self, parent=None):
        if not parent:
            parent = self.layout
        self.bgMultiVolumeSelector = slicer.qMRMLNodeComboBox()
        self.bgMultiVolumeSelector.nodeTypes = ['vtkMRMLMultiVolumeNode']
        self.bgMultiVolumeSelector.setMRMLScene(slicer.mrmlScene)
        self.bgMultiVolumeSelector.addEnabled = 0
        self._bgMultiVolumeSelectorLabel = QLabel('Input multivolume')
        inputFrameWidget = QWidget()
        self.inputFrameLayout = QFormLayout()
        inputFrameWidget.setLayout(self.inputFrameLayout)
        self.inputFrameLayout.addRow(self._bgMultiVolumeSelectorLabel,
                                     self.bgMultiVolumeSelector)
        parent.addWidget(inputFrameWidget)

    def setupFrameControlFrame(self):
        # TODO: initialize the slider based on the contents of the labels array
        self.frameSlider = ctk.ctkSliderWidget()
        self.frameSlider.setSizePolicy(QSizePolicy.Ignored,
                                       QSizePolicy.Preferred)
        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 setupAdditionalFrames(self):
        pass

    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 setupConnections(self):
        self.parent.connect('mrmlSceneChanged(vtkMRMLScene*)',
                            self.onVCMRMLSceneChanged)
        self.bgMultiVolumeSelector.connect('currentNodeChanged(vtkMRMLNode*)',
                                           self.onBackgroundInputChanged)
        self.playButton.connect('toggled(bool)', self.onPlayButtonToggled)
        self.frameSlider.connect('valueChanged(double)', self.onSliderChanged)
        self.timer.connect('timeout()', self.goToNext)
        self.popupChartButton.connect('toggled(bool)',
                                      self.onDockChartViewToggled)

    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 dockChartView(self):
        self.chartPopupSize = self.chartPopupWindow.size
        self.chartPopupPosition = self.chartPopupWindow.pos
        self.plottingFrameLayout.addWidget(
            self._multiVolumeIntensityChart.chartView)
        self.plottingFrameLayout.addWidget(self.popupChartButton)
        self.popupChartButton.setText("Undock chart")
        self.popupChartButton.disconnect('toggled(bool)',
                                         self.onDockChartViewToggled)
        self.popupChartButton.checked = False
        self.popupChartButton.connect('toggled(bool)',
                                      self.onDockChartViewToggled)

    def onSliderChanged(self, frameId):
        if self._bgMultiVolumeNode is None:
            return
        newValue = int(frameId)
        self.setCurrentFrameNumber(newValue)

    def onVCMRMLSceneChanged(self, mrmlScene):
        logging.debug(
            "qSlicerMultiVolumeExplorerSimplifiedModuleWidget:onVCMRMLSceneChanged"
        )
        self.bgMultiVolumeSelector.setMRMLScene(slicer.mrmlScene)
        self.onBackgroundInputChanged()

    def refreshGUIForNewBackgroundImage(self):
        self._multiVolumeIntensityChart.reset()
        self.setFramesEnabled(True)
        if self._fgMultiVolumeNode and self._bgMultiVolumeNode:
            Helper.SetBgFgVolumes(self._bgMultiVolumeNode.GetID(),
                                  self._fgMultiVolumeNode.GetID())
        else:
            Helper.SetBgVolume(self._bgMultiVolumeNode.GetID())
        self.refreshFrameSlider()
        self._multiVolumeIntensityChart.bgMultiVolumeNode = self._bgMultiVolumeNode
        self.refreshObservers()

    def getBackgroundMultiVolumeNode(self):
        return self.bgMultiVolumeSelector.currentNode()

    def onBackgroundInputChanged(self):
        self._bgMultiVolumeNode = self.getBackgroundMultiVolumeNode()

        if self._bgMultiVolumeNode is not None:
            self.refreshGUIForNewBackgroundImage()
        else:
            self.setFramesEnabled(False)

    def onPlayButtonToggled(self, checked):
        if self._bgMultiVolumeNode is None:
            return
        if checked:
            self.timer.start()
            self.playButton.text = 'Stop'
        else:
            self.timer.stop()
            self.playButton.text = 'Play'

    def processEvent(self, observee, event):
        # logging.debug("processing event %s" % event)
        if self._bgMultiVolumeNode is None:
            return

        # TODO: use a timer to delay calculation and compress events
        if event == 'LeaveEvent':
            # reset all the readouts
            # TODO: reset the label text
            return

        if not self.sliceWidgetsPerStyle.has_key(observee):
            return

        interactor = observee.GetInteractor()
        self.createChart(self.sliceWidgetsPerStyle[observee],
                         interactor.GetEventPosition())

    def createChart(self, sliceWidget, position):
        self._multiVolumeIntensityChart.createChart(sliceWidget, position)

    def setCurrentFrameNumber(self, frameNumber):
        mvDisplayNode = self._bgMultiVolumeNode.GetDisplayNode()
        mvDisplayNode.SetFrameComponent(frameNumber)

    def setFramesEnabled(self, enabled):
        pass

    def refreshObservers(self):
        """ When the layout changes, drop the observers from
    all the old widgets and create new observers for the
    newly created widgets"""
        self.removeObservers()
        # get new slice nodes
        layoutManager = slicer.app.layoutManager()
        sliceNodeCount = slicer.mrmlScene.GetNumberOfNodesByClass(
            'vtkMRMLSliceNode')
        for nodeIndex in xrange(sliceNodeCount):
            # find the widget for each node in scene
            sliceNode = slicer.mrmlScene.GetNthNodeByClass(
                nodeIndex, 'vtkMRMLSliceNode')
            sliceWidget = layoutManager.sliceWidget(sliceNode.GetLayoutName())
            if sliceWidget:
                # add observers and keep track of tags
                style = sliceWidget.sliceView().interactorStyle()
                self.sliceWidgetsPerStyle[style] = sliceWidget
                events = ("MouseMoveEvent", "EnterEvent", "LeaveEvent")
                for event in events:
                    tag = style.AddObserver(event, self.processEvent)
                    self.styleObserverTags.append([style, tag])

    def removeObservers(self):
        for observee, tag in self.styleObserverTags:
            observee.RemoveObserver(tag)
        self.styleObserverTags = []
        self.sliceWidgetsPerStyle = {}

    def refreshFrameSlider(self):
        self.frameSlider.minimum = 0
        if not self._bgMultiVolumeNode:
            self.frameSlider.maximum = 0
            return
        nFrames = self._bgMultiVolumeNode.GetNumberOfFrames()
        self.frameSlider.maximum = nFrames - 1

    def goToNext(self):
        currentElement = self.frameSlider.value
        currentElement += 1
        if currentElement > self.frameSlider.maximum:
            currentElement = 0
        self.frameSlider.value = currentElement
コード例 #50
0
 def show(self):
     """not only show but also restore and raise"""
     self.activateWindow()
     self.setWindowState(self.windowState() & ~Qt.WindowMinimized)
     self.raise_()
     QWidget.show(self)
コード例 #51
0
    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)
コード例 #52
0
ファイル: mainwindow.py プロジェクト: rapropos/kajongg
 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)
コード例 #53
0
ファイル: m_idials_gui.py プロジェクト: ndevenish/DUI
    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()
コード例 #54
0
ファイル: m_idials_gui.py プロジェクト: ndevenish/DUI
class MainWidget(QMainWindow):
    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 pop_mask_list(self, mask_itm_lst):

        tmp_cmd_lst = build_mask_command_lst(mask_itm_lst)

        self.centre_par_widget.mask_page.set_par(tmp_cmd_lst)
        self.centre_par_widget.step_param_widg.setCurrentWidget(
            self.centre_par_widget.mask_page
        )

    def pop_b_centr_coord(self, new_b_centr):
        logger.info("New b_centr =", new_b_centr)
        self.centre_par_widget.b_centr_page.set_par(new_b_centr)
        self.centre_par_widget.step_param_widg.setCurrentWidget(
            self.centre_par_widget.b_centr_page
        )

    def connect_all(self):
        self.setCursor(Qt.ArrowCursor)
        self.tree_clickable = True
        self.tree_out.clicked[QModelIndex].connect(self.node_clicked)

        self.stop_run_retry.repeat_btn.clicked.connect(self.rep_clicked)
        self.stop_run_retry.run_btn.clicked.connect(self.run_clicked)
        self.stop_run_retry.stop_btn.clicked.connect(self.stop_clicked)

        self.centre_par_widget.user_changed.connect(self.cmd_changed_by_user)
        self.centre_par_widget.update_command_lst_high_level.connect(
            self.update_low_level_command_lst
        )
        self.centre_par_widget.step_param_widg.currentChanged.connect(
            self.cmd_changed_by_any
        )
        self.check_gray_outs()

    def disconnect_while_running(self):

        self.setCursor(Qt.BusyCursor)
        self.tree_clickable = False

        self.stop_run_retry.repeat_btn.setEnabled(False)
        self.stop_run_retry.run_btn.setEnabled(False)
        self.stop_run_retry.stop_btn.setEnabled(True)
        self.centre_par_widget.gray_outs_all()
        self.centre_par_widget.step_param_widg.currentWidget().my_widget.gray_me_out()

        self.user_stoped = False

    def reconnect_when_ready(self):

        self.setCursor(Qt.ArrowCursor)
        self.tree_clickable = True

        self.stop_run_retry.repeat_btn.setEnabled(False)
        self.stop_run_retry.stop_btn.setEnabled(False)
        self.stop_run_retry.run_btn.setEnabled(False)

        if self.user_stoped:
            self.idials_runner.current_node.success = None

        my_widget = self.centre_par_widget.step_param_widg.currentWidget().my_widget
        if self.idials_runner.current_node.success is None:
            self.stop_run_retry.run_btn.setEnabled(True)
            my_widget.activate_me(cur_nod=self.idials_runner.current_node)

        else:
            if self.idials_runner.current_node.ll_command_lst[0][0] != "export":
                self.stop_run_retry.repeat_btn.setEnabled(True)

            my_widget.gray_me_out()

        if self.idials_runner.current_node.ll_command_lst[0][0] == "reindex":
            self.stop_run_retry.run_btn.setEnabled(False)
            self.stop_run_retry.repeat_btn.setEnabled(False)

        self.check_gray_outs()
        self.user_stoped = False
        self.update_nav_tree()

    def chouse_if_predict_or_report(self):
        if (
            self.idials_runner.current_node.ll_command_lst[0][0]
            != "refine_bravais_settings"
        ):
            if self.view_tab_num == 0 and self.img_view.rad_but_pre_hkl.checkState():
                self.pop_busy_box(text_in_bar="Generating Predictions")
                self.idials_runner.current_node.gen_repr_n_pred(to_run="predict")
                self.close_busy_box()

            elif self.view_tab_num == 2:
                """
                ##########################################################################
                tmp_bar = ProgBarBox(min_val=0, max_val=10, text=text_in_bar)
                tmp_bar(5)
                tmp_bar.ended()
                ################################################################################
                """

                tmp_bar = ProgBarBox(min_val=0, max_val=10, text="Generating Report")
                tmp_bar(5)
                self.idials_runner.current_node.gen_repr_n_pred(to_run="report")
                tmp_bar.ended()

    def tab_changed(self, num=0):
        self.view_tab_num = num
        self.chouse_if_predict_or_report()

        update_info(self)

    def pass_parmams(self, cmd_lst):
        """(We've been passed a parameter by the external tool signal)"""

        current_parameter_widget = (
            self.centre_par_widget.step_param_widg.currentWidget()
        )
        action_name = current_parameter_widget.my_widget.command_lst[0][0]

        to_remove = """
        if (
            action_name in ["find_spots", "integrate"]
            and self.idials_runner.current_node.success is None
        ):
        """

        if (
            action_name == "find_spots"
            and self.idials_runner.current_node.success is None
        ):

            gain = cmd_lst[0]
            size = cmd_lst[1]
            nsig_b = cmd_lst[2]
            nsig_s = cmd_lst[3]
            global_threshold = cmd_lst[4]
            min_count = cmd_lst[5]

            full_command = [
                "find_spots",
                "spotfinder.threshold.dispersion.gain=" + str(gain),
                "spotfinder.threshold.dispersion.kernel_size="
                + str(size[0])
                + ","
                + str(size[1]),
                "spotfinder.threshold.dispersion.sigma_background=" + str(nsig_b),
                "spotfinder.threshold.dispersion.sigma_strong=" + str(nsig_s),
                "spotfinder.threshold.dispersion.min_local=" + str(min_count),
                "spotfinder.threshold.dispersion.global_threshold="
                + str(global_threshold),
            ]

            current_parameter_widget.my_widget.update_param_w_lst(full_command)

        else:
            logger.debug("No need to feed back params")
            """
            logger.info(
                "my_widget_now.my_widget.command_lst = %s",
                current_parameter_widget.my_widget.command_lst,
            )
            """

    def update_low_level_command_lst(self, command_lst):
        self.idials_runner.current_node.ll_command_lst = command_lst
        self.reconnect_when_ready()

    def cmd_changed_by_user(self, my_label):
        logger.debug("cmd_changed_by_user()")
        tmp_curr = self.idials_runner.current_node
        if tmp_curr.success is True:
            self.cmd_exe(["mkchi"])
            self.idials_runner.current_node.ll_command_lst = [[str(my_label)]]
            self.centre_par_widget.step_param_widg.currentWidget().my_widget.reset_par()

            path_to_mask_pickle = None
            if self.idials_runner.current_node.ll_command_lst[0][0] == "integrate":
                logger.debug("Running: try_find_prev_mask_pickle")
                path_to_mask_pickle = try_find_prev_mask_pickle(
                    self.idials_runner.current_node
                )
                if path_to_mask_pickle is not None:
                    self.pass_parmams(["lookup.mask=" + path_to_mask_pickle])

            self.cmd_exe(["clean"])

        elif tmp_curr.success is None:
            self.idials_runner.current_node.ll_command_lst[0] = [str(my_label)]
            self.reconnect_when_ready()

    def cmd_changed_by_any(self):
        tmp_curr_widg = self.centre_par_widget.step_param_widg.currentWidget()
        self.cur_cmd_name = tmp_curr_widg.my_widget.command_lst[0][0]
        self.reconnect_when_ready()

    def rep_clicked(self):
        logger.debug("rep_clicked")
        self.cmd_exe(["mksib"])
        self.cmd_exe(["clean"])
        self.check_gray_outs()

    def stop_clicked(self):
        logger.debug("\n\n <<< Stop clicked >>> \n\n")
        # TODO fix spelling on << dials_command >>
        pr_to_kill = self.idials_runner.current_node.dials_command.my_pid
        logger.debug(
            "self.idials_runner.current_node.dials_command.my_pid = %s", pr_to_kill
        )
        self.user_stoped = True
        kill_w_child(pr_to_kill)

    def run_clicked(self):
        logger.debug("run_clicked")
        logger.debug(
            "...currentWidget(ref) = %s",
            self.centre_par_widget.step_param_widg.currentWidget(),
        )

        self.img_view.draw_img_img()

        cmd_tmp = (
            self.centre_par_widget.step_param_widg.currentWidget().my_widget.command_lst
        )
        self.cmd_launch(cmd_tmp)

    def cmd_exe(self, new_cmd):
        # Running NOT in parallel
        update_info(self)
        self.idials_runner.run(command=new_cmd, ref_to_class=None)
        self.check_reindex_pop()
        self.reconnect_when_ready()

    def cmd_launch(self, new_cmd):
        # Running WITH threading
        self.cli_out.clear()
        self.cli_out.make_green()
        self.txt_bar.start_motion()
        self.txt_bar.setText("Running")
        self.disconnect_while_running()
        self.custom_thread(new_cmd, self.idials_runner)

    def update_after_finished(self):
        self.chouse_if_predict_or_report()
        update_info(self)

        self.txt_bar.end_motion()
        self.just_reindexed = False

        tmp_curr = self.idials_runner.current_node

        prn_lst_lst_cmd(tmp_curr)

        if (
            tmp_curr.ll_command_lst[0][0] == "refine_bravais_settings"
            and tmp_curr.success is True
        ):
            self.idials_runner.run(command=["mkchi"], ref_to_class=None)
            self.idials_runner.current_node.ll_command_lst = [["reindex"]]

        elif tmp_curr.ll_command_lst[0][0] == "reindex" and tmp_curr.success is True:

            self.just_reindexed = True
            try:
                self.my_pop.close()
            except BaseException as e:
                # We don't want to catch bare exceptions but don't know
                # what this was supposed to catch. Log it.
                logger.debug(
                    "Caught unknown exception type %s: %s", type(e).__name__, e
                )
                logger.debug("no need to close reindex table")

        elif tmp_curr.ll_command_lst[0][0] == "export" and tmp_curr.success is True:
            self.gui2_log = try_move_last_info(tmp_curr, self.gui2_log)

        self.check_reindex_pop()
        self.check_gray_outs()
        self.reconnect_when_ready()

        if (
            tmp_curr.ll_command_lst[0][0] == "generate_mask"
            and tmp_curr.success is True
        ):
            self.img_view.my_painter.reset_mask_tool(None)

        elif (
            tmp_curr.ll_command_lst[0][0] == "modify_geometry"
            and tmp_curr.success is True
        ):
            self.img_view.my_painter.reset_bc_tool(None)

        with open(self.storage_path + "/dui_files/bkp.pickle", "wb") as bkp_out:
            pickle.dump(self.idials_runner, bkp_out)

    def pop_busy_box(self, text_in_bar):
        #logger.info("OPENING busy pop bar with the text: ", text_in_bar)
        if (
            self.idials_runner.current_node.ll_command_lst[0][0]
            != "refine_bravais_settings"
        ):
            self.my_bar = ProgBarBox(min_val=0, max_val=10, text=text_in_bar)
            self.my_bar(5)

    def close_busy_box(self):
        logger.info("trying to close busy pop bar")
        try:
            self.my_bar.ended()

        except AttributeError:
            logger.info("no need to close busy pop bar")

    def check_gray_outs(self):
        tmp_curr = self.idials_runner.current_node
        if tmp_curr.success is not True:
            tmp_curr = tmp_curr.prev_step

        # TODO fix "generate_mask" and "modify_geometry" : it should be the same as the previous step

        # This dictionary defines which tasks can be performed at each step and
        # which should be grayed out
        cmd_connects = {
            "Root": ["import"],
            "import": ["find_spots"],
            "find_spots": ["index"],
            "index": ["refine_bravais_settings", "refine", "integrate"],
            "refine_bravais_settings": [None],
            "reindex": ["refine", "integrate", "index"],
            "refine": [
                "refine_bravais_settings",
                "refine",
                "integrate",
                "index",
            ],
            "integrate": ["symmetry", "scale", "export", "index", "export"],
            "symmetry": ["refine_bravais_settings", "scale", "export"],
            "scale": ["refine_bravais_settings", "symmetry", "export"],
            "export": [None],
            "generate_mask": ["find_spots"],
            "modify_geometry": ["find_spots"],
            "None": [None],
        }

        more_conservative = """
        cmd_connects = {
            "Root": ["import"],
            "import": ["find_spots"],
            "find_spots": ["index"],
            "index": ["refine_bravais_settings", "refine", "integrate"],
            "refine_bravais_settings": [None],
            "reindex": ["refine", "integrate"],
            "refine": ["refine_bravais_settings", "refine", "integrate"],
            "integrate": ["symmetry", "scale", "export"],
            "symmetry": ["scale", "export"],
            "scale": ["symmetry", "export"],
            "export": [None],
            "generate_mask": ["find_spots"],
            "modify_geometry":["find_spots"],
            "None": [None],
        }
        """

        lst_nxt = cmd_connects[str(tmp_curr.ll_command_lst[0][0])]
        self.centre_par_widget.gray_outs_from_lst(lst_nxt)

    def check_reindex_pop(self):
        tmp_curr = self.idials_runner.current_node
        #logger.info("\n_________________________ check_reindex_pop 01 \n")
        if tmp_curr.ll_command_lst[0][0] == "reindex" and not self.just_reindexed:
            #logger.info("\n_________________________ check_reindex_pop 02 \n")

            try:
                self.my_pop = MyReindexOpts()
                self.my_pop.set_ref(
                    in_json_path=tmp_curr.prev_step.json_file_out,
                    lin_num=tmp_curr.prev_step.lin_num,
                )
                self.my_pop.my_inner_table.opt_signal.connect(self.opt_dobl_clicked)

            except Exception as my_err:
                logger.info("ERROR in check_reindex_pop(m_idials_gui) \n")
                logger.info("str(my_err) = ", str(my_err))
                logger.info("my_err.__doc__ = ", my_err.__doc__)
                logger.info("my_err.message = ", my_err.message)

            # TODO find an elegant way to interrupt and remove nodes

        else:
            try:
                self.my_pop.close()
            except BaseException as e:
                # We don't want to catch bare exceptions but don't know
                # what this was supposed to catch. Log it.
                logger.debug(
                    "Caught unknown exception type %s: %s", type(e).__name__, e
                )
                logger.debug("no need to close reindex table")

        self.just_reindexed = False

    def update_nav_tree(self):
        self.tree_out.update_me(
            self.idials_runner.step_list[0], self.idials_runner.current_line
        )
        update_pbar_msg(self)
        self.img_view.my_painter.repaint()

    def after_failed(self):
        logger.info("\n FAILED STEP:")
        self.update_nav_tree()
        self.txt_bar.end_motion()

        curr_step = self.idials_runner.current_node

        for err_lin in curr_step.dials_command.tmp_std_all:
            logger.debug(err_lin)

        err_log_file_out = (
            self.storage_path
            + "/dui_files"
            + os.sep
            + str(curr_step.lin_num)
            + "_err_out.log"
        )

        logger.info("\n ERROR \n err_log_file_out = %s %s", err_log_file_out, "\n")

        fil_obj = open(err_log_file_out, "w")
        for err_lin in curr_step.dials_command.tmp_std_all:
            fil_obj.write(err_lin)
            fil_obj.write("\n")

        fil_obj.close()
        self.idials_runner.current_node.err_file_out = err_log_file_out

    def opt_dobl_clicked(self, row):
        re_idx = row + 1
        logger.debug("Solution clicked = %s", re_idx)
        cmd_tmp = ["reindex", "solution=" + str(re_idx)]
        self.cmd_launch([cmd_tmp])

    def node_clicked(self, it_index):

        logger.debug("\n it_index = %s", it_index)
        logger.debug(" type(it_index) = %s", type(it_index))

        if self.tree_clickable:
            # TODO Think of a more robust way to "disconnect" ... next line
            try:
                self.centre_par_widget.update_command_lst_high_level.disconnect(
                    self.update_low_level_command_lst
                )
            except BaseException as e:
                # We don't want to catch bare exceptions but don't know
                # what this was supposed to catch. Log it.
                logger.info(" Caught unknown exception type %s: %s", type(e).__name__, e)
                logger.info("\n Tst A1 \n")

            item = self.tree_out.std_mod.itemFromIndex(it_index)
            prn_lst_lst_cmd(item.idials_node)
            lin_num = item.idials_node.lin_num
            cmd_ovr = "goto " + str(lin_num)
            self.cmd_exe(cmd_ovr)

            self.centre_par_widget.set_widget(
                nxt_cmd=item.idials_node.ll_command_lst[0][0],
                curr_step=self.idials_runner.current_node,
            )

            self.check_reindex_pop()

            self.chouse_if_predict_or_report()
            update_info(self)

            self.check_gray_outs()
            self.reconnect_when_ready()

            self.centre_par_widget.update_command_lst_high_level.connect(
                self.update_low_level_command_lst
            )

    def refresh_my_gui(self):

        lin_num = self.idials_runner.current_node.lin_num
        logger.debug("doing goto:  %s", lin_num)
        cmd_ovr = "goto " + str(lin_num)
        self.cmd_exe(cmd_ovr)
        self.centre_par_widget.set_widget(
            nxt_cmd=self.idials_runner.current_node.ll_command_lst[0][0],
            curr_step=self.idials_runner.current_node,
        )

        self.check_reindex_pop()
        self.chouse_if_predict_or_report()
        update_info(self)
        self.check_gray_outs()
        self.reconnect_when_ready()

        logger.info("\n ... recovering from previous run of GUI \n")

    def closeEvent(self, event):
        if self.my_pop:
            self.my_pop.close()
コード例 #55
0
ファイル: chat.py プロジェクト: KDE/kajongg
 def isVisible(self):
     """not only visible but also not minimized"""
     return QWidget.isVisible(self) and not self.windowState() & Qt.WindowMinimized
コード例 #56
0
 def hideEvent(self, event):
     """close all differ dialogs"""
     for differ in self.rulesetView.differs:
         differ.hide()
         del differ
     QWidget.hideEvent(self, event)
コード例 #57
0
 def isVisible(self):
     """not only visible but also not minimized"""
     return QWidget.isVisible(
         self) and not self.windowState() & Qt.WindowMinimized
コード例 #58
0
ファイル: scoringdialog.py プロジェクト: zero804/kajongg
 def show(self):
     """only now compute content"""
     if self.game and not self.game.finished():
         self.slotInputChanged()
         QWidget.show(self)