Exemplo n.º 1
0
 def __init__(self, view):
     QtCore.QObject.__init__(self, view)
     self._elements = view.loadUi(self._DIALOG_UI)
     self.dialog = self._elements['dialog']
     # Coordinates
     self._x = self._elements['spinBoxX']
     self._x.setMinimum(self._MIN_COORD)
     self._x.setMaximum(self._MAX_COORD)
     self._y = self._elements['spinBoxY']
     self._y.setMinimum(self._MIN_COORD)
     self._y.setMaximum(self._MAX_COORD)
     # Events
     self._events = {
         self._elements['radioClick']: 'CLICK',
         self._elements['radioDouble']: 'DOUBLE_CLICK',
         self._elements['radioPress']: 'PRESS',
         self._elements['radioRelease']: 'RELEASE',
         self._elements['radioAbsolute']: 'ABSOLUTE_MOTION',
         self._elements['radioRelative']: 'RELATIVE_MOTION'
     }
     self._event = QtGui.QButtonGroup()
     self._event.buttonClicked.connect(self._switch)
     for event in self._events:
         self._event.addButton(event)
     # Buttons
     self._buttons = dict(
         zip((self._elements['radioLeft'], self._elements['radioMiddle'],
              self._elements['radioRight']), constants.BUTTONS))
     self._button = QtGui.QButtonGroup()
     for button in self._buttons:
         self._button.addButton(button)
     self._ok = self._elements['buttonBox'].button(
         QtGui.QDialogButtonBox.Ok)
     self._ok.clicked.connect(self._execute)
     self._deviceTab = None
Exemplo n.º 2
0
    def createToolBox(self):
        self.buttonGroup = QtGui.QButtonGroup()
        self.buttonGroup.setExclusive(False)
        self.buttonGroup.buttonClicked[int].connect(self.buttonGroupClicked)

        layout = QtGui.QGridLayout()
        layout.addWidget(self.createCellWidget("Conditional", DiagramItem.Conditional),
                0, 0)
        layout.addWidget(self.createCellWidget("Process", DiagramItem.Step), 0,
                1)
        layout.addWidget(self.createCellWidget("Input/Output", DiagramItem.Io),
                1, 0)

        textButton = QtGui.QToolButton()
        textButton.setCheckable(True)
        self.buttonGroup.addButton(textButton, self.InsertTextButton)
        textButton.setIcon(QtGui.QIcon(QtGui.QPixmap(':/images/textpointer.png')
                            .scaled(30, 30)))
        textButton.setIconSize(QtCore.QSize(50, 50))

        textLayout = QtGui.QGridLayout()
        textLayout.addWidget(textButton, 0, 0, QtCore.Qt.AlignHCenter)
        textLayout.addWidget(QtGui.QLabel("Text"), 1, 0,
                QtCore.Qt.AlignCenter)
        textWidget = QtGui.QWidget()
        textWidget.setLayout(textLayout)
        layout.addWidget(textWidget, 1, 1)

        layout.setRowStretch(3, 10)
        layout.setColumnStretch(2, 10)

        itemWidget = QtGui.QWidget()
        itemWidget.setLayout(layout)

        self.backgroundButtonGroup = QtGui.QButtonGroup()
        self.backgroundButtonGroup.buttonClicked.connect(self.backgroundButtonGroupClicked)

        backgroundLayout = QtGui.QGridLayout()
        backgroundLayout.addWidget(self.createBackgroundCellWidget("Blue Grid",
                ':/images/background1.png'), 0, 0)
        backgroundLayout.addWidget(self.createBackgroundCellWidget("White Grid",
                ':/images/background2.png'), 0, 1)
        backgroundLayout.addWidget(self.createBackgroundCellWidget("Gray Grid",
                ':/images/background3.png'), 1, 0)
        backgroundLayout.addWidget(self.createBackgroundCellWidget("No Grid",
                ':/images/background4.png'), 1, 1)

        backgroundLayout.setRowStretch(2, 10)
        backgroundLayout.setColumnStretch(2, 10)

        backgroundWidget = QtGui.QWidget()
        backgroundWidget.setLayout(backgroundLayout)

        self.toolBox = QtGui.QToolBox()
        self.toolBox.setSizePolicy(QtGui.QSizePolicy(QtGui.QSizePolicy.Maximum, QtGui.QSizePolicy.Ignored))
        self.toolBox.setMinimumWidth(itemWidget.sizeHint().width())
        self.toolBox.addItem(itemWidget, "Basic Flowchart Shapes")
        self.toolBox.addItem(backgroundWidget, "Backgrounds")
Exemplo n.º 3
0
    def _create_widgets(self):
        self._frame_value = QtWidgets.QSpinBox(parent=self)
        self._frame_value.setSingleStep(1)
        self._frame_value.setMinimum(0)
        self._add_line_widget('Frame Interval:', self._frame_value)

        self._draw_value = QtWidgets.QDoubleSpinBox(parent=self)
        self._draw_value.setSingleStep(0.1)
        self._add_line_widget('Draw Time Interval (secs):', self._draw_value)

        self._mode_group = QtWidgets.QButtonGroup(parent=self)
        self._closest_mode = QtWidgets.QRadioButton("Closest")
        self._closest_mode.setChecked(True)
        self._mode_group.addButton(self._closest_mode)

        self._spread_mode = QtWidgets.QRadioButton("Spread")
        self._mode_group.addButton(self._spread_mode)

        w = QtWidgets.QWidget()
        hl = _build_layout(True)
        w.setLayout(hl)

        hl.addWidget(self._closest_mode)
        hl.addWidget(self._spread_mode)

        self._add_line_widget('Stroke Mode:', w)
Exemplo n.º 4
0
    def __init__(self, result, parent=None):
        super(popUp, self).__init__(parent)
        # ********************************** Initializing Constants ****************************************************
        self.rbtId = 0
        self.rbtSize = 0
        self.rbtPrc = 0

        self.result = result
        self.const = readConst("app_conf", "constants")

        # ********************* Removing/Disabling help & close button from dialog *************************************
        # self.setWindowFlags(QtCore.Qt.FramelessWindowHint)
        self.setWindowFlags(self.windowFlags() & ~QtCore.Qt.WindowContextHelpButtonHint)
        self.setWindowFlags(self.windowFlags() | QtCore.Qt.CustomizeWindowHint)
        self.setWindowFlags(self.windowFlags() & ~QtCore.Qt.WindowCloseButtonHint)

        # *************************** Blocking Main window while dialog is open  ***************************************
        self.setWindowModality(QtCore.Qt.ApplicationModal)

        # ********************************* Initializing Classes *******************************************************
        self.setupUi(self)
        self.rbtGrp = QtGui.QButtonGroup()
        self.font = QtGui.QFont()
        # **************************************************************************************************************
        self.disOpts()
        self.show()
Exemplo n.º 5
0
    def createLangRB(self, lblXY=[], rbXY=[]):
        labelXY = lblXY  #[28, 40]
        radioXY = rbXY  #[70, 50]
        self.langRadioGroup = QtGui.QButtonGroup()
        self.langRadioGroup.setExclusive(True)
        for i, language in enumerate(self.translator.allLangID):
            lblVlajka = QtGui.QLabel(self.widget)
            lblVlajka.setGeometry(QtCore.QRect(labelXY[0], labelXY[1], 32, 32))
            lblVlajka.setText('')
            lblVlajka.setPixmap(QtGui.QPixmap(language[1]))
            lblVlajka.setObjectName('lbl' + language[0])
            self.gridLayout_2.addWidget(lblVlajka, i, 0, 1, 1)
            self.widget.setGeometry(QtCore.QRect(28, 40, 60, labelXY[1]))
            labelXY[1] += 40

            rbVlajka = QtGui.QRadioButton()
            if self.translator.activeLangID == language[0]:
                rbVlajka.setChecked(True)
            rbVlajka.setGeometry(QtCore.QRect(radioXY[0], radioXY[1], 20, 20))
            rbVlajka.setObjectName('rb' + language[0])
            rbVlajka.clicked.connect(self.changeLang)
            self.langRadioGroup.addButton(rbVlajka, i)
            self.gridLayout_2.addWidget(rbVlajka, i, 1, 1, 1)
            radioXY[1] += 40

            self.verticalLayoutWidget.setGeometry(
                QtCore.QRect(5, 10, 465, labelXY[1] + 20))
Exemplo n.º 6
0
    def __init__(self):
        QtGui.QWidget.__init__(self)
        self.setWindowTitle("Button Window")
        self.setGeometry(300, 200, 200, 200)
        vbox = QtGui.QVBoxLayout(self)
        vbox.setContentsMargins(QtCore.QMargins(5,5,5,5))
        vbox.setSpacing(10)
        self.checkbox = QtGui.QCheckBox("CheckButton", self)
        self.checkbox.setObjectName("check")
        vbox.addWidget(self.checkbox)

        buttongroup = QtGui.QButtonGroup()
        self.radiobutton1 = QtGui.QRadioButton("RadioButton1", self)
        self.radiobutton1.setObjectName("radio1")
        buttongroup.addButton(self.radiobutton1)
        vbox.addWidget(self.radiobutton1)
        self.radiobutton2 = QtGui.QRadioButton("RadioButton2", self)
        self.radiobutton2.setObjectName("radio2")
        buttongroup.addButton(self.radiobutton2)
        vbox.addWidget(self.radiobutton2)

        self.button = QtGui.QPushButton("OK", self)
        self.button.setObjectName("button")
        vbox.addWidget(self.button)
        self.button.clicked.connect(self.clicked)

        self.combo = QtGui.QComboBox(self)
        self.combo.setObjectName("combo")
        self.combo.addItem("Apple")
        self.combo.addItem("Banana")
        self.combo.addItem("Grapes")
        vbox.addWidget(self.combo)
        self.combo.activated[str].connect(self.activated)

        self.resize(350, 200)
Exemplo n.º 7
0
 def initializePage(self):
     self.calibrationWizard.calibs.clear()
     self.layout = QtGui.QVBoxLayout()
     self.calibs = {}
     for key in CALIB_SHOW:
         if CALIB_SHOW[key] == True:
             self.radioGroupBox = QtGui.QGroupBox(CALIB_NAME[key] + ' Calibration')
             self.radioButtons = QtGui.QButtonGroup(self)
             self.radioButtonList = []
             for calibrations in CALIB_DICT[key]:
                 self.radioButtonList.append(QtGui.QRadioButton(calibrations))
             self.radioButtonList[0].setChecked(True)
             self.calibrationWizard.calibs[key] = self.radioButtonList[0].text()
              
             layout = QtGui.QVBoxLayout()
              
             counter = 0
             for each in self.radioButtonList:
                 layout.addWidget(each)
                 self.radioButtons.addButton(each)
                 self.radioButtons.setId(each, counter)
                 counter += 1
             if not self.radioGroupBox.layout():    
                 self.radioGroupBox.setLayout(layout)
             self.layout.addWidget(self.radioGroupBox) 
             self.calibs[key] = self.radioButtons
             self.calibs[key].buttonClicked[int].connect(partial(self.buttonClicked, key)) 
     self.dataGroupBox = QtGui.QGroupBox("Data Required:")
     self.dataLabel = QtGui.QLabel()
     vlayout = QtGui.QVBoxLayout()
     self.dataGroupBox.setLayout(vlayout)
     vlayout.addWidget(self.dataLabel)
     self.setDataLabelText()
     self.layout.addWidget(self.dataGroupBox)
     self.mainLayout.addLayout(self.layout)
    def __init__(self, *args, **kwargs):
        super(OptionWidget, self).__init__(*args, **kwargs)
        mainLayout = QtGui.QFormLayout(self)

        xy = QtGui.QRadioButton('XY', self)
        yz = QtGui.QRadioButton('YZ', self)
        xz = QtGui.QRadioButton('XZ', self)

        acrossLayout = QtGui.QHBoxLayout(self)
        acrossLayout.addWidget(xy, True)
        acrossLayout.addWidget(yz, True)
        acrossLayout.addWidget(xz, True)

        mainLayout.addRow('Across', acrossLayout)

        self.__across = QtGui.QButtonGroup(self)
        self.__across.addButton(xy, 0)
        self.__across.addButton(yz, 1)
        self.__across.addButton(xz, 2)

        self.__marge = QtGui.QCheckBox('Merge', self)
        mainLayout.addRow('', self.__marge)

        self.__softEdge = QtGui.QCheckBox('Soft Edge', self)
        mainLayout.addRow('', self.__softEdge)

        self.__threshold = QtGui.QDoubleSpinBox(self)
        self.__threshold.setMinimum(0)
        self.__threshold.setMaximum(9999)
        self.__threshold.setDecimals(5)
        mainLayout.addRow('Threshold', self.__threshold)
        self.initialize()
 def _build_algorithms(self, layout):
     self._alg_type = QtGui.QButtonGroup(self)
     self._alg_rsa_1024 = QtGui.QRadioButton(m.alg_rsa_1024)
     self._alg_rsa_1024.setProperty('value', 'RSA1024')
     self._alg_rsa_2048 = QtGui.QRadioButton(m.alg_rsa_2048)
     self._alg_rsa_2048.setProperty('value', 'RSA2048')
     self._alg_ecc_p256 = QtGui.QRadioButton(m.alg_ecc_p256)
     self._alg_ecc_p256.setProperty('value', 'ECCP256')
     self._alg_ecc_p384 = QtGui.QRadioButton(m.alg_ecc_p384)
     self._alg_ecc_p384.setProperty('value', 'ECCP384')
     self._alg_type.addButton(self._alg_rsa_1024)
     self._alg_type.addButton(self._alg_rsa_2048)
     self._alg_type.addButton(self._alg_ecc_p256)
     if self._controller.version_tuple >= (4, 0, 0):
         self._alg_type.addButton(self._alg_ecc_p384)
     algo = settings[SETTINGS.ALGORITHM]
     if settings.is_locked(SETTINGS.ALGORITHM):
         layout.addWidget(QtGui.QLabel(m.algorithm_1 % algo))
     else:
         layout.addWidget(self.section(m.algorithm))
         for button in self._alg_type.buttons():
             layout.addWidget(button)
             if button.property('value') == algo:
                 button.setChecked(True)
                 button.setFocus()
         if not self._alg_type.checkedButton():
             button = self._alg_type.buttons()[0]
             button.setChecked(True)
Exemplo n.º 10
0
Arquivo: _vfo.py Projeto: ftl/dxpad
    def __init__(self, vfo, parent=None):
        QtGui.QWidget.__init__(self, parent)
        self.vfo = vfo
        self.vfo.band_changed.connect(self._band_changed)

        self.band_buttons = QtGui.QButtonGroup()
        self.band_buttons.buttonClicked.connect(self._select_band)

        bandLayout = QtGui.QVBoxLayout()
        bandId = 0
        for band in self.vfo.bandplan:
            button = QtGui.QPushButton(band.name)
            button.setCheckable(True)
            self.band_buttons.addButton(button, bandId)
            bandLayout.addWidget(button)

            if self.vfo.band == band:
                button.setChecked(True)
            bandId += 1
        bandLayout.addStretch(1)
        bandLayout.setContentsMargins(3, 3, 3, 3)
        bandLayout.setSpacing(1)

        bandGroup = QtGui.QGroupBox("Band")
        bandGroup.setLayout(bandLayout)

        rootLayout = QtGui.QHBoxLayout()
        rootLayout.addWidget(bandGroup)
        rootLayout.setContentsMargins(0, 0, 0, 0)
        rootLayout.setSpacing(0)
        self.setLayout(rootLayout)
Exemplo n.º 11
0
 def __init__(self,*args):
     QtGui.QWidget.__init__(self,*args)
     #self.textEdit=QtGui.QTextEdit()
     self.buttonadd = QtGui.QPushButton(translate('OpenSCAD','Perform'))
     self.rb_group = QtGui.QButtonGroup()
     self.rb_group_box = QtGui.QGroupBox()
     self.rb_group_box_layout = QtGui.QVBoxLayout()
     self.rb_group_box.setLayout(self.rb_group_box_layout)
     self.rb_union = QtGui.QRadioButton("Union")
     self.rb_group.addButton(self.rb_union)
     self.rb_group_box_layout.addWidget(self.rb_union)
     self.rb_intersection = QtGui.QRadioButton("Intersection")
     self.rb_group.addButton(self.rb_intersection)
     self.rb_group_box_layout.addWidget(self.rb_intersection)
     self.rb_difference = QtGui.QRadioButton("Difference")
     self.rb_group.addButton(self.rb_difference)
     self.rb_group_box_layout.addWidget(self.rb_difference)
     self.rb_hull = QtGui.QRadioButton("Hull")
     self.rb_group.addButton(self.rb_hull)
     self.rb_group_box_layout.addWidget(self.rb_hull)
     self.rb_minkowski = QtGui.QRadioButton("Minkowski")
     self.rb_group.addButton(self.rb_minkowski)
     self.rb_group_box_layout.addWidget(self.rb_minkowski)
     layouth=QtGui.QHBoxLayout()
     layouth.addWidget(self.buttonadd)
     layout= QtGui.QVBoxLayout()
     layout.addLayout(layouth)
     layout.addWidget(self.rb_group_box)
     self.setLayout(layout)
     self.setWindowTitle(translate('OpenSCAD','Mesh Boolean'))
Exemplo n.º 12
0
    def buildWidgets(self):
        setTitleAndIcon(self, "Filter", 'search.png')

        self.button_non_hidden = QtGui.QRadioButton(
            "Only the non-hidden projects")
        self.button_hidden = QtGui.QRadioButton("Only the hidden projects")

        if main_window.model.visible:
            self.button_non_hidden.setChecked(True)
        else:
            self.button_hidden.setChecked(True)

        group = QtGui.QButtonGroup(self)
        group.addButton(self.button_non_hidden)
        group.addButton(self.button_hidden)

        button_cancel = createButton(u"Cancel", 'gtk-cancel.png', self.close)
        button_filter = createButton(u"&Filter projects...", 'search.png',
                                     self.onFilterClicked)
        button_filter.setDefault(True)

        box_button = QtGui.QHBoxLayout()
        box_button.addWidget(button_cancel)
        box_button.addStretch()
        box_button.addWidget(button_filter)

        box = QtGui.QVBoxLayout()
        box.addWidget(self.button_non_hidden)
        box.addWidget(self.button_hidden)
        box.addWidget(getHorizontalLine())
        box.addLayout(box_button)

        self.setLayout(box)
Exemplo n.º 13
0
 def __init__(self, parent=None):
     QtGui.QWidget.__init__(self, parent)
     self.setObjectName("MainBox")
     boxLayout = QtGui.QFormLayout()
     boxLayout.setVerticalSpacing(0)
     self.box_group = QtGui.QButtonGroup(self)
     self.setLayout(boxLayout)
Exemplo n.º 14
0
    def _create_attrs_layout(self):
        group = QtWidgets.QGroupBox("Attributes: ")
        layout = _build_layout(True)
        group.setLayout(layout)
        self._main_layout.addWidget(group)

        buttonGroup = QtWidgets.QButtonGroup(self)
        self._all_attrs_button = QtWidgets.QRadioButton("All")
        self._all_attrs_button.setChecked(1)
        self._all_attrs_button.setFixedWidth(120)

        self._graph_editor_selection = QtWidgets.QRadioButton(
            "Graph Editor Selection")
        self._graph_editor_selection.setFixedWidth(140)

        self._channel_box_selection = QtWidgets.QRadioButton(
            "Channel Box Selection")
        self._channel_box_selection.setFixedWidth(140)

        layout.addWidget(self._all_attrs_button)
        layout.addWidget(self._graph_editor_selection)
        layout.addWidget(self._channel_box_selection)
        layout.addWidget(QtWidgets.QWidget(), 1)

        buttonGroup.addButton(self._all_attrs_button)
        buttonGroup.addButton(self._graph_editor_selection)
        buttonGroup.addButton(self._channel_box_selection)
Exemplo n.º 15
0
    def _makeConnections(self):
        self._ui.sceneviewer_widget.graphicsInitialized.connect(
            self._graphicsUpdate)
        self._ui.datacloudIpdata_pushButton.clicked.connect(
            self._datacloudIpdataClicked)
        self._ui.surfaceIpnode_pushButton.clicked.connect(
            self._surfaceIpnodeClicked)
        self._ui.surfaceIpelem_pushButton.clicked.connect(
            self._surfaceIpelemClicked)
        self._ui.load_pushButton.clicked.connect(self._loadClicked)
        self._ui.outputExnode_pushButton.clicked.connect(
            self._outputExnodeClicked)
        self._ui.outputExelem_pushButton.clicked.connect(
            self._outputExelemClicked)
        self._ui.fit_pushButton.clicked.connect(self._fitClicked)
        self._ui.save_pushButton.clicked.connect(self._saveClicked)
        self._ui.showDatacloud_checkBox.clicked.connect(self._showClicked)
        self._ui.showMesh_checkBox.clicked.connect(self._showClicked)

        self._ui.info_pushButton.clicked.connect(self._infoClicked)
        self._ui.info_pushButton.setIcon(
            QtGui.QIcon.fromTheme('dialog-information'))
        self._ui.info_pushButton.setText('')

        self._originalSceneviewerMousePressEvent = self._ui.sceneviewer_widget.mousePressEvent
        self._ui.sceneviewer_widget.mousePressEvent = self._sceneviewerMousePressEvent

        self._landmarksGroup = QtGui.QButtonGroup(self)
        for landmark_pushButton in self._ui.landmarks_groupBox.children():
            if type(landmark_pushButton) == QtGui.QPushButton:
                self._landmarksGroup.addButton(landmark_pushButton)
                landmark_pushButton.pressed.connect(
                    self._landmarkButtonPressed)
                landmark_pushButton.released.connect(
                    self._landmarkButtonReleased)
Exemplo n.º 16
0
 def post_survey(self, widget):
     qtg = QtGui
     qtc = QtCore
     widget.setObjectName("Post_survey")
     widget.setFeatures(widget.NoDockWidgetFeatures)
     widget.setFixedWidth(1800)
     widget.setAutoFillBackground(True)
     pal = QtGui.QPalette()
     pal.setColor(pal.Background, QtCore.Qt.white)
     widget.setPalette(pal)
     wii = qtg.QWidget()
     scr = qtg.QScrollArea()
     scr.setWidgetResizable(True)
     scr.setHorizontalScrollBarPolicy(QtCore.Qt.ScrollBarAlwaysOff)
     layout = qtg.QGridLayout(wii)
     wii.setLayout(layout)
     widget.setWidget(scr)
     scr.setWidget(wii)
     font1 = qtg.QFont()
     font1.setPixelSize(14)
     font1.setBold(True)
     font2 = qtg.QFont()
     font2.setPixelSize(12)
     lab1 = qtg.QLabel("FreeCAD Intelligent Tutoring System Survey")
     lab1.setWordWrap(True)
     lab1.setFont(font1)
     lab2 = qtg.QLabel(
         "*Note: You may leave any answer blank you do not wish to answer* \n\nPlease answer the following questions to the best of your ability:\nWhen you were done, please click 'Submit' at the end.\n "
     )
     lab2.setWordWrap(True)
     lab2.setFont(font2)
     layout.addWidget(lab1, 0, 1)
     layout.addWidget(lab2, 1, 1)
     lab3 = qtg.QLabel("1.What is your gender?\n")
     lab3.setFont(font2)
     layout.addWidget(lab3, 2, 1)
     radiobutton11 = QtGui.QRadioButton("Male")
     radiobutton12 = QtGui.QRadioButton("Female")
     buttongroup1 = QtGui.QButtonGroup()
     buttongroup1.addButton(radiobutton11, 0)
     buttongroup1.addButton(radiobutton12, 1)
     layout.addWidget(radiobutton11, 3, 1)
     layout.addWidget(radiobutton12, 4, 1)
     lab4 = qtg.QLabel("2.What is your age (in years)?\n")
     lab4.setFont(font2)
     layout.addWidget(lab4, 5, 1)
     fname = './Mod/ITS_test00/post_survey.txt'
     with open(fname) as f:
         content = f.readlines()
     labels = []
     for i in range(0, len(content)):
         if content[i]:
             templab = qtg.QLabel(content[i])
             templab.setWordWrap(True)
             templab.setFont(font2)
             labels.append(templab)
     for i in range(0, len(labels)):
         layout.addWidget(labels[i], i + 6, 1)
Exemplo n.º 17
0
    def reloadList(self):
        self.selectedWorldIndex = -1

        self.itemWidgets = []

        try:
            if not os.path.isdir(self.saveFileDir):
                raise IOError(
                    u"Could not find the Minecraft saves directory!\n\n({0} was not found or is not a directory)"
                    .format(self.saveFileDir))

            log.info("Scanning %s for worlds...", self.saveFileDir)
            potentialWorlds = os.listdir(self.saveFileDir)
            potentialWorlds = [
                os.path.join(self.saveFileDir, p) for p in potentialWorlds
            ]
            worldFiles = [
                p for p in potentialWorlds if isLevel(AnvilWorldAdapter, p)
            ]
            worldAdapters = []
            for f in worldFiles:
                try:
                    adapter = findAdapter(f, readonly=True)
                except Exception as e:
                    log.exception("Could not find adapter for %s: %r", f, e)
                    continue
                else:
                    worldAdapters.append(adapter)

            if len(worldAdapters) == 0:
                raise IOError(
                    "No worlds found! You should probably play Minecraft to create your first world."
                )

            column = QtGui.QVBoxLayout()
            column.setContentsMargins(0, 0, 0, 0)
            column.setSpacing(0)

            worldGroup = QtGui.QButtonGroup(self)
            #worldGroup.setExclusive(True)

            for adapter in worldAdapters:
                item = WorldListItemWidget(adapter)
                self.itemWidgets.append(item)

            self.itemWidgets.sort(key=lambda i: i.lastPlayed, reverse=True)

            for i, item in enumerate(self.itemWidgets):
                worldGroup.addButton(item, i)
                column.addWidget(item)
                item.doubleClicked.connect(self.worldListItemDoubleClicked)

            worldGroup.buttonClicked[int].connect(self.worldListItemClicked)

            self.scrollAreaWidgetContents.setLayout(column)

        except EnvironmentError as e:
            setWidgetError(self, e)
Exemplo n.º 18
0
def make_control_group(parent, buttons, exclusive=True, default=None):
    controlgroup = QtGui.QButtonGroup(QtGui.QWidget(parent))
    for button in buttons:
        controlgroup.addButton(button)
        button.setCheckable(True)
    if default is not None:
        default.toggle()
    controlgroup.setExclusive(exclusive)
    return controlgroup
Exemplo n.º 19
0
    def _create_controls(self):
        self._traces = []
        for num in range(len(colors.TRACE_COLORS)):
            self._traces.append(self._create_trace_widgets(num))

        self._markers = []
        self._marker_group = QtGui.QButtonGroup()
        for num in (0, 1):
            self._markers.append(self._create_marker_widgets(num,
                self._marker_group))
Exemplo n.º 20
0
    def initUI(self):

        QtGui.QToolTip.setFont(QtGui.QFont('SansSerif', 10))

        self.setToolTip('This is a <b>QWidget</b> widget')

        btn = QtGui.QPushButton('Button', self)
        btn.setToolTip('This is a <b>QPushButton</b> widget')
        btn.resize(btn.sizeHint())
        btn.move(50, 50)

        # dynamically create button array
        bbGroup = {}
        bb = {}
        bbID = {
            0: 'Schwarzshield',
            1: 'Raman',
            2: 'DAC',
            3: 'S',
            4: 'Y',
            5: 'Z'
        }
        bbStackHPos = 0  # for storing the positions
        for i in range(len(bbID)):
            bbGroup[i] = QtGui.QButtonGroup(
                self
            )  # each button has to belong to its own QButtonGroup to be independently clickable
            bb[i] = QtGui.QRadioButton(bbID[i], self)
            bbGroup[i].addButton(bb[i])
            bb[i].resize(bb[i].sizeHint())
            bb[i].move(10 + bbStackHPos, 10)
            bbStackHPos = bbStackHPos + bb[i].sizeHint().width()

        qst = QtGui.QStatusBar(self)
        qst.showMessage('Ready')
        #qst.resize(qst.sizeHint())
        qst.resize(240, 20)
        qst.move(5, 120)
        qst.show()

        #menubar = self.QMenuBar()
        #fileMenu = menubar.addMenu('&File')
        #fileMenu.addAction(exitAction)

        #moods = [QtGui.QRadioButton("Happy"), QtGui.QRadioButton("Sad"), QtGui.QRadioButton("Angry")]
        #for i in range(len(moods)):
        #moods[i].resize(moods.sizeHint())
        #moods[i].move(20,50+i*10)

        self.resize(250, 150)
        self.center()

        self.setWindowTitle('Center')
        self.show()
Exemplo n.º 21
0
    def __init__(self, parent):
        View.__init__(self, parent)
        self._tabWidget = self._elements["tabWidget"]
        self._tabWidget.currentChanged[int].connect(self._updateView)
        self._tabWidget.tabCloseRequested.connect(self._close)
        self._tabWidget.setTabBar(ClosableTabBar())
        self._actionRefresh = self._elements["actionRefresh"]
        self._actionRefreshAll = self._elements["actionRefreshAll"]
        self._actionExpand = self._elements["actionExpand"]
        self._actionExpandAll = self._elements["actionExpandAll"]
        self._actionCollapse = self._elements["actionCollapse"]
        self._actionCollapseAll = self._elements["actionCollapseAll"]
        self._actionSearch = self._elements["actionSearch"]
        self._actionSave = self._elements["actionSave"]
        self._actionSaveAll = self._elements["actionSaveAll"]
        self._actionOpen = self._elements["actionOpen"]
        self._actionClose = self._elements["actionClose"]
        self._actionOpen.triggered.connect(self._openDialog)
        self._actionClose.triggered.connect(self._close)

        # Recent files menu
        self._recentFiles = LastValues(self.NAME, self._CONFIG_SECTION_MENU,
                                       "recent", 5)
        self._actionClearMenu = self._elements["actionClearMenu"]
        self._menuRecentFiles = self._menuFile[1]
        self._actionClearMenu.triggered.connect(self._recentFiles.clear)
        self._actionClearMenu.triggered.connect(self.updateRecentFiles)

        self._tabs = {}
        self._offlineDevs = {}
        self._readOnly = False

        self.search = SearchDialog(self)
        self._actionSearch.triggered.connect(self.search.run)

        self._dialogs = {
            'keyboard': KeyboardDialog(self),
            'mouse': MouseDialog(self)
        }

        # widgets
        self._states = self._elements["listWidgetStates"]
        self._relations = self._elements["listWidgetRelations"]
        self._attributes = self._elements["treeWidgetAttributes"]
        self._text = self._elements["textEditText"]
        self._changeText = self._elements["buttonChangeText"]
        self._actions = self._elements["groupBoxActions"]
        self._actionButtons = QtGui.QButtonGroup(self)
        self._value = self._elements["spinBoxValue"]
        self._changeValue = self._elements["buttonChangeValue"]
        self._mouse = self._elements["buttonMouse"]
        self._keyboard = self._elements["buttonKeyboard"]
        self.clear()
    def build_signals(self):
        self.numberButton = QtGui.QPushButton(str(self.number) + ':')
        self.signalSelect = QtGui.QComboBox()
        self.signalSelect.addItems(self.selectList)
        self.signalSelect.currentIndexChanged.connect(
            lambda: self.normalize_signal_boxes(self.signalSelect.currentIndex()))
        self.signalSelect.setMaxVisibleItems(22)
        self.signalValue = QtGui.QLabel()
        self.radio1 = QtGui.QRadioButton()
        self.radio2 = QtGui.QRadioButton()
        self.radio3 = QtGui.QRadioButton()
        self.radioGroup = QtGui.QButtonGroup()
        self.radioGroup.addButton(self.radio1, 1)
        self.radioGroup.addButton(self.radio2, 2)
        self.radioGroup.addButton(self.radio3, 3)
        self.radio1.released.connect(lambda: self.normalize_axes(1))
        self.radio2.released.connect(lambda: self.normalize_axes(2))
        self.radio3.released.connect(lambda: self.normalize_axes(3))
        self.fileSelect = QtGui.QComboBox()
        self.fileSelect.currentIndexChanged.connect(self.change_file)

        self.numberButton.setStyleSheet('background-color: ' + str(self.bgcolor) + ';' +
                                        'color: ' + str(self.fgcolor) + ';')
        self.signalValue.setStyleSheet('border:1px solid grey')

        self.numberButton.released.connect(self.num_butt_toggle)

        self.numberButton.setFixedWidth(25)
        self.signalSelect.setFixedWidth(250)
        self.signalValue.setFixedWidth(100)
        self.radio1.setFixedWidth(20)
        self.radio2.setFixedWidth(20)
        self.radio3.setFixedWidth(20)
        self.fileSelect.setFixedWidth(40)

        self.numberButton.setFixedHeight(30)
        self.signalSelect.setFixedHeight(30)
        self.signalValue.setFixedHeight(30)
        self.radio1.setFixedHeight(30)
        self.radio2.setFixedHeight(30)
        self.radio3.setFixedHeight(30)
        self.fileSelect.setFixedHeight(30)

        self.radio1.setChecked(True)

        self.main_window.signalLayout.addWidget(self.numberButton, self.number + 1, 0)
        self.main_window.signalLayout.addWidget(self.signalSelect, self.number + 1, 1)
        self.main_window.signalLayout.addWidget(self.signalValue, self.number + 1, 2)
        self.main_window.signalLayout.addWidget(self.radio1, self.number + 1, 3)
        self.main_window.signalLayout.addWidget(self.radio2, self.number + 1, 4)
        self.main_window.signalLayout.addWidget(self.radio3, self.number + 1, 5)
        self.main_window.signalLayout.addWidget(self.fileSelect, self.number + 1, 6)
Exemplo n.º 23
0
    def __init__(self, parent=None):
        """Initialize the object."""
        super(BoxfillEditor, self).__init__(parent=parent)
        self._gm = None
        self.var = None
        self.tmpl = None

        layout = QtGui.QVBoxLayout()
        self.setLayout(layout)

        self.boxfill_types = OrderedDict(
            Linear="linear",
            Logarithmic="log10",
            Custom="custom"
        )

        button_layout = QtGui.QHBoxLayout()
        label = QtGui.QLabel("Levels:")
        button_layout.addWidget(label)
        self.type_group = QtGui.QButtonGroup()
        for label in self.boxfill_types:
            radiobutton = QtGui.QRadioButton(label)
            button_layout.addWidget(radiobutton)
            self.type_group.addButton(radiobutton)

        layout.addLayout(button_layout)

        levels_button = QtGui.QPushButton("Edit Levels")
        levels_button.clicked.connect(self.editLevels)
        legend_button = QtGui.QPushButton("Edit Legend")
        legend_button.clicked.connect(self.editLegend)

        left_axis = QtGui.QPushButton("Edit Left Ticks")
        left_axis.clicked.connect(self.editLeft)
        right_axis = QtGui.QPushButton("Edit Right Ticks")
        right_axis.clicked.connect(self.editRight)
        bottom_axis = QtGui.QPushButton("Edit Bottom Ticks")
        bottom_axis.clicked.connect(self.editBottom)
        top_axis = QtGui.QPushButton("Edit Top Ticks")
        top_axis.clicked.connect(self.editTop)

        layout.addWidget(levels_button)
        layout.addWidget(legend_button)
        layout.addWidget(left_axis)
        layout.addWidget(right_axis)
        layout.addWidget(top_axis)
        layout.addWidget(bottom_axis)

        self.level_editor = None
        self.legend_editor = None
        self.axis_editor = None
        self.type_group.buttonClicked.connect(self.setBoxfillType)
Exemplo n.º 24
0
 def __init__(self, parent=None):
     super(mainMenu, self).__init__(parent)
     # self.setupUi(parent)
     self.setupUi(self)
     # ********************************** Initializing Constants ****************************************************
     self.lstBtn = 0
     self.const = readConst("app_conf", "constants")
     self.selectedPrd = ()
     self.order = []
     # **************************************************************************************************************
     self.btnGrp = QtGui.QButtonGroup()
     self.disMMenu()
     self.show()
Exemplo n.º 25
0
    def initUI(self):
        # Create Widget
        self.main_Layout = QtGui.QGridLayout()
        self.main_Layout.setContentsMargins(3, 0, 3, 0)
        self.main_Layout.setSpacing(10)
        self.setLayout(self.main_Layout)

        self.option_GroupBox = QtGui.QGroupBox("Option")
        self.option_Layout = QtGui.QGridLayout()
        self.timeOption_Label = QtGui.QLabel("Time range:")
        self.startEndFrame_Label = QtGui.QLabel("Start/End:")
        self.timeUnit_Label = QtGui.QLabel("Time Unit:")
        self.directory_Label = QtGui.QLabel("Directory:")
        self.timeOption1_RadioButton = QtGui.QRadioButton("Time Slider")
        self.timeOption2_RadioButton = QtGui.QRadioButton("Start/End")
        self.startFrame_LineEdit = QtGui.QLineEdit("1")
        self.endFrame_LineEdit = QtGui.QLineEdit("24")
        self.timeUnit_ComboBox = QtGui.QComboBox()
        self.fromScene_PushButton = QtGui.QPushButton("Policy")
        self.fromBrowser_PushButton = QtGui.QPushButton("Browser")
        self.directory_LineEdit = QtGui.QLineEdit()

        # Set Layout
        self.option_Layout.addWidget(self.timeOption_Label, 1, 0)
        self.option_Layout.addWidget(self.timeOption1_RadioButton, 1, 1)
        self.option_Layout.addWidget(self.timeOption2_RadioButton, 1, 2)
        self.option_Layout.addWidget(self.startEndFrame_Label, 2, 0)
        self.option_Layout.addWidget(self.startFrame_LineEdit, 2, 1)
        self.option_Layout.addWidget(self.endFrame_LineEdit, 2, 2)
        self.option_Layout.addWidget(self.timeUnit_Label, 3, 0)
        self.option_Layout.addWidget(self.timeUnit_ComboBox, 3, 2)
        self.option_Layout.addWidget(self.directory_Label, 4, 0)
        self.option_Layout.addWidget(self.fromScene_PushButton, 4, 1)
        self.option_Layout.addWidget(self.fromBrowser_PushButton, 4, 2)
        self.option_Layout.addWidget(self.directory_LineEdit, 5, 0, 1, 3)
        self.option_GroupBox.setLayout(self.option_Layout)
        self.main_Layout.addWidget(self.option_GroupBox, 0, 0)

        self.timeOption_BttnGrp = QtGui.QButtonGroup(self)
        self.timeOption_BttnGrp.addButton(self.timeOption1_RadioButton)
        self.timeOption_BttnGrp.addButton(self.timeOption2_RadioButton)

        # Set Widget
        self.setWindowTitle("ExportOption")
        self.timeOption1_RadioButton.setChecked(True)
        self.startFrame_LineEdit.setEnabled(False)
        self.endFrame_LineEdit.setEnabled(False)
        self.timeUnit_ComboBox.addItem("Film(24 fps)")
        self.timeUnit_ComboBox.addItem("PAL(25 fps)")
        self.timeUnit_ComboBox.addItem("NTSC(30 fps)")
        self.timeUnit_ComboBox.addItem("Game(15 fps)")
    def prepareGUI(self):
        # velikost není potřeba specifikovat
        # self.resize(320, 240)
        self.setWindowTitle("QCheckBox")

        self.buttonGroup = QtGui.QButtonGroup()
        self.buttonGroup.setExclusive(True)

        # testovací zaškrtávací tlačítka
        self.testCheckBox1 = QtGui.QCheckBox("check box 1")
        self.testCheckBox2 = QtGui.QCheckBox("check box 2")
        self.testCheckBox3 = QtGui.QCheckBox("check box 3")
        self.testCheckBox4 = QtGui.QCheckBox("check box 4")
        self.testCheckBox5 = QtGui.QCheckBox("check box 5")

        self.buttonGroup.addButton(self.testCheckBox1)
        self.buttonGroup.addButton(self.testCheckBox2)
        self.buttonGroup.addButton(self.testCheckBox3)
        self.buttonGroup.addButton(self.testCheckBox4)
        self.buttonGroup.addButton(self.testCheckBox5)

        # stav checkboxů
        self.testCheckBox1.setCheckState(QtCore.Qt.Checked)

        # tlačítko pro zjištění stavů checkboxů
        testButton = QtGui.QPushButton("Print state")

        # tlačítko pro ukončení aplikace
        quitButton = QtGui.QPushButton("Quit")

        # vytvoření správce geometrie
        layout = QtGui.QVBoxLayout()

        # umístění widgetů do okna
        layout.addWidget(self.testCheckBox1)
        layout.addWidget(self.testCheckBox2)
        layout.addWidget(self.testCheckBox3)
        layout.addWidget(self.testCheckBox4)
        layout.addWidget(self.testCheckBox5)
        layout.addWidget(testButton)
        layout.addWidget(quitButton)

        # nastavení správce geometrie a vložení všech komponent do okna
        self.setLayout(layout)

        # po stisku testovacího tlačítka se zavolá metoda
        testButton.clicked.connect(self.printState)

        # navázání akce na stisk tlačítka pro ukončení aplikace
        quitButton.clicked.connect(self.quit)
Exemplo n.º 27
0
    def createButtons(self):
        """
        Creates a button group for the network instance buttons
        """

        # Net count variable keeps track of total number of created instances,
        # including those that were deleted. Button group id's come from here
        self.netCount = -1
        # Limit on number of network instances
        self.netCap = 10


        # Create a button group for the network instance buttons
        self.netButtonGroup = QtGui.QButtonGroup(self.layout_netInstance)
        self.netButtonGroup.setExclusive(True)
Exemplo n.º 28
0
    def create_chart_type_group(self):
        vbox = QtGui.QVBoxLayout()
        self.rg_chart_type = QtGui.QButtonGroup()
        self.rg_chart_type.setExclusive(True)

        for i, choice in enumerate(self.config.chart_types):
            radio = QtGui.QRadioButton(choice)
            self.rg_chart_type.addButton(radio, i)
            if i == self.config.chart_type:
                radio.setChecked(True)
            vbox.addWidget(radio)

        vbox.addStretch(1)
        self.rg_chart_type.buttonClicked.connect(self.bg_graph_type_changed)
        return vbox
Exemplo n.º 29
0
    def _create_time_layout(self):
        group = QtWidgets.QGroupBox("Range: ")
        layout = _build_layout(False)
        group.setLayout(layout)
        self._main_layout.addWidget(group)

        h_layout = _build_layout(True)
        buttonGroup = QtWidgets.QButtonGroup(self)
        self._entire_button = QtWidgets.QRadioButton("Entire Curve")
        self._entire_button.setChecked(1)
        self._entire_button.setFixedWidth(120)
        self._time_slider_button = QtWidgets.QRadioButton("Time Slider")
        self._time_slider_button.setFixedWidth(120)
        self._custom_range_button = QtWidgets.QRadioButton("Custom")
        h_layout.addWidget(self._entire_button)
        h_layout.addWidget(self._time_slider_button)
        h_layout.addWidget(self._custom_range_button)

        layout.addLayout(h_layout)

        buttonGroup.addButton(self._entire_button)
        buttonGroup.addButton(self._time_slider_button)
        buttonGroup.addButton(self._custom_range_button)

        h_layout = _build_layout(True)
        self._parent_custom_range = QtWidgets.QWidget()
        self._parent_custom_range.setFixedWidth(290)
        self._parent_custom_range.setLayout(h_layout)
        l = QtWidgets.QLabel("Custom: ")
        l.setFixedWidth(60)
        h_layout.addWidget(l)
        self._custom_range_begin = QtWidgets.QSpinBox()
        self._custom_range_begin.setFixedWidth(100)
        min = cmds.playbackOptions(q=True, minTime=True)
        self._custom_range_begin.setValue(min)
        h_layout.addWidget(self._custom_range_begin)
        l = QtWidgets.QLabel("-")
        l.setFixedWidth(10)
        h_layout.addWidget(l)
        self._custom_range_end = QtWidgets.QSpinBox()
        self._custom_range_end.setFixedWidth(100)
        max = cmds.playbackOptions(q=True, maxTime=True)
        self._custom_range_end.setValue(max)
        h_layout.addWidget(self._custom_range_end)

        self._parent_custom_range.setEnabled(False)

        layout.addWidget(self._parent_custom_range)
Exemplo n.º 30
0
    def setupUi(self, Dialog):
        Dialog.setObjectName("Dialog")
        Dialog.resize(502, 364)
        self.verticalLayout_2 = QtGui.QVBoxLayout(Dialog)
        self.verticalLayout_2.setObjectName("verticalLayout_2")
        self.verticalLayout = QtGui.QVBoxLayout()
        self.verticalLayout.setObjectName("verticalLayout")
        self.rb_useStackFrame = QtGui.QRadioButton(Dialog)
        self.rb_useStackFrame.setObjectName("rb_useStackFrame")
        self.buttonGroup = QtGui.QButtonGroup(Dialog)
        self.buttonGroup.setObjectName("buttonGroup")
        self.buttonGroup.addButton(self.rb_useStackFrame)
        self.verticalLayout.addWidget(self.rb_useStackFrame)
        self.rb_useStruct = QtGui.QRadioButton(Dialog)
        self.rb_useStruct.setChecked(True)
        self.rb_useStruct.setObjectName("rb_useStruct")
        self.buttonGroup.addButton(self.rb_useStruct)
        self.verticalLayout.addWidget(self.rb_useStruct)
        self.listWidget = QtGui.QListWidget(Dialog)
        sizePolicy = QtGui.QSizePolicy(QtGui.QSizePolicy.MinimumExpanding, QtGui.QSizePolicy.Expanding)
        sizePolicy.setHorizontalStretch(0)
        sizePolicy.setVerticalStretch(0)
        sizePolicy.setHeightForWidth(self.listWidget.sizePolicy().hasHeightForWidth())
        self.listWidget.setSizePolicy(sizePolicy)
        self.listWidget.setObjectName("listWidget")
        self.verticalLayout.addWidget(self.listWidget)
        self.horizontalLayout = QtGui.QHBoxLayout()
        self.horizontalLayout.setObjectName("horizontalLayout")
        self.checkBox = QtGui.QCheckBox(Dialog)
        self.checkBox.setObjectName("checkBox")
        self.horizontalLayout.addWidget(self.checkBox)
        spacerItem = QtGui.QSpacerItem(40, 20, QtGui.QSizePolicy.Minimum, QtGui.QSizePolicy.Minimum)
        self.horizontalLayout.addItem(spacerItem)
        self.lineEdit = QtGui.QLineEdit(Dialog)
        self.lineEdit.setObjectName("lineEdit")
        self.horizontalLayout.addWidget(self.lineEdit)
        self.verticalLayout.addLayout(self.horizontalLayout)
        self.verticalLayout_2.addLayout(self.verticalLayout)
        self.buttonBox = QtGui.QDialogButtonBox(Dialog)
        self.buttonBox.setOrientation(QtCore.Qt.Horizontal)
        self.buttonBox.setStandardButtons(QtGui.QDialogButtonBox.Cancel|QtGui.QDialogButtonBox.Ok)
        self.buttonBox.setObjectName("buttonBox")
        self.verticalLayout_2.addWidget(self.buttonBox)

        self.retranslateUi(Dialog)
        QtCore.QObject.connect(self.buttonBox, QtCore.SIGNAL("accepted()"), Dialog.accept)
        QtCore.QObject.connect(self.buttonBox, QtCore.SIGNAL("rejected()"), Dialog.reject)
        QtCore.QMetaObject.connectSlotsByName(Dialog)