예제 #1
0
파일: gui.py 프로젝트: tansir1/ReverseAStar
 def _buildSetupPanel(self):
     '''
     Creates the sub-panel containing control widgets for re-initializing 
     the world on demand.
     '''
     self._percentLbl = QLabel("%")
     self._setupBtn = QPushButton("Setup", self._window)
     self._setupBtn.clicked.connect(self._onSetup)
     
     self._percentObstacleSldr = QSlider(Qt.Horizontal, self._window)
     self._percentObstacleSldr.setTickPosition(QSlider.TickPosition.TicksBelow)
     self._percentObstacleSldr.setTickInterval(10)
     self._percentObstacleSldr.setMinimum(0)
     self._percentObstacleSldr.setMaximum(100)
     self._percentObstacleSldr.valueChanged.connect(self._onPercentSlideChange)
     self._percentObstacleSldr.setValue(33)
     
     layout = QGridLayout()
     layout.addWidget(self._setupBtn, 0, 0, 1, 2)
     layout.addWidget(QLabel("Percent Occupied:"), 1, 0)
     layout.addWidget(self._percentLbl, 1, 1)
     layout.addWidget(self._percentObstacleSldr, 2, 0, 1, 2)
     
     grpBx = QGroupBox("Setup Controls")
     grpBx.setLayout(layout)
     grpBx.setSizePolicy(QSizePolicy.Minimum, QSizePolicy.Fixed)
     return grpBx        
예제 #2
0
    def __init__(self, group_name, name_list, param_dict, help_instance = None, handler = None, help_dict = None):
        QGroupBox.__init__(self, group_name)
        the_layout = QVBoxLayout()
        the_layout.setSpacing(5)
        the_layout.setContentsMargins(1, 1, 1, 1)
        self.setLayout(the_layout)
        self.widget_dict = {}
        self.is_popup = False
        self.param_dict = param_dict
        for txt in name_list:
            qh = QHBoxLayout()
            cb = QCheckBox(txt)
            qh.addWidget(cb)
            cb.setFont(QFont('SansSerif', 12))
            param_widgets = {}
            for key, val in param_dict.items():
                if type(val) == list: #
                    param_widgets[key] = qHotField(key, type(val[0]), val[0],  value_list=val, pos="top")
                else:
                    param_widgets[key] = qHotField(key, type(val), val, pos="top")
                qh.addWidget(param_widgets[key])

            qh.addStretch()
            the_layout.addLayout(qh)
            if handler != None:
                cb.toggled.connect(handler)
            self.widget_dict[txt] = [cb, param_widgets]
            if (help_dict != None) and (help_instance != None):
                if txt in help_dict:
                    help_button_widget = help_instance.create_button(txt, help_dict[txt])
                    qh.addWidget(help_button_widget)
        return
예제 #3
0
    def __init__(self, parent,silhouette,completeness,homogeneity,v_score,AMI,ARS):
        QDialog.__init__( self, parent )
        layout = QVBoxLayout()

        viewLayout = QFormLayout()
        viewLayout.addRow(QLabel('Silhouette score: '),QLabel(silhouette))
        viewLayout.addRow(QLabel('Completeness: '),QLabel(completeness))
        viewLayout.addRow(QLabel('Homogeneity: '),QLabel(homogeneity))
        viewLayout.addRow(QLabel('V score: '),QLabel(v_score))
        viewLayout.addRow(QLabel('Adjusted mutual information: '),QLabel(AMI))
        viewLayout.addRow(QLabel('Adjusted Rand score: '),QLabel(ARS))

        viewWidget = QGroupBox()
        viewWidget.setLayout(viewLayout)

        layout.addWidget(viewWidget)

        #Accept cancel
        self.acceptButton = QPushButton('Ok')
        self.cancelButton = QPushButton('Cancel')

        self.acceptButton.clicked.connect(self.accept)
        self.cancelButton.clicked.connect(self.reject)

        hbox = QHBoxLayout()
        hbox.addWidget(self.acceptButton)
        hbox.addWidget(self.cancelButton)
        ac = QWidget()
        ac.setLayout(hbox)
        layout.addWidget(ac)
        self.setLayout(layout)
예제 #4
0
 def __init__(self, *args, **kwargs ):
     
     QWidget.__init__( self, *args )
     
     title = ""
     if kwargs.has_key( 'title' ):
         title = kwargs['title']
         
     self.infoPath = cmds.about(pd=True) + "/sg/fingerWeightCopy/Widget_LoadVertex_%s.txt" % title
     sgCmds.makeFile( self.infoPath )
     
     vLayout = QVBoxLayout( self ); vLayout.setContentsMargins(0,0,0,0)
     
     groupBox = QGroupBox( title )
     groupBox.setAlignment( QtCore.Qt.AlignCenter )
     vLayout.addWidget( groupBox )
     
     hLayout = QHBoxLayout()
     lineEdit = QLineEdit()
     button   = QPushButton("Load"); button.setFixedWidth( 50 )
     hLayout.addWidget( lineEdit )
     hLayout.addWidget( button )
     
     groupBox.setLayout( hLayout )
     
     self.lineEdit = lineEdit
     
     QtCore.QObject.connect( button, QtCore.SIGNAL( "clicked()" ), self.loadVertex )
     self.loadInfo()
예제 #5
0
    def setup_general_server_group(self):
        """ Setup the 'Server' group in the 'General' tab.

        Returns:
        --------
        A QGroupBox widget

        """
        group = QGroupBox('Server')
        layout = QFormLayout()
        layout.setFieldGrowthPolicy(QFormLayout.AllNonFixedFieldsGrow)

        email, password = self.auth_credentials()

        self.email_edit = QLineEdit(email)
        self.email_edit.textChanged.connect(self.update_auth)
        layout.addRow('Email', self.email_edit)

        self.password_edit = QLineEdit(password)
        self.password_edit.setEchoMode(QLineEdit.Password)
        self.password_edit.textChanged.connect(self.update_auth)
        layout.addRow('Password', self.password_edit)

        show_password_widget = QCheckBox()
        show_password_widget.stateChanged.connect(self.on_show_password_toggle)
        layout.addRow('Show password', show_password_widget)

        test_authentication_button = QPushButton('Test Authentication')
        test_authentication_button.clicked.connect(self.on_test_authentication)
        layout.addRow(test_authentication_button)

        group.setLayout(layout)
        return group
예제 #6
0
파일: gui.py 프로젝트: tansir1/ReverseAStar
    def _buildResultsPanel(self):
        '''
        Creates the sub-panel containing displays widgets for informing the 
        user on the results of running the algorithm.
        '''        
        self._doneLbl = QLabel("No", self._window)
        self._solvableLbl = QLabel("Yes", self._window)
        
        #_doneLbl is highlighted green upon successful algorithm completion
        pal = self._doneLbl.palette()
        pal.setColor(QPalette.Window, Qt.green)
        self._doneLbl.setPalette(pal)

        #_solvableLbl is highlighted red if the world model isn't solvable
        pal = self._solvableLbl.palette()
        pal.setColor(QPalette.Window, Qt.red)
        self._solvableLbl.setPalette(pal)          
        
        layout = QGridLayout()
        layout.addWidget(QLabel("Path Found:"), 0, 0)
        layout.addWidget(self._doneLbl, 0, 1)
        layout.addWidget(QLabel("Is Solvable:"), 1, 0)
        layout.addWidget(self._solvableLbl, 1, 1)
        
        grpBx = QGroupBox("Results")
        grpBx.setLayout(layout)
        grpBx.setSizePolicy(QSizePolicy.Minimum, QSizePolicy.Fixed)
        return grpBx
예제 #7
0
 def __init__(self, title, *args, **kwargs ):
     
     QWidget.__init__( self, *args )
     
     self.infoPath = cmds.about(pd=True) + "/sg/fingerWeightCopy/Widget_loadJoints_%s.txt" % title
     sgCmds.makeFile( self.infoPath )
     
     layout = QVBoxLayout( self ); layout.setContentsMargins(0,0,0,0)
     
     groupBox = QGroupBox( title )
     layout.addWidget( groupBox )
     
     baseLayout = QVBoxLayout()
     groupBox.setLayout( baseLayout )
     
     listWidget = QListWidget()
     
     hl_buttons = QHBoxLayout(); hl_buttons.setSpacing( 5 )
     b_addSelected = QPushButton( "Add Selected" )
     b_clear = QPushButton( "Clear" )
     
     hl_buttons.addWidget( b_addSelected )
     hl_buttons.addWidget( b_clear )
     
     baseLayout.addWidget( listWidget )
     baseLayout.addLayout( hl_buttons )
     
     self.listWidget = listWidget
     
     QtCore.QObject.connect( listWidget, QtCore.SIGNAL( "itemClicked(QListWidgetItem*)" ), self.selectJointFromItem )
     QtCore.QObject.connect( b_addSelected, QtCore.SIGNAL("clicked()"), self.addSelected )
     QtCore.QObject.connect( b_clear, QtCore.SIGNAL( "clicked()" ), self.clearSelected )
     
     self.otherWidget = None        
     self.loadInfo()
예제 #8
0
파일: FilterBox.py 프로젝트: LLNL/boxfish
    def buildWorkFrame(self):
        """Creates the grouped set of widgets that allow users to build
           basic Clause objects.
        """
        groupBox = QGroupBox("Clause Workspace")
        layout = QHBoxLayout(groupBox)

        attributeCompleter = QCompleter(self.attributes)
        attributeCompleter.setCompletionMode(QCompleter.InlineCompletion)
        self.dropAttribute = DropLineEdit(self, self.mframe.agent.datatree, "",
            attributeCompleter)
        self.dropRelation = DropTextLabel("__")
        self.dropValue = FilterValueLineEdit(groupBox,
            self.mframe.agent.datatree, self.dropAttribute)

        # Clear dropValue when dropAttribute changes
        self.dropAttribute.textChanged.connect(self.dropValue.clear)

        # Enter in dropValue works like addButton
        self.dropValue.returnPressed.connect(self.addClause)

        self.addButton = QPushButton("Add", groupBox)
        self.addButton.clicked.connect(self.addClause)
        layout.addWidget(self.dropAttribute)
        layout.addItem(QSpacerItem(5,5))
        layout.addWidget(self.dropRelation)
        layout.addItem(QSpacerItem(5,5))
        layout.addWidget(self.dropValue)
        layout.addItem(QSpacerItem(5,5))
        layout.addWidget(self.addButton)

        groupBox.setLayout(layout)
        return groupBox
예제 #9
0
파일: gui.py 프로젝트: tansir1/ReverseAStar
 def _buildSpeedPanel(self):
     '''
     Creates the sub-panel containing control widgets for controlling the 
     speed of execution of the algorithm.
     '''
     self._runBtn = QPushButton("Run", self._window)
     self._stepBtn = QPushButton("Step Once", self._window)        
     self._runBtn.clicked.connect(self._onRun)
     self._stepBtn.clicked.connect(self._onStep)        
     
     slowRadio = QRadioButton('Slow', self._window)
     medRadio = QRadioButton('Medium', self._window)
     fastRadio = QRadioButton('Fast', self._window)
     notVisRadio = QRadioButton('Not visible', self._window)
     slowRadio.setChecked(True)        
     
     self._speedGroup = QButtonGroup(self._window)
     self._speedGroup.addButton(slowRadio, 0)
     self._speedGroup.addButton(medRadio, 1)
     self._speedGroup.addButton(fastRadio, 2)
     self._speedGroup.addButton(notVisRadio, 3)
     self._speedGroup.buttonClicked.connect(self._onSpeedChange)
       
     layout = QVBoxLayout()
     layout.addWidget(self._runBtn)
     layout.addWidget(self._stepBtn)
     layout.addWidget(slowRadio)
     layout.addWidget(medRadio)
     layout.addWidget(fastRadio)
     layout.addWidget(notVisRadio)
     
     grpBx = QGroupBox("Run Controls")
     grpBx.setLayout(layout)
     grpBx.setSizePolicy(QSizePolicy.Minimum, QSizePolicy.Fixed)
     return grpBx
예제 #10
0
    def __init__(self,parent=None):
        super(QtReducePreferencesComputation,self).__init__(parent)

        reduceGroup = QGroupBox("Reduce")

        self.reduceBinary = QLineEdit()

        # font = self.reduceBinary.font()
        # font.setFamily(QSettings().value("worksheet/fontfamily",
        #                                QtReduceDefaults.FONTFAMILY))
        # self.reduceBinary.setFont(font)

        self.reduceBinary.setText(QSettings().value("computation/reduce",
                                                    QtReduceDefaults.REDUCE))

        self.reduceBinary.editingFinished.connect(self.editingFinishedHandler)

        reduceLayout = QFormLayout()
        reduceLayout.addRow(self.tr("Reduce Binary"),self.reduceBinary)

        reduceGroup.setLayout(reduceLayout)

        mainLayout = QVBoxLayout()
        mainLayout.addWidget(reduceGroup)

        self.setLayout(mainLayout)
예제 #11
0
 def __init__(self, group_name, name_list, param_type = int, default_param = None, help_instance = None, handler = None, help_dict = None):
     QGroupBox.__init__(self, group_name)
     the_layout = QVBoxLayout()
     the_layout.setSpacing(5)
     the_layout.setContentsMargins(1, 1, 1, 1)
     self.setLayout(the_layout)
     self.widget_dict = OrderedDict([])
     self.mytype= param_type
     self.is_popup = False
     if default_param == None:
         default_param = ""
     self.default_param = default_param
     for txt in name_list:
         qh = QHBoxLayout()
         cb = QCheckBox(txt)
         cb.setFont(QFont('SansSerif', 12))
         efield = QLineEdit(str(default_param))
         efield.setFont(QFont('SansSerif', 10))
         efield.setMaximumWidth(25)
         qh.addWidget(cb)
         qh.addStretch()
         qh.addWidget(efield)
         the_layout.addLayout(qh)
         if handler != None:
             cb.toggled.connect(handler)
         self.widget_dict[txt] = [cb, efield]
         if (help_dict != None) and (help_instance != None):
             if txt in help_dict:
                 help_button_widget = help_instance.create_button(txt, help_dict[txt])
                 qh.addWidget(help_button_widget)
     return
예제 #12
0
    def __init__(self,parent=None):
        super(QtReducePreferencesWorksheet,self).__init__(parent)

        fontGroup = QGroupBox(self.tr("Fonts"))

        self.fontCombo = QtReduceFontComboBox(self)
        self.setFocusPolicy(Qt.NoFocus)
        self.fontCombo.setEditable(False)
        self.fontCombo.setCurrentFont(self.parent().parent().controller.view.font())

        self.sizeCombo = QtReduceFontSizeComboBox()
        self.sizeComboFs = QtReduceFontSizeComboBoxFs()
        self.findSizes(self.fontCombo.currentFont())
        self.fontCombo.currentFontChanged.connect(self.findSizes)

        fontLayout = QFormLayout()
        fontLayout.addRow(self.tr("General Worksheet Font"),self.fontCombo)
        fontLayout.addRow(self.tr("Font Size"),self.sizeCombo)
        fontLayout.addRow(self.tr("Full Screen Font Size"),self.sizeComboFs)

        fontGroup.setLayout(fontLayout)

        mainLayout = QVBoxLayout()
        mainLayout.addWidget(fontGroup)

        self.setLayout(mainLayout)
예제 #13
0
    def buildAttributeGroupBox(self):
        """Layout/construct the AttributeScene UI for this tab."""
        groupBox = QGroupBox("Attribute Policy (Colors)")
        layout = QVBoxLayout()

        # agent.propagate_attribute_scenes
        self.attr_propagate = QCheckBox(
            "Propagate attribute scene " + "information (e.g. color maps) to other modules."
        )
        self.attr_propagate.setChecked(self.agent.propagate_attribute_scenes)
        self.attr_propagate.stateChanged.connect(self.attrPropagateChanged)
        # We only allow this change if the parent does not propagate
        if self.agent.parent().propagate_attribute_scenes:
            self.attr_propagate.setDisabled(True)

        # agent.apply_attribute_scenes
        self.attr_applyScene = QCheckBox("Apply attribute scene information " + "from other modules.")
        self.attr_applyScene.setChecked(self.agent.apply_attribute_scenes)
        self.attr_applyScene.stateChanged.connect(self.attrApplyChanged)

        layout.addWidget(self.attr_applyScene)
        layout.addItem(QSpacerItem(5, 5))
        layout.addWidget(self.attr_propagate)
        groupBox.setLayout(layout)
        return groupBox
예제 #14
0
파일: accd.py 프로젝트: Sugz/Python
    def __init__( self, accordion, title, widget ):
        QGroupBox.__init__(self, accordion)

        # create the layout
        layout = QVBoxLayout()
        layout.setContentsMargins(6, 6, 6, 6)
        layout.setSpacing(0)
        layout.addWidget(widget)

        self._accordianWidget = accordion
        self._rolloutStyle = 2
        self._dragDropMode = 0

        self.setAcceptDrops(True)
        self.setLayout(layout)
        self.setContextMenuPolicy(Qt.CustomContextMenu)
        self.customContextMenuRequested.connect(self.showMenu)

        # create custom properties
        self._widget = widget
        self._collapsed = False
        self._collapsible = True
        self._clicked = False
        self._customData = {}

        # set common properties
        self.setTitle(title)
예제 #15
0
    def _initUI(self):
        # Variables
        result = self.result()
        transitions = sorted(result.iter_transitions())
        transition0 = transitions[0]
        model = _TransitionListModel(transitions)

        # Widgets
        self._chk_errorbar = QCheckBox("Show error bars")
        self._chk_errorbar.setChecked(True)

        self._cb_transition = QComboBox()
        self._cb_transition.setModel(model)
        self._cb_transition.setCurrentIndex(0)

        self._chk_pg = QCheckBox("No absorption, no fluorescence")
        state = result.exists(transition0, True, False, False, False)
        self._chk_pg.setEnabled(state)
        self._chk_pg.setChecked(state)

        self._chk_eg = QCheckBox("With absorption, no fluorescence")
        state = result.exists(transition0, True, True, False, False)
        self._chk_eg.setEnabled(state)
        self._chk_eg.setChecked(state)

        self._chk_pt = QCheckBox("No absorption, with fluorescence")
        state = result.exists(transition0, True, False, True, True)
        self._chk_pt.setEnabled(state)
        self._chk_pt.setChecked(state)

        self._chk_et = QCheckBox("With absorption, with fluorescence")
        state = result.exists(transition0, True, True, True, True)
        self._chk_et.setEnabled(state)
        self._chk_et.setChecked(state)

        # Layouts
        layout = _ResultToolItem._initUI(self)
        layout.addRow(self._chk_errorbar)
        layout.addRow("Transition", self._cb_transition)

        boxlayout = QVBoxLayout()
        boxlayout.addWidget(self._chk_pg)
        boxlayout.addWidget(self._chk_eg)
        boxlayout.addWidget(self._chk_pt)
        boxlayout.addWidget(self._chk_et)

        box_generated = QGroupBox("Curves")
        box_generated.setLayout(boxlayout)
        layout.addRow(box_generated)

        # Signals
        self._cb_transition.currentIndexChanged.connect(self._onTransitionChanged)
        self._chk_pg.stateChanged.connect(self.stateChanged)
        self._chk_eg.stateChanged.connect(self.stateChanged)
        self._chk_pt.stateChanged.connect(self.stateChanged)
        self._chk_et.stateChanged.connect(self.stateChanged)
        self._chk_errorbar.stateChanged.connect(self.stateChanged)

        return layout
	def __init__(self, renderController, parent=None):
		super(RenderSlicerParamWidget, self).__init__(parent=parent)

		self.renderController = renderController
		self.renderController.slicesChanged.connect(self.setSlices)
		self.renderController.clippingBoxChanged.connect(self.showsClippingBox)
		self.renderController.clippingPlanesChanged.connect(self.showsClippingPlanes)

		self.sliceLabelTexts = ["Axial:", "Coronal:", "Sagittal:"]
		self.sliceLabels = [QLabel(text) for text in self.sliceLabelTexts]
		self.sliceCheckBoxes = [QCheckBox() for i in range(3)]
		for index in range(3):
			self.sliceCheckBoxes[index].clicked.connect(self.checkBoxChanged)
			self.sliceLabels[index].setAlignment(Qt.AlignRight | Qt.AlignVCenter)
			self.sliceCheckBoxes[index].setEnabled(True)

		slicesLayout = QGridLayout()
		slicesLayout.setAlignment(Qt.AlignTop)
		for index in range(3):
			slicesLayout.addWidget(self.sliceLabels[index], index+1, 0)
			slicesLayout.addWidget(self.sliceCheckBoxes[index], index+1, 1)

		self.slicesGroupBox = QGroupBox()
		self.slicesGroupBox.setTitle("Visible slices")
		self.slicesGroupBox.setLayout(slicesLayout)

		# Create option to show clipping box
		self.clippingCheckBox = QCheckBox()
		self.clippingCheckBox.setChecked(self.renderController.clippingBox)
		self.clippingCheckBox.clicked.connect(self.clippingCheckBoxChanged)
		self.clippingPlanesCheckBox = QCheckBox()
		self.clippingPlanesCheckBox.setChecked(self.renderController.clippingPlanes)
		self.clippingPlanesCheckBox.clicked.connect(self.clippingPlanesCheckBoxChanged)
		self.resetButton = QPushButton("Reset")
		self.resetButton.clicked.connect(self.resetClippingBox)

		clippingLabel = QLabel("Clipping box:")
		clippingLabel.setAlignment(Qt.AlignRight | Qt.AlignVCenter)
		clippingPlanesLabel = QLabel("Clipping planes:")
		clippingPlanesLabel.setAlignment(Qt.AlignRight | Qt.AlignVCenter)

		clipLayout = QGridLayout()
		clipLayout.addWidget(clippingLabel, 0, 0)
		clipLayout.addWidget(self.clippingCheckBox, 0, 1)
		clipLayout.addWidget(clippingPlanesLabel, 1, 0)
		clipLayout.addWidget(self.clippingPlanesCheckBox, 1, 1)
		clipLayout.addWidget(self.resetButton, 2, 0)

		self.clippingGroupBox = QGroupBox()
		self.clippingGroupBox.setTitle("Clipping box")
		self.clippingGroupBox.setLayout(clipLayout)

		# Create a nice layout for the labels
		layout = QGridLayout()
		layout.setAlignment(Qt.AlignTop)
		layout.addWidget(self.slicesGroupBox, 0, 0)
		layout.addWidget(self.clippingGroupBox, 0, 1)
		self.setLayout(layout)
예제 #17
0
파일: ui_editTeam.py 프로젝트: LS80/FFL
 def __init__(self, title, labels):
     QGroupBox.__init__(self, title)
     self.layout = QBoxLayout(QBoxLayout.LeftToRight)
     self.buttons = {}
     for label in labels:
         button = QRadioButton(label)
         self.buttons[label] = button
         self.layout.addWidget(button)
     self.setLayout(self.layout)
예제 #18
0
    def create_groupbox_layout(self, is_vertical, parent, label, owner):
        """ Returns a new GUI toolkit neutral vertical layout manager for a
            groupbox.
        """
        gb = QGroupBox(label, check_parent(parent))
        gb.owner = owner
        bl = self.create_box_layout(is_vertical)
        gb.setLayout(bl())

        return (control_adapter_for(gb), bl)
class ElastixMainDialog(QDialog):
	"""
	ElastixMainDialog
	"""

	def __init__(self, parent):
		super(ElastixMainDialog, self).__init__(parent)
		self.transformation = None

		self.transformations = AppResources.elastixTemplates()
		self.radioButtons = []
		for transformation in self.transformations:
			self.radioButtons.append(QRadioButton(transformation.name))
		self.radioButtons.append(QRadioButton("Load custom parameter file..."))
		self.radioButtons[0].setChecked(True)

		self.nextButton = QPushButton("Next")
		self.nextButton.clicked.connect(self.next)
		self.cancelButton = QPushButton("Cancel")
		self.cancelButton.clicked.connect(self.cancel)

		groupLayout = QVBoxLayout()
		for radioButton in self.radioButtons:
			groupLayout.addWidget(radioButton)
		
		self.groupBox = QGroupBox("Choose parameter file")
		self.groupBox.setLayout(groupLayout)

		self.setModal(True)

		layout = QGridLayout()
		layout.setAlignment(Qt.AlignTop)
		layout.addWidget(self.groupBox, 0, 0, 1, 2)
		layout.addWidget(self.cancelButton, 1, 0)
		layout.addWidget(self.nextButton, 1, 1)
		self.setLayout(layout)

	@Slot()
	def next(self):
		selectedIndex = 0
		for index in range(len(self.radioButtons)):
			radioButton = self.radioButtons[index]
			if radioButton.isChecked():
				selectedIndex = index
		if selectedIndex == len(self.transformations):
			# load custom transformation
			self.accept()
		else:
			# load choosen transformation
			self.transformation = self.transformations[selectedIndex]
			self.accept()

	@Slot()
	def cancel(self):
		self.reject()
예제 #20
0
 def __init__(self, text_list, group_name=None, handler = None):
     QGroupBox.__init__(self, group_name)
     the_layout = QVBoxLayout()
     self.setLayout(the_layout)
     self.widget_dict = OrderedDict([])
     for txt in text_list:
         cb = QCheckBox(txt)
         the_layout.addWidget(cb)
         if handler != None:
             cb.toggled.connect(handler)
         self.widget_dict[txt] = cb
     return
예제 #21
0
    def initUI(self):
        grp = QGroupBox('Anim Munge')
        grplay = QGridLayout()
        self.bf1mode = QCheckBox()
        grplay.addWidget(QLabel('<b>SWBF1</b>'), 0, 1)
        grplay.addWidget(self.bf1mode, 0, 2)
        grplay.addWidget(QLabel('<b>Input</b>'), 1, 1)
        grplay.addWidget(QLabel('<b>Output</b>'), 1, 3)
        self.infiles = QListWidget()
        self.infiles.setMinimumWidth(150)
        self.infiles.addItems([os.path.basename(item) for item in self.files])
        grplay.addWidget(self.infiles, 2, 1, 1, 2)
        self.outfiles = QListWidget()
        self.outfiles.setMinimumWidth(150)
        grplay.addWidget(self.outfiles, 2, 3, 1, 2)
        self.add_params = QLineEdit()
        self.add_params.setText('Additional Params')
        self.add_params.setToolTip('<b>Additional Munge Parameters.</b> Like scale 1.5')
        grplay.addWidget(self.add_params, 0, 3, 1, 2)

        self.statlabel = QLabel('<b>AnimMunger</b>')
        grplay.addWidget(self.statlabel, 4, 1, 1, 1)
        self.animname = QLineEdit()
        self.animname.setText('AnimName')
        self.animname.setToolTip('<b>Animation Name.</b> Name of the final animation files. IE: name.zafbin, name.zaabin, name.anims.')
        grplay.addWidget(self.animname, 3, 1)
        self.type_box = QComboBox()
        self.type_box.addItems(self.types)
        self.type_box.setToolTip('<b>Munge Mode.</b> This switches munge parameters.')
        grplay.addWidget(QLabel('<b>Munge Mode:</b>'), 3, 2)
        grplay.addWidget(self.type_box, 3, 3, 1, 2)
        munge_btn = QPushButton('Munge')
        munge_btn.clicked.connect(self.munge)
        munge_btn.setToolTip('<b>Munge.</b> Munges the input files with the selected mode.')
        grplay.addWidget(munge_btn, 4, 2)
        save_out = QPushButton('Save')
        save_out.clicked.connect(self.save)
        save_out.setToolTip('<b>Save.</b> Saves the output files.')
        grplay.addWidget(save_out, 4, 3)
        cancel_btn = QPushButton('Cancel')
        cancel_btn.clicked.connect(self.cancel)
        cancel_btn.setToolTip('<b>Cancel.</b> Closes the dialog and removes all temporary files.')
        grplay.addWidget(cancel_btn, 4, 4)

        grp.setLayout(grplay)

        mainlay = QVBoxLayout()
        mainlay.addWidget(grp)

        self.setLayout(mainlay)
        self.setGeometry(340, 340, 320, 300)
        self.setWindowTitle('MSH Suite - Animation Munge')
        self.show()
예제 #22
0
 def __init__(self, group_name, name_list, handler = None, help_instance = None):
     QGroupBox.__init__(self, group_name)
     the_layout = QGridLayout()
     self.setLayout(the_layout)
     self.widget_dict = {}
     rows = 0
     for txt in name_list:
         cb = QRadioButton(txt)
         the_layout.addWidget(cb, rows, 0)
         if handler != None:
             cb.toggled.connect(handler)
         self.widget_dict[txt] = cb
         rows += 1
     return
def main():
    app = QApplication(sys.argv)
    mainwindow = QMainWindow()
    group = QGroupBox('Some options', mainwindow)
    group.setLayout(QVBoxLayout(group))
    mainwindow.setCentralWidget(group)
    boxes = FoldableCheckBoxes(group)
    for group_name, title, items in GROUPS:
        boxes.addGroup(group_name, title)
        for name, title in items:
            boxes.addOption(group_name, name, title)
    group.layout().addWidget(boxes)
    mainwindow.show()
    app.exec_()
 def __init__(self, parent=None):
   super(Hatcher, self).__init__(parent)
   browser_container = BrowserContainer()
   record_table = RecordTable(browser_container._browser)
   layout = QGridLayout()
   layout_table = QVBoxLayout()
   layout_table.addWidget(record_table)
   groupbox_table = QGroupBox()
   groupbox_table.setTitle(self.tr("Record table"))
   groupbox_table.setLayout(layout_table)
   row = 0; col = 0;
   layout.addWidget(browser_container, row, col, 1, 4)
   row += 1; col += 1
   layout.addWidget(groupbox_table, row, col, 1, 2)
   self.setLayout(layout)
 def setupTopGroup(self):
     topGroup = QGroupBox("Simulation Results")
     self.resultsPathLineEdit = SimpleOption('resultsPath','Results Path','/home/thomas/Dropbox/Keio/research/results/')
     topGroupLayout = QVBoxLayout()
     topGroupLayout.setSpacing(0)
     topGroupLayout.setAlignment(Qt.AlignTop)
     topGroupLayout.addWidget(self.resultsPathLineEdit)
     self.loadResultsLabel = QLabel()
     self.loadResultsLabel.setAlignment(Qt.AlignHCenter)
     topGroupLayout.addWidget(self.loadResultsLabel)
     self.loadResultsButton = QPushButton("Load the results")
     self.loadResultsButton.clicked.connect(self.loadResults)
     topGroupLayout.addWidget(self.loadResultsButton)
     topGroup.setLayout(topGroupLayout)
     self.topLeftLayout.addWidget(topGroup)
예제 #26
0
    def initWidgets(self):
        self.showAllServicesItem = QListWidgetItem(self.tr("(All registered services)"))
        self.servicesListWidget = QListWidget()
        self.interfacesListWidget = QListWidget()
        self.interfacesListWidget.addItem(self.tr("(Select a service)"))
        self.attributesListWidget = QListWidget()
        self.attributesListWidget.addItem(self.tr("(Select an interface implementation)"))
        self.interfacesListWidget.setMinimumWidth(450)
        self.servicesListWidget.currentItemChanged.connect(self.reloadInterfaceImplementationsList)
        self.interfacesListWidget.currentItemChanged.connect(self.currentInterfaceImplChanged)
        self.defaultInterfaceButton = QPushButton(self.tr("Set as default implementation"))
        self.defaultInterfaceButton.setEnabled(False)
        self.defaultInterfaceButton.clicked.connect(self.setDefaultInterfaceImplementation)
        self.selectedImplRadioButton = QRadioButton(self.tr("Selected interface implementation"))
        self.defaultImplRadioButton = QRadioButton(self.tr("Default implementation"))
        self.selectedImplRadioButton.setChecked(True)
        self.radioButtons = QButtonGroup(self)
        self.radioButtons.addButton(self.selectedImplRadioButton)
        self.radioButtons.addButton(self.defaultImplRadioButton)
        self.radioButtons.buttonClicked.connect(self.reloadAttributesList)

        self.servicesGroup = QGroupBox(self.tr("Show services for:"))
        servicesLayout = QVBoxLayout()
        servicesLayout.addWidget(self.servicesListWidget)
        self.servicesGroup.setLayout(servicesLayout)

        self.interfacesGroup = QGroupBox(self.tr("Interface implementations"))
        interfacesLayout = QVBoxLayout()
        interfacesLayout.addWidget(self.interfacesListWidget)
        interfacesLayout.addWidget(self.defaultInterfaceButton)
        self.interfacesGroup.setLayout(interfacesLayout)

        self.attributesGroup = QGroupBox(self.tr("Invokable attributes"))
        attributesLayout = QVBoxLayout()
        self.attributesGroup.setLayout(attributesLayout)
        attributesLayout.addWidget(self.attributesListWidget)
        attributesLayout.addWidget(QLabel(self.tr("Show attributes for:")))
        attributesLayout.addWidget(self.selectedImplRadioButton)
        attributesLayout.addWidget(self.defaultImplRadioButton)

        self.attributesGroup.setLayout(attributesLayout)

        layout = QGridLayout()
        layout.addWidget(self.servicesGroup, 0, 0)
        layout.addWidget(self.attributesGroup, 0, 1, 2, 1)
        layout.addWidget(self.interfacesGroup, 1, 0)

        self.setLayout(layout)
예제 #27
0
 def __init__(self, var_name, default_folder, project_root_dir = "", help_instance=None):
     QGroupBox.__init__(self, "data selector")
     self.project_root_dir = project_root_dir
     self.setContentsMargins(1, 1, 1, 1)
     self.my_layout = QVBoxLayout()
     self.my_layout.setSpacing(1)
     self.setLayout(self.my_layout)
     self.var_name = var_name
     self.current_folder = default_folder
     self.my_folder_selector = FolderSelector(var_name, default_folder, project_root_dir, handler = self.new_folder_selected)
     self.my_layout.addWidget(self.my_folder_selector)
     self.concatenate = qHotField("concatenate", bool, False)
     self.my_layout.addWidget(self.concatenate)
     self.read_schema()
     self.check_group = CheckGroupNoParameters("body blocks", self.block_list, self.block_list[0])
     self.my_layout.addWidget(self.check_group)
예제 #28
0
    def addThreadList(self,threads):

        if not self.groupBoxThreadInfo:
            self.groupBoxThreadInfo = QGroupBox()
            self.threadInfo = QLabel("Thread Info.")
            self.groupBoxThreadInfo.setStyleSheet("QGroupBox {border: 1px solid gray; border-radius: 9px; margin-top: 0.5em} QGroupBox::title {subcontrol-origin: margin; left: 10px; padding: 0 3px 0 3px;")

        if not self.threadvbox:
            self.threadvbox = QVBoxLayout()

        if not self.listThread:
            self.listThread = QListWidget()
            
        self.listThread.setFixedWidth(200)
        self.listThread.setSelectionMode(QtGui.QAbstractItemView.MultiSelection)
        QtCore.QObject.connect(self.listThread, QtCore.SIGNAL("itemClicked(QListWidgetItem *)"), self.toggleThreadDisplay)
        self.threadvbox.addWidget(self.threadInfo)
        self.threadvbox.addWidget(self.listThread)
        self.groupBoxThreadInfo.setLayout(self.threadvbox)
        self.addWidget(self.groupBoxThreadInfo)
        self.groupBoxThreadInfo.setSizePolicy(self.sizePolicy)

        for id in threads:
            item = QtGui.QListWidgetItem(id)
            self.listThread.addItem(item)
예제 #29
0
    def __init__(self, group_name, name_list, default=None, help_instance=None, handler=None, help_dict=None):
        QGroupBox.__init__(self, group_name)
        self.handler = handler
        self.help_dict = help_dict
        self.help_instance = help_instance

        self.the_layout = QVBoxLayout()
        self.the_layout.setSpacing(5)
        self.the_layout.setContentsMargins(1, 1, 1, 1)
        self.setLayout(self.the_layout)
        self.widget_dict = OrderedDict([])
        self.is_popup = False
        self.create_check_boxes(name_list)
        if default is not None:
            self.set_myvalue([default])
        return
예제 #30
0
    def createWidgets(self):
        selectedEid = self.state.viewAllPanel.view.selectedEid
        self.selectedEntry = self.state.model.entry(selectedEid)
        self.entry1Label = QLabel("cross-reference from ")
        self.termLabel = Widgets.Label.HtmlLabel("“{}”".format(
            Lib.elidePatchHtml(self.selectedEntry.term, self.state)))
        self.entry2Label = QLabel(" to")
        self.seeRadioButton = QRadioButton("&See")
        self.seeRadioButton.setChecked(True)
        self.tooltips.append((self.seeRadioButton, """<p><b>See</b></p>
<p>Check to create a <i>see</i> cross-reference.</p>"""))
        self.alsoRadioButton = QRadioButton("See &Also")
        self.tooltips.append((self.alsoRadioButton, """<p><b>See
Also</b></p>
<p>Check to create a <i>see also</i> cross-reference.</p>"""))
        self.whichGroup = QGroupBox("Add")
        self.filteredEntry = self.circledEntry = None
        filteredEid = self.state.viewFilteredPanel.view.selectedEid
        if filteredEid is not None:
            self.filteredEntry = self.state.model.entry(filteredEid)
        circledEid = self.state.viewAllPanel.view.circledEid
        if circledEid is not None:
            self.circledEntry = self.state.model.entry(circledEid)
        self.filteredRadioButton = QRadioButton("&Filtered")
        self.circledRadioButton = QRadioButton("C&ircled")
        self.recentRadioButton = QRadioButton("&Recent")
        self.tooltips.append((self.recentRadioButton, """<p><b>Recent</b></p>
<p>Create a cross-reference to a recently visited entry.</p>"""))
        self.filteredLabel = Widgets.Label.HtmlLabel()
        self.circledLabel = Widgets.Label.HtmlLabel()
        seen = {selectedEid}
        buttons = (self.filteredRadioButton, self.circledRadioButton,
                   self.recentRadioButton)
        Forms.Util.setUpRadioButton(
            self, self.filteredEntry, self.filteredRadioButton,
            self.filteredLabel, buttons, seen, """<p><b>Filtered</b></p>
<p>Create a cross-reference to the filtered entry “{}”.</p>""")
        Forms.Util.setUpRadioButton(
            self, self.circledEntry, self.circledRadioButton,
            self.circledLabel, buttons, seen, """<p><b>Circled</b></p>
<p>Create a cross-reference to the circled entry “{}”.</p>""")
        self.recentComboBox = Forms.Util.createTermsComboBox(
            self.state, self.state.gotoEids, ignore=seen, maximum=MAX_RECENT)
        self.groupRadioButton = QRadioButton("All in &Group")
        self.groupComboBox = QComboBox()
        for i, (gid, name, linked) in enumerate(self.state.model.allGroups()):
            self.groupComboBox.addItem(
                QIcon(":/grouplink.svg" if linked else ":/groups.svg"), name,
                gid)
        if not self.groupComboBox.count():
            self.groupRadioButton.setEnabled(False)
            self.groupComboBox.setEnabled(False)
        self.eidGroup = QGroupBox()
        self.genericTermRadioButton = QRadioButton("Generic &Term")
        self.tooltips.append((self.genericTermRadioButton, """\
<p><b>Generic Term</b></p>
<p>Create a cross-reference to the given generic term.</p>"""))
        self.genericTermLineEdit = EnableOnClickLineEdit(
            self.state, self.genericTermRadioButton, self)
        self.tooltips.append((self.genericTermLineEdit, """\
<p><b>Generic Term text</b></p>
<p>The generic term text styled (e.g., <b>bold</b>, <i>italic</i>), as
it should appear in the final index.</p>"""))
        self.formatPanel = Widgets.FormatPanel.Panel(self.state, self)
        self.formatPanel.state.editors = [self.genericTermLineEdit]
        self.formatActions = self.formatPanel.formatActions
        self.buttonBox = QDialogButtonBox()
        self.addButton = QPushButton(QIcon(":/xref-add.svg"), "A&dd")
        self.tooltips.append((self.addButton, """<p><b>Add</b></p>
<p>Add the specified cross-reference to the <b>Entry</b> {}.</p>""".format(
            self.termLabel.text())))
        self.buttonBox.addButton(self.addButton, QDialogButtonBox.AcceptRole)
        self.closeButton = QPushButton(QIcon(":/dialog-close.svg"), "&Cancel")
        self.tooltips.append((self.closeButton, """<p><b>Cancel</b></p>
<p>Close the dialog without making any changes to the index.</p>"""))
        self.buttonBox.addButton(self.closeButton, QDialogButtonBox.RejectRole)
        self.helpButton = QPushButton(QIcon(":/help.svg"), "Help")
        self.tooltips.append(
            (self.helpButton, "Help on the Add Cross-reference dialog"))
        self.buttonBox.addButton(self.helpButton, QDialogButtonBox.HelpRole)
        if (not self.filteredRadioButton.isChecked()
                and not self.circledRadioButton.isChecked()):
            if self.recentComboBox.count():
                self.recentRadioButton.setChecked(True)
            else:
                self.genericTermRadioButton.setChecked(True)
                self.genericTermLineEdit.setFocus()
예제 #31
0
class Form(QDialog):
    def __init__(self, state, parent=None):
        super().__init__(parent)
        Lib.prepareModalDialog(self)
        self.state = state
        self.setWindowTitle("Add Cross-reference — {}".format(
            QApplication.applicationName()))
        self.createWidgets()
        self.layoutWidgets()
        self.createConnections()
        self.updateUi()
        settings = QSettings()
        self.updateToolTips(
            bool(
                int(
                    settings.value(Gopt.Key.ShowDialogToolTips,
                                   Gopt.Default.ShowDialogToolTips))))

    def createWidgets(self):
        selectedEid = self.state.viewAllPanel.view.selectedEid
        self.selectedEntry = self.state.model.entry(selectedEid)
        self.entry1Label = QLabel("cross-reference from ")
        self.termLabel = Widgets.Label.HtmlLabel("“{}”".format(
            Lib.elidePatchHtml(self.selectedEntry.term, self.state)))
        self.entry2Label = QLabel(" to")
        self.seeRadioButton = QRadioButton("&See")
        self.seeRadioButton.setChecked(True)
        self.tooltips.append((self.seeRadioButton, """<p><b>See</b></p>
<p>Check to create a <i>see</i> cross-reference.</p>"""))
        self.alsoRadioButton = QRadioButton("See &Also")
        self.tooltips.append((self.alsoRadioButton, """<p><b>See
Also</b></p>
<p>Check to create a <i>see also</i> cross-reference.</p>"""))
        self.whichGroup = QGroupBox("Add")
        self.filteredEntry = self.circledEntry = None
        filteredEid = self.state.viewFilteredPanel.view.selectedEid
        if filteredEid is not None:
            self.filteredEntry = self.state.model.entry(filteredEid)
        circledEid = self.state.viewAllPanel.view.circledEid
        if circledEid is not None:
            self.circledEntry = self.state.model.entry(circledEid)
        self.filteredRadioButton = QRadioButton("&Filtered")
        self.circledRadioButton = QRadioButton("C&ircled")
        self.recentRadioButton = QRadioButton("&Recent")
        self.tooltips.append((self.recentRadioButton, """<p><b>Recent</b></p>
<p>Create a cross-reference to a recently visited entry.</p>"""))
        self.filteredLabel = Widgets.Label.HtmlLabel()
        self.circledLabel = Widgets.Label.HtmlLabel()
        seen = {selectedEid}
        buttons = (self.filteredRadioButton, self.circledRadioButton,
                   self.recentRadioButton)
        Forms.Util.setUpRadioButton(
            self, self.filteredEntry, self.filteredRadioButton,
            self.filteredLabel, buttons, seen, """<p><b>Filtered</b></p>
<p>Create a cross-reference to the filtered entry “{}”.</p>""")
        Forms.Util.setUpRadioButton(
            self, self.circledEntry, self.circledRadioButton,
            self.circledLabel, buttons, seen, """<p><b>Circled</b></p>
<p>Create a cross-reference to the circled entry “{}”.</p>""")
        self.recentComboBox = Forms.Util.createTermsComboBox(
            self.state, self.state.gotoEids, ignore=seen, maximum=MAX_RECENT)
        self.groupRadioButton = QRadioButton("All in &Group")
        self.groupComboBox = QComboBox()
        for i, (gid, name, linked) in enumerate(self.state.model.allGroups()):
            self.groupComboBox.addItem(
                QIcon(":/grouplink.svg" if linked else ":/groups.svg"), name,
                gid)
        if not self.groupComboBox.count():
            self.groupRadioButton.setEnabled(False)
            self.groupComboBox.setEnabled(False)
        self.eidGroup = QGroupBox()
        self.genericTermRadioButton = QRadioButton("Generic &Term")
        self.tooltips.append((self.genericTermRadioButton, """\
<p><b>Generic Term</b></p>
<p>Create a cross-reference to the given generic term.</p>"""))
        self.genericTermLineEdit = EnableOnClickLineEdit(
            self.state, self.genericTermRadioButton, self)
        self.tooltips.append((self.genericTermLineEdit, """\
<p><b>Generic Term text</b></p>
<p>The generic term text styled (e.g., <b>bold</b>, <i>italic</i>), as
it should appear in the final index.</p>"""))
        self.formatPanel = Widgets.FormatPanel.Panel(self.state, self)
        self.formatPanel.state.editors = [self.genericTermLineEdit]
        self.formatActions = self.formatPanel.formatActions
        self.buttonBox = QDialogButtonBox()
        self.addButton = QPushButton(QIcon(":/xref-add.svg"), "A&dd")
        self.tooltips.append((self.addButton, """<p><b>Add</b></p>
<p>Add the specified cross-reference to the <b>Entry</b> {}.</p>""".format(
            self.termLabel.text())))
        self.buttonBox.addButton(self.addButton, QDialogButtonBox.AcceptRole)
        self.closeButton = QPushButton(QIcon(":/dialog-close.svg"), "&Cancel")
        self.tooltips.append((self.closeButton, """<p><b>Cancel</b></p>
<p>Close the dialog without making any changes to the index.</p>"""))
        self.buttonBox.addButton(self.closeButton, QDialogButtonBox.RejectRole)
        self.helpButton = QPushButton(QIcon(":/help.svg"), "Help")
        self.tooltips.append(
            (self.helpButton, "Help on the Add Cross-reference dialog"))
        self.buttonBox.addButton(self.helpButton, QDialogButtonBox.HelpRole)
        if (not self.filteredRadioButton.isChecked()
                and not self.circledRadioButton.isChecked()):
            if self.recentComboBox.count():
                self.recentRadioButton.setChecked(True)
            else:
                self.genericTermRadioButton.setChecked(True)
                self.genericTermLineEdit.setFocus()

    def layoutWidgets(self):
        layout = QVBoxLayout()
        whichLayout = QHBoxLayout()
        whichLayout.addWidget(self.seeRadioButton)
        whichLayout.addWidget(self.alsoRadioButton)
        whichLayout.addStretch()
        self.whichGroup.setLayout(whichLayout)
        layout.addWidget(self.whichGroup)
        entryLayout = QHBoxLayout()
        entryLayout.setSpacing(0)
        entryLayout.addWidget(self.entry1Label)
        entryLayout.addWidget(self.termLabel)
        entryLayout.addWidget(self.entry2Label)
        entryLayout.addStretch()
        layout.addLayout(entryLayout)
        eidLayout = QVBoxLayout()
        hbox = QHBoxLayout()
        hbox.setSpacing(0)
        hbox.addWidget(self.filteredRadioButton)
        hbox.addWidget(self.filteredLabel, 1)
        eidLayout.addLayout(hbox)
        hbox = QHBoxLayout()
        hbox.setSpacing(0)
        hbox.addWidget(self.circledRadioButton)
        hbox.addWidget(self.circledLabel, 1)
        eidLayout.addLayout(hbox)
        hbox = QHBoxLayout()
        hbox.setSpacing(0)
        hbox.addWidget(self.recentRadioButton)
        hbox.addWidget(self.recentComboBox, 1)
        eidLayout.addLayout(hbox)
        hbox = QHBoxLayout()
        hbox.addWidget(self.groupRadioButton)
        hbox.addWidget(self.groupComboBox, 1)
        eidLayout.addLayout(hbox)
        grid = QGridLayout()
        grid.addWidget(self.formatPanel, 0, 0, 1, 2, Qt.AlignRight)
        grid.addWidget(self.genericTermRadioButton, 1, 0)
        grid.addWidget(self.genericTermLineEdit, 1, 1)
        eidLayout.addLayout(grid)
        eidLayout.addStretch()
        self.eidGroup.setLayout(eidLayout)
        layout.addWidget(self.eidGroup)
        layout.addWidget(self.buttonBox)
        self.setLayout(layout)

    def createConnections(self):
        self.buttonBox.accepted.connect(self.addXRef)
        self.buttonBox.rejected.connect(self.reject)
        self.helpButton.clicked.connect(self.help)
        self.filteredRadioButton.clicked.connect(self.updateUi)
        self.circledRadioButton.clicked.connect(self.updateUi)
        self.recentRadioButton.clicked.connect(self.updateUi)
        self.recentRadioButton.toggled.connect(self.moveFocus)
        self.recentComboBox.currentIndexChanged[int].connect(
            self.recentChanged)
        self.groupRadioButton.clicked.connect(self.updateUi)
        self.groupRadioButton.toggled.connect(self.moveFocus)
        self.groupComboBox.currentIndexChanged[int].connect(self.groupChanged)
        self.genericTermRadioButton.clicked.connect(self.updateUi)
        self.genericTermRadioButton.clicked.connect(
            self.genericTermLineEdit.setFocus)
        self.genericTermLineEdit.textChanged.connect(self.updateUi)
        self.genericTermLineEdit.enterPressed.connect(self.maybeAdd)

    def recentChanged(self):
        self.recentRadioButton.setChecked(True)
        self.updateUi()

    def groupChanged(self):
        self.groupRadioButton.setChecked(True)
        self.updateUi()

    def moveFocus(self):
        if self.recentRadioButton.isChecked():
            self.recentComboBox.setFocus()
        elif self.groupRadioButton.isChecked():
            self.groupComboBox.setFocus()

    def help(self):
        self.state.help("xix_ref_dlg_addxref.html")

    def updateUi(self):
        enable = (self.genericTermRadioButton.isChecked()
                  or (self.groupRadioButton.isChecked()
                      and self.groupComboBox.count()))
        for widget in (self.genericTermLineEdit, self.formatPanel):
            widget.setEnabled(enable)
        self.recentRadioButton.setEnabled(self.recentComboBox.count())
        self.recentComboBox.setEnabled(self.recentComboBox.count())
        enable = True
        if (self.filteredRadioButton.isChecked()
                and self.filteredEntry is None):
            enable = False
        if (self.circledRadioButton.isChecked() and self.circledEntry is None):
            enable = False
        if (self.recentRadioButton.isChecked()
                and self.recentComboBox.currentIndex() < 0):
            enable = False
        if (self.groupRadioButton.isChecked()
                and not self.groupComboBox.count()):
            enable = False
        if (self.genericTermRadioButton.isChecked()
                and self.genericTermLineEdit.isEmpty()):
            enable = False
        self.addButton.setEnabled(enable)

    def maybeAdd(self):
        if (self.genericTermRadioButton.isChecked()
                and not self.genericTermLineEdit.isEmpty()):
            self.addXRef()

    def addXRef(self):
        from_eid = self.selectedEntry.eid
        assert from_eid is not None
        kind = (XrefKind.SEE
                if self.seeRadioButton.isChecked() else XrefKind.SEE_ALSO)
        if self.groupRadioButton.isChecked():
            gid = int(
                self.groupComboBox.itemData(self.groupComboBox.currentIndex()))
            for to_eid in tuple(self.state.model.eidsForGid(gid)):
                self.state.model.addXRef(from_eid, to_eid, kind)
        elif not self.genericTermRadioButton.isChecked():
            to_eid = None
            if self.filteredRadioButton.isChecked():
                to_eid = self.filteredEntry.eid
            elif self.circledRadioButton.isChecked():
                to_eid = self.circledEntry.eid
            elif self.recentRadioButton.isChecked():
                to_eid = self.recentComboBox.itemData(
                    self.recentComboBox.currentIndex())
            assert to_eid is not None
            self.state.model.addXRef(from_eid, to_eid, kind)
        else:
            term = self.genericTermLineEdit.toHtml()
            kind = (XrefKind.SEE_GENERIC if self.seeRadioButton.isChecked()
                    else XrefKind.SEE_ALSO_GENERIC)
            self.state.model.addGenericXRef(from_eid, term, kind)
        say("Added cross-reference", SAY_TIMEOUT)
        self.accept()
예제 #32
0
    def initUI(self):

        # textEdit = QTextEdit()
        # self.setCentralWidget(textEdit)

        # self.setStyleSheet("QGroupBox {  border: 1px solid gray; padding: 5px;}");

        # Action to quit program
        exitAction = QAction(QIcon(None), 'Quit', self)
        exitAction.setShortcut('Ctrl+Q')
        exitAction.setStatusTip('Exit application')
        exitAction.triggered.connect(self.close)

        # # Action to update device list
        # self.refreshAction = QAction(QIcon('img/reload.png'), 'Refresh', self)
        # self.refreshAction.setShortcut('F5')
        # self.refreshAction.setStatusTip('Refresh list of connected devices.')
        # self.refreshAction.triggered.connect(self.updateDeviceList)

        # Action to show program information
        helpAction = QAction(QIcon(None), 'Help', self)
        helpAction.setShortcut('F1')
        helpAction.triggered.connect(self.showHelpDialog)

        # Action to help
        aboutAction = QAction(QIcon(None), 'About', self)
        aboutAction.triggered.connect(self.showAboutDialog)

        self.statusBar()

        # Add the file menu
        menubar = self.menuBar()
        fileMenu = menubar.addMenu('&File')
        # fileMenu.addAction(self.refreshAction)
        fileMenu.addAction(exitAction)
        fileMenu = menubar.addMenu('&Help')
        fileMenu.addAction(helpAction)
        fileMenu.addAction(aboutAction)

        # # Add the toolbar
        # toolbar = self.addToolBar('Exit')
        # # toolbar.addAction(self.refreshAction)
        # toolbar.setMovable(False)

        # Add the main windows widgets
        self.deviceListWidget = DeviceList(self.programDeviceHandler,
                                           self.infoDeviceHandler,
                                           self.resetDeviceHandler)
        self.fileSelectorWidget = FileSelector()

        self.setStyleSheet("""
            QStatusBar {
                border-top: 1px solid #CCC;
            }
            QToolBar {
                border-top: 1px solid #DDD;
                border-bottom: 1px solid #CCC;
            }
        """)

        gbox = QGroupBox("Connected USB devices:")
        gboxLayout = QVBoxLayout()
        gboxLayout.addWidget(self.deviceListWidget)
        gbox.setLayout(gboxLayout)

        self.refreshEvent = QTimer()
        self.refreshEvent.setInterval(1250)
        self.refreshEvent.timeout.connect(self.USBUpdate)
        self.refreshEvent.start()

        layout = QVBoxLayout()
        layout.addWidget(self.fileSelectorWidget)
        layout.addWidget(gbox)
        self.setCentralWidget(QWidget())
        self.centralWidget().setLayout(layout)

        self.setMinimumSize(620, 700)
        self.setMaximumWidth(620)
        self.setWindowFlags(Qt.Window | Qt.WindowMinimizeButtonHint
                            | Qt.WindowCloseButtonHint)

        self.setGeometry(300, 300, 350, 250)
        self.setWindowTitle('keyplus layout and firmware loader')
        self.show()
예제 #33
-1
 def __init__(self, *args, **kwargs ):
     
     QWidget.__init__( self, *args )
     
     self.infoPath = cmds.about(pd=True) + "/sg/fingerWeightCopy/Widget_SelectionGrow.txt"
     sgCmds.makeFile( self.infoPath )
     
     validator = QIntValidator()
     
     layout = QHBoxLayout( self ); layout.setContentsMargins(0,0,0,0)
     groupBox = QGroupBox()
     layout.addWidget( groupBox )
     
     hLayout = QHBoxLayout()
     labelTitle = QLabel( "Grow Selection : " )
     buttonGrow = QPushButton( "Grow" ); buttonGrow.setFixedWidth( 50 )
     buttonShrink = QPushButton( "Shrink" ); buttonShrink.setFixedWidth( 50 )        
     lineEdit = QLineEdit(); lineEdit.setValidator( validator );lineEdit.setText( '0' )
     
     hLayout.addWidget( labelTitle )
     hLayout.addWidget( buttonGrow )
     hLayout.addWidget( buttonShrink )
     hLayout.addWidget( lineEdit )
     
     groupBox.setLayout( hLayout )
     
     self.lineEdit = lineEdit
     
     QtCore.QObject.connect( buttonGrow, QtCore.SIGNAL("clicked()"), self.growNum )
     QtCore.QObject.connect( buttonShrink, QtCore.SIGNAL("clicked()"), self.shrinkNum )
     
     self.vtxLineEditList = []
     self.loadInfo()