def __init__(self, parent=None):
   super(TreeContainer, self).__init__(parent)
   self._soln = None
   self.tree_loaded.connect(self._handleTreeLoaded)
   self._stacksize_compound = StackSizeCompound()
   self.combobox_compound = BoardComboCompound()
   self.dofp_compound = DoFPCompound()
   self.treeview_game = GameTreeView(self.combobox_compound.combobox_board)
   self.treeview_game.tree_updated.connect(self._handleTreeUpdated)
   self._stacksize_compound.spinbox_stacksize.setValue(500)
   self._stacksize_compound.spinbox_stacksize.valueChanged.connect(self._handleSpinboxChange)
   self.dofp_compound.button_execute.setEnabled(False)
   self.dofp_compound.button_execute.clicked.connect(self._executeFP)
   selection_model = self.treeview_game.selectionModel()
   selection_model.selectionChanged.connect(self._handleSelectionChanged)
   layout = QGridLayout()
   control_layout = QHBoxLayout()
   control_layout.addWidget(self._stacksize_compound)
   control_layout.addWidget(self.combobox_compound)
   control_layout.addWidget(self.dofp_compound)
   control_layout.addStretch()
   row = 0; col = 0;
   layout.addLayout(control_layout, row, col, 1, 2)
   row += 1; col = 0
   layout.addWidget(self.treeview_game, row, col, 1, 2)
   self.setLayout(layout)
   self.setWindowTitle("Game Tree Viewer")
   self._setupContextMenu()
Example #2
0
 def __init__(self, parent = None):
     super(SettingsPage, self).__init__(parent)
     self.setMinimumSize(800, 600)
     self.addProperty(grizzle.User, "email", 0, 0)
     self.addProperty(grizzle.User, "display_name", 1, 0)
     self.addProperty(sweattrails.userprofile.UserProfile,
                      "_userprofile.dob", 2, 0)
     self.addProperty(sweattrails.userprofile.UserProfile,
                      "_userprofile.gender", 3, 0,
                      style = "radio")
     self.addProperty(sweattrails.userprofile.UserProfile,
                      "_userprofile.height", 4, 0,
                      min = 100, max = 240, suffix = "cm")
     self.addProperty(sweattrails.userprofile.UserProfile,
                      "_userprofile.units", 5, 0,
                      style = "radio")
     
     withingsB = QGroupBox("Withings Support",  self)
     withingsL = QGridLayout(withingsB)
     self.enableWithings = QCheckBox("Enable Withings",  withingsB)
     self.enableWithings.toggled.connect(self.toggleWithings)
     withingsL.addWidget(self.enableWithings, 0, 0)
     withingsL.addWidget(QLabel("Withings User ID"), 1, 0)
     self.withingsUserID = QLineEdit(withingsB)
     withingsL.addWidget(self.withingsUserID, 1, 1)
     withingsL.addWidget(QLabel("Withings Key"), 2, 0)
     self.withingsKey = QLineEdit(withingsB)
     withingsL.addWidget(self.withingsKey, 2, 1)
     self.addWidget(withingsB, self.form.rowCount(), 0, 1, 2)
     self.addStretch()
     self.statusMessage.connect(QCoreApplication.instance().status_message)
Example #3
0
    def __init__(self, app, hub, html, debug=False):
        QDialog.__init__(self)
        self.app = app
        self.hub = hub
        self.html = addpool.html
        self.debug = debug
        self.url = "file:///" \
            + os.path.join(self.app.property("ResPath"), "www/", html).replace('\\', '/')

        self.is_first_load = True
        self.view = web_core.QWebView(self)

        if not self.debug:
            self.view.setContextMenuPolicy(qt_core.Qt.NoContextMenu)

        self.view.setCursor(qt_core.Qt.ArrowCursor)
        self.view.setZoomFactor(1)

        self.setWindowTitle("Add/Edit Pool :: %s" % APP_NAME)
        self.icon = self._getQIcon('ombre_64x64.png')
        self.setWindowIcon(self.icon)

        layout = QGridLayout()
        layout.addWidget(self.view)
        self.setLayout(layout)

        self.setFixedSize(qt_core.QSize(660, 480))
        self.center()

        self.view.loadFinished.connect(self._load_finished)
        #         self.view.load(qt_core.QUrl(self.url))
        self.view.setHtml(self.html, qt_core.QUrl(self.url))
Example #4
0
    def realize(self):
        """This function is part of initialization where it handles
           ModuleAgent creation and wiring and subclass view placement.
        """
        # Create and wire the Agent into the Boxfish tree
        self.agent = self.agent_type(self.parent_frame.agent,
                                     self.parent_frame.agent.datatree)
        self.agent.module_scene = self.scene_type(self.agent_type,
                                                  self.display_name)
        self.parent_frame.agent.registerChild(self.agent)

        # Create and place the module-specific view elements
        self.view = self.createView()
        self.centralWidget = QWidget()

        layout = QGridLayout()
        if isinstance(self.parent(), BFDockWidget):
            layout.addWidget(DragDockLabel(self.parent()), 0, 0, 1, 2)

        # TODO: Replace magic number with not-magic constant
        layout.addWidget(self.view, 100, 0, 1, 2)  # Add view at bottom
        layout.setRowStretch(100, 5)  # view has most row stretch

        left, top, right, bottom = layout.getContentsMargins()
        layout.setContentsMargins(0, 0, 0, 0)
        self.centralWidget.setLayout(layout)

        self.setCentralWidget(self.centralWidget)

        # Tab Dialog stuff
        self.enable_tab_dialog = True
        self.dialog = list()
Example #5
0
 def __init__(self, stepper):
     QWidget.__init__(self)
     button_layout = QGridLayout()
     self.setLayout(button_layout)
     button_layout.setColumnStretch(0, 0)
     button_layout.setColumnStretch(1, 0)
     button_layout.setColumnStretch(3, 0)
     button_layout.setRowStretch(0, 0)
     button_layout.setRowStretch(1, 0)
     button_layout.setRowStretch(3, 0)
     button_layout.setRowStretch(4, 0)
     qmy_button(button_layout, stepper.go_to_previous_turn, "pre", the_row=0, the_col=0)
     qmy_button(button_layout, stepper.go_to_next_turn, "next", the_row=0, the_col=1)
     qmy_button(button_layout, stepper.insert_before, "ins before", the_row=1, the_col=0)
     qmy_button(button_layout, stepper.insert_after, "ins after", the_row=1, the_col=1)
     qmy_button(button_layout, stepper.delete_current_turn, "delete turn", the_row=1, the_col=2)
     qmy_button(button_layout, stepper.commit, "commit", the_row=2, the_col=0)
     qmy_button(button_layout, stepper.commit_all, "commit all", the_row=2, the_col=1)
     qmy_button(button_layout, stepper.revert_current_and_redisplay, "revert", the_row=2, the_col=2)
     qmy_button(button_layout, stepper.save_file, "save", the_row=3, the_col=0)
     qmy_button(button_layout, stepper.save_file_as, "save as ...", the_row=3, the_col=1)
     qmy_button(button_layout, stepper.fill_time_code, "fill time", the_row=4, the_col=0)
     qmy_button(button_layout, stepper.sync_video, "sync video", the_row=4, the_col=1)
     button_layout.addWidget(QWidget(), 2, 3)
     button_layout.addWidget(QWidget(), 5, 0)
Example #6
0
    def getParameterWidget(self):
        """
		Returns a widget with sliders / fields with which properties of this
		volume property can be adjusted.
		:rtype: QWidget
		"""
        layout = QGridLayout()
        layout.setContentsMargins(0, 0, 0, 0)
        layout.setAlignment(Qt.AlignTop)

        self.sliders = []
        for index in range(7):
            slider = QSlider(Qt.Horizontal)
            slider.setMinimum(0)
            slider.setMaximum(1000)
            slider.setValue(
                int(
                    math.pow(self.sectionsOpacity[index], 1.0 / 3.0) *
                    slider.maximum()))
            slider.valueChanged.connect(self.valueChanged)
            self.sliders.append(slider)
            label = QLabel(self.sectionNames[index])
            label.setAlignment(Qt.AlignRight | Qt.AlignVCenter)
            layout.addWidget(label, index, 0)
            layout.addWidget(slider, index, 1)

        try:
            from ColumnResizer import ColumnResizer
            columnResizer = ColumnResizer()
            columnResizer.addWidgetsFromLayout(layout, 0)
        except Exception, e:
            print e
	def __init__(self):
		super(TransferFunctionWidget, self).__init__()

		self.nodes = []
		self.lines = []
		self.histogram = Histogram()
		self.histogram.enabled = False

		# Create a histogram widget for the background of the transfer function editor
		self.histogramWidget = HistogramWidget()
		self.histogramWidget.setHistogram(self.histogram)
		self.histogramWidget.setAxeMode(bottom=HistogramWidget.AxeClear, left=HistogramWidget.AxeLog)
		self.histogramWidget.update()
		self.histogramWidget._histogramItem.delegate = self
		Style.styleWidgetForTab(self.histogramWidget)

		# Invisible item that catches mouse events on top of the histogram
		self.transferfunctionItem = TransferFunctionItem()
		self.transferfunctionItem.setZValue(250)
		self.transferfunctionItem.delegate = self
		self.histogramWidget.addItem(self.transferfunctionItem)

		# Create a widget for editing the selected node of the transfer function
		self.nodeItemWidget = NodeItemWidget()
		self.nodeItemWidget.setEnabled(False)
		self.nodeItemWidget.nodeUpdated.connect(self.updateNode)
		self.nodeItemWidget.removePoint.connect(self.removePoint)

		layout = QGridLayout()
		layout.setSpacing(0)
		layout.setContentsMargins(0, 0, 0, 0)
		layout.addWidget(self.histogramWidget, 0, 0)
		layout.addWidget(self.nodeItemWidget, 1, 0)
		self.setLayout(layout)
class MainFrame(QWidget):

    def __init__(self, parent):
        self.parent = parent
        QWidget.__init__(self)
        self.state = "Opening Screen"
        self.setAutoFillBackground(True)
        self.layout = QGridLayout(self)
        self.setLayout(self.layout)
        self.currentWidget = Header(self)
        self.setPalette(self.currentWidget.palette())
        self.layout.addWidget(self.currentWidget, 0, 0, 2, 2)
        #self.layout.setSizeConstraint(QLayout.SetFixedSize)
        self.currentWidget.show()
        self.show()
        self.raise_()

    def changeState(self, newWidgetState):
        if not validateState():
            newWidgetState = GAME.state
        self.setPalette(newWidgetState.palette())
        self.currentWidget.hide()
        self.layout.addWidget(newWidgetState, 0, 0)
        self.currentWidget = newWidgetState
        newWidgetState.show()
        self.center()

    def center(self):
        # Center window
        qr = self.frameGeometry()
        qr.moveCenter(QDesktopWidget().availableGeometry().center())
        self.move(qr.topLeft())
class TeamSelect(QWidget):

    def __init__(self, parent):
        self.parent = parent
        QWidget.__init__(self)
        self.initUI()


    def initUI(self):
        self.grid = QGridLayout()
        self.setLayout(self.grid)

        teamnames = json_reader.readJSON('teams.json')

        i = 0
        j = 0
        for team in teamnames:
            tbutton = QPushButton(team['name'])
            team_pic = QPixmap("%s.jpg"%team['name'])
            tbutton.setIcon(QIcon(team_pic))
            tbutton.setIconSize(team_pic.rect().size())
            tbutton.clicked.connect(lambda t=team: self.chooseTeam(t))
            self.grid.addWidget(tbutton, i % 10, j)
            i += 1
            j = j + 1 if i % 10 == 0 else j # this is the dumb


    def chooseTeam(self, team):
        GAME.setTeam(team)
        self.parent.changeState(GAME.state)
Example #10
0
class layout(QWidget):
    
    '''
    Podesavanje layouta
    '''
    
    def __init__(self,Editor,sceneView):
        '''
        Sluzi za podesavanje layouta
        '''
        QWidget.__init__(self)
        #stablo
        self.root = hierarchy_node.Node("Workspace")
        self.treeModel = hierarchy_tree_model.HierarchyTreeModel(self.root)
        self.tree = hierarchy_tree_view.HierarchyTreeView()
        self.tree.setModel(self.treeModel)
        #toolbar
        self.tBar=toolBar(Editor)
        #radna povrsina(zameniti kasnije)
        self.sceneView=sceneView
        #radna povrs
        self.workspaceLayout = QGridLayout()
        
        self.workspaceLayout.addWidget(self.tree,0,0,2,2,0)
        self.workspaceLayout.addWidget(self.tBar,0,3,1,1,0)
        self.workspaceLayout.addWidget(self.sceneView,1,3,1,1,0)
        
        self.setLayout(self.workspaceLayout)
        
        
Example #11
0
    def __init__(self, width, height, grid):
        super(GameOfLifeWidget, self).__init__()
        self.setWindowTitle('Game Of Life')
        layout = QGridLayout()
        layout.setSpacing(0)
        layout.setContentsMargins(0, 0, 0, 0)
        main_layout = QVBoxLayout()
        self.buttons = []
        self.grid = grid
        self.width = width
        self.height = height
        self.timer = QTimer()
        self.timer.setInterval(INTERVAL)
        self.timer.timeout.connect(self._handle_timeout)

        self.start_button = QPushButton("Start")
        self.start_button.clicked.connect(self._handle_start)
        self.clear_button = QPushButton("Clear")
        self.clear_button.clicked.connect(self._handle_clear)

        main_layout.addLayout(layout)
        main_layout.addWidget(self.start_button)
        main_layout.addWidget(self.clear_button)
        self.setLayout(main_layout)
        for y_pos in range(height):
            row = []
            self.buttons.append(row)
            for x_pos in range(width):
                button = QPushButton()
                row.append(button)
                button.setMaximumWidth(20)
                button.setMaximumHeight(20)
                button.clicked.connect(self._handle_click)
                layout.addWidget(button, y_pos, x_pos)
        self._update_gui()
    def initUI(self):
        # container = QWidget(self)
        # container.resize(200, 100);
        # container.setStyleSheet("background-color:black;")

        font_size = QLabel('Font Size')
        font_size.fillColor = QColor(30, 30, 30, 120)
        font_size.penColor = QColor("#333333")

        grid = QGridLayout()
        grid.setContentsMargins(50, 10, 10, 10)
        grid.addWidget(font_size, 0, 0)
        self.setLayout(grid)

        # palette = QPalette(self.palette())
        # palette.setColor(self.backgroundRole(), Qt.black)
        # palette.setColor(palette.Background, Qt.transparent)

        # self.setPalette(palette)

    # def paintEvent(self, event):        
    #     painter = QPainter()
    #     painter.begin(self)
    #     # painter.setRenderHint(QPainter.Antialiasing)
    #     painter.fillRect(event.rect(), QBrush(QColor(255, 255, 255, 127)))
    #     painter.drawLine(self.width() / 8, self.height() / 8, 7 * self.width() / 8, 7 * self.height() / 8)
    #     painter.drawLine(self.width() / 8, 7 * self.height() / 8, 7 * self.width() / 8, self.height() / 8)
    #     # painter.setPen(QPen(Qt.NoPen)) 
Example #13
0
    def __init__(self,
                 parent,
                 template=LICENSE_TEXT,
                 templateMap=LICENSE_TEMPLATE_MAP,
                 titleText='License',
                 flagSettingName='acceptedLicense'):
        '''
    '''
        super(OnceDialog, self).__init__(parent)
        self.template = template
        self.templateMap = templateMap
        self.titleText = titleText
        self.flagSettingName = flagSettingName

        self.scrollingText = QPlainTextEdit(self.filledTemplatedText(),
                                            parent=self)

        # buttons
        buttonBox = QDialogButtonBox(QDialogButtonBox.Ok
                                     | QDialogButtonBox.Cancel)

        # One scrolling text widget
        layout = QGridLayout()
        layout.addWidget(self.scrollingText)

        layout.addWidget(buttonBox)
        self.setLayout(layout)
        self.setWindowTitle(self.tr(self.titleText))

        # connections
        buttonBox.accepted.connect(self.accept)
        buttonBox.rejected.connect(self.reject)

        self.setGeometry(0, 0, 600, 480)
Example #14
0
class Event(QWidget):

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

        self.setWindowTitle('loadFinished Event')


        url = QUrl('https://www.torproject.org/')

        self.webView = QWebView()
        self.webView.setUrl(url)

        page = self.webView.page()
        frame = page.mainFrame()

        frame.loadFinished.connect(self.load_finished)
    

        self.mainLayout = QGridLayout()
        self.mainLayout.addWidget(self.webView)

        self.setLayout(self.mainLayout)


    def load_finished(self):
        print 'load has finished'
	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.slicesLabel = QLabel("Show slices for directions:")
		self.sliceLabelTexts = ["x:", "y:", "z:"]
		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)

		# Create a nice layout for the labels
		layout = QGridLayout()
		layout.setAlignment(Qt.AlignTop)
		layout.setColumnStretch(0, 1)
		layout.setColumnStretch(1, 3)
		layout.addWidget(self.slicesLabel, 0, 0, 1, -1)
		for index in range(3):
			layout.addWidget(self.sliceLabels[index], index+1, 0)
			layout.addWidget(self.sliceCheckBoxes[index], index+1, 1)

		# Create option to show clipping box
		self.clippingCheckBox = QCheckBox()
		self.clippingCheckBox.clicked.connect(self.clippingCheckBoxChanged)
		self.clippingLabel = QLabel("Clipping box:")
		self.clippingLabel.setAlignment(Qt.AlignRight | Qt.AlignVCenter)

		layout.addWidget(self.clippingLabel, 5, 0)
		layout.addWidget(self.clippingCheckBox, 5, 1)
		self.setLayout(layout)
Example #16
0
    def setLayout(self):
        self.myStatusBar = QStatusBar()
        self.setStatusBar(self.myStatusBar)

        self.duckIcon = QIcon("duck.jpeg")
        self.happyDuckIcon = QIcon("happy-duck.jpeg")
        qWidget = QWidget()
        gridLayout = QGridLayout(qWidget)
        row = 0
        self.setCentralWidget(qWidget)

        row = row + 1
        self.rebootButton = QPushButton("Click to reset")
        #self.rebootButton.setIcon(QIcon("duck.jpeg"))
        self.rebootButton.setIconSize(QSize(200, 200))
        gridLayout.addWidget(self.rebootButton, row, 0)
        self.rebootButton.clicked.connect(self.reboot)

        if filecmp.cmp("wpa_supplicant.conf", "wpa_supplicant.conf.orig"):
            self.myStatusBar.showMessage("Waiting to onboard.")
            self.rebootButton.setIcon(self.duckIcon)
            self.thread = Timer(5, self.checkFiles)
            self.thread.start()
        else:
            self.rebootButton.setIcon(self.happyDuckIcon)
            self.myStatusBar.showMessage("waiting for DHCP address")
            interface = "wlan1"
            p = subprocess.Popen(["/sbin/dhclient", interface],
                                 shell=False,
                                 stdin=subprocess.PIPE,
                                 stdout=subprocess.PIPE,
                                 stderr=subprocess.PIPE)
            res, err = p.communicate()
Example #17
0
class LabelWindow(QDialog):
    def __init__(self, parent):
        super(LabelWindow, self).__init__(parent)

        self.test_layout = QGridLayout()
        label = QLabel("Label")
        self.test_layout.addWidget(label, 0, 0)
        self.setLayout(self.test_layout)
        self._destroyCalled = False

    def replace(self, unit):
        old_item = self.test_layout.itemAtPosition(0, 0)
        old_label = old_item.widget()
        ref = weakref.ref(old_item, self._destroyed)

        self.test_layout.removeWidget(old_label)
        unit.assertRaises(RuntimeError, old_item.widget)
        del old_item

        label = QLabel("Label New")
        old_label.deleteLater()
        label.setAlignment(Qt.AlignCenter)
        self.test_layout.addWidget(label, 0, 0)

    def _destroyed(self, obj):
        self._destroyCalled = True
	def getParameterWidget(self):
		"""
		Returns a widget with sliders / fields with which properties of this
		volume property can be adjusted.
		:rtype: QWidget
		"""
		layout = QGridLayout()
		layout.setContentsMargins(0, 0, 0, 0)
		layout.setAlignment(Qt.AlignTop)

		self.sliders = []
		for index in range(7):
			slider = QSlider(Qt.Horizontal)
			slider.setMinimum(0)
			slider.setMaximum(1000)
			slider.setValue(int(math.pow(self.sectionsOpacity[index], 1.0/3.0) * slider.maximum()))
			slider.valueChanged.connect(self.valueChanged)
			self.sliders.append(slider)
			label = QLabel(self.sectionNames[index])
			label.setAlignment(Qt.AlignRight | Qt.AlignVCenter)
			layout.addWidget(label, index, 0)
			layout.addWidget(slider, index, 1)

		try:
			from ColumnResizer import ColumnResizer
			columnResizer = ColumnResizer()
			columnResizer.addWidgetsFromLayout(layout, 0)
		except Exception, e:
			print e
Example #19
0
 def __init__(self, *args, **kwargs ):
     
     self.uiInfoPath = Window.infoBaseDir + '/Widget_ctlListGroup.json'
     
     QWidget.__init__( self, *args, **kwargs )
     mainLayout = QVBoxLayout( self )
     buttonLayout = QHBoxLayout()
     gridLayout = QGridLayout()
     mainLayout.addLayout( buttonLayout )
     mainLayout.addLayout( gridLayout )
     
     gridLayout.setSpacing(5)
     gridLayout.setVerticalSpacing(5)
     
     b_addList = QPushButton( "Add List" )
     b_removeList = QPushButton( "Remove List" )
     buttonLayout.addWidget( b_addList )
     buttonLayout.addWidget( b_removeList )
     
     w_ctlList = Widget_ctlList()
     gridLayout.addWidget( w_ctlList )
 
     self.__gridLayout = gridLayout
     
     QtCore.QObject.connect( b_addList,    QtCore.SIGNAL( "clicked()" ), self.addList )
     QtCore.QObject.connect( b_removeList, QtCore.SIGNAL( "clicked()" ), self.removeList )
     
     self.loadInfo()
	def __init__(self):
		super(PointsWidget, self).__init__()

		self.landmarkWidgets = []
		self.activeIndex = 0

		self.scrollArea = QScrollArea(self)
		self.scrollArea.setFrameShape(QFrame.NoFrame)
		self.scrollArea.setAutoFillBackground(False)
		self.scrollArea.setAttribute(Qt.WA_TranslucentBackground)
		self.scrollArea.setHorizontalScrollBarPolicy(Qt.ScrollBarAlwaysOff)
		self.scrollArea.setWidgetResizable(True)

		landmarkLocationsLayout = QGridLayout()
		landmarkLocationsLayout.setSpacing(0)
		landmarkLocationsLayout.setContentsMargins(0, 0, 0, 0)
		landmarkLocationsLayout.setAlignment(Qt.AlignTop)

		self.landmarkLocationsWidget = QWidget()
		Style.styleWidgetForTab(self.landmarkLocationsWidget)
		self.landmarkLocationsWidget.setLayout(landmarkLocationsLayout)
		self.scrollArea.setWidget(self.landmarkLocationsWidget)

		layout = QGridLayout()
		layout.setContentsMargins(0, 0, 0, 0)
		layout.addWidget(self.scrollArea)
		self.setLayout(layout)
Example #21
0
class LabelWindow(QDialog):
    def __init__(self, parent):
        super(LabelWindow, self).__init__(parent)

        self.test_layout = QGridLayout()
        label = QLabel("Label")
        self.test_layout.addWidget(label, 0, 0)
        self.setLayout(self.test_layout)
        self._destroyCalled = False


    def replace(self, unit):
        old_item = self.test_layout.itemAtPosition(0, 0)
        old_label = old_item.widget()
        ref = weakref.ref(old_item, self._destroyed)

        self.test_layout.removeWidget(old_label)
        unit.assertRaises(RuntimeError, old_item.widget)
        del old_item

        label = QLabel("Label New")
        old_label.deleteLater()
        label.setAlignment(Qt.AlignCenter)
        self.test_layout.addWidget(label, 0, 0)

    def _destroyed(self, obj):
        self._destroyCalled = True
Example #22
0
 def preparePlots(self):
     '''arange 2x8 plots for each channel and
     set parameters
     '''
     if self.ui.frame.layout() is None:
         layout = QGridLayout()
         self.ui.frame.setLayout(layout)
     else:
         #########
         # reset #
         #########
         layout = self.ui.frame.layout()
         layout.removeWidget(self.plotWidget)
         self.plotWidget = None
         self.plots = []
     self.plotWidget = pg.GraphicsLayoutWidget(border=(100,100,100))
     layout.addWidget(self.plotWidget)
     
     for i in range(8):
         for k in range(2):
             self.plots.append(self.plotWidget.addPlot(title="EMG " + str(k+2*i+1)))
             self.plots[-1].plot(np.linspace(0,2,1000))
             self.plots[-1].setYRange(-0.0002, 0.0002)
         self.plotWidget.nextRow()
     
     self.plotWidget.show()
 def initUI(self):
     self.dateEdit = QDateEdit()
     layout = QGridLayout()
     layout.setContentsMargins(0, 0, 0, 0)
     layout.addWidget(self.dateEdit, 0, 0)
     layout.addItem(QSpacerItem(20, 20, QSizePolicy.Minimum, QSizePolicy.Expanding))
     self.setLayout(layout)
    def __init__(self):
        super(TransferFunctionWidget, self).__init__()

        self.nodes = []
        self.lines = []
        self.histogram = Histogram()
        self.histogram.enabled = False

        # Create a histogram widget for the background of the transfer function editor
        self.histogramWidget = HistogramWidget()
        self.histogramWidget.setHistogram(self.histogram)
        self.histogramWidget.setAxeMode(bottom=HistogramWidget.AxeClear,
                                        left=HistogramWidget.AxeLog)
        self.histogramWidget.update()
        self.histogramWidget._histogramItem.delegate = self
        Style.styleWidgetForTab(self.histogramWidget)

        # Invisible item that catches mouse events on top of the histogram
        self.transferfunctionItem = TransferFunctionItem()
        self.transferfunctionItem.setZValue(250)
        self.transferfunctionItem.delegate = self
        self.histogramWidget.addItem(self.transferfunctionItem)

        # Create a widget for editing the selected node of the transfer function
        self.nodeItemWidget = NodeItemWidget()
        self.nodeItemWidget.setEnabled(False)
        self.nodeItemWidget.nodeUpdated.connect(self.updateNode)
        self.nodeItemWidget.removePoint.connect(self.removePoint)

        layout = QGridLayout()
        layout.setSpacing(0)
        layout.setContentsMargins(0, 0, 0, 0)
        layout.addWidget(self.histogramWidget, 0, 0)
        layout.addWidget(self.nodeItemWidget, 1, 0)
        self.setLayout(layout)
Example #25
0
	def __init__(self, renderController, parent=None):
		super(RenderParameterWidget, self).__init__(parent=parent)

		self.renderController = renderController
		self.renderController.visualizationChanged.connect(self.visualizationLoaded)

		self.paramWidget = None

		self.visTypeComboBox = QComboBox()
		for visualizationType in self.renderController.visualizationTypes:
			self.visTypeComboBox.addItem(visualizationType)

		layout = QGridLayout()
		layout.setAlignment(Qt.AlignTop)
		layout.setSpacing(10)
		layout.setContentsMargins(10, 0, 10, 0)
		if len(self.renderController.visualizationTypes) > 1:
			layout.addWidget(QLabel("Visualization type:"), 0, 0)
			layout.addWidget(self.visTypeComboBox, 0, 1)
		self.setLayout(layout)

		self.scrollArea = QScrollArea()
		self.scrollArea.setFrameShape(QFrame.NoFrame)
		self.scrollArea.setAutoFillBackground(False)
		self.scrollArea.setAttribute(Qt.WA_TranslucentBackground)
		self.scrollArea.setWidgetResizable(True)

		self.visTypeComboBox.currentIndexChanged.connect(self.visTypeComboBoxChanged)
    def __init__(self,parent=None):
        super(Form,self).__init__(parent)

        date = self.get_data()
        rates = sorted(self.rates.keys())

        dateLabel = QLabel(date)

        self.fromComboBox = QComboBox()
        self.toComboBox = QComboBox()

        self.fromComboBox.addItems(rates)
        self.toComboBox.addItems(rates)

        self.fromSpinBox = QDoubleSpinBox()
        self.fromSpinBox.setRange(0.01,1000)
        self.fromSpinBox.setValue(1.00)

        self.toLabel = QLabel("1.00")

        layout = QGridLayout();
        layout.addWidget(dateLabel,5,0)
        layout.addWidget(self.fromComboBox, 1,0)
        layout.addWidget(self.toComboBox,2,0)
        layout.addWidget(self.fromSpinBox,1,1)
        layout.addWidget(self.toLabel,2,1)

        self.setLayout(layout)

        #Connect Signal
        self.fromComboBox.currentIndexChanged.connect(self.update_ui)
        self.toComboBox.currentIndexChanged.connect(self.update_ui)
        self.fromSpinBox.valueChanged.connect(self.update_ui)
Example #27
0
	def __init__(self, root_node, parent=None):
		super(AddScenarioDlg, self).__init__(parent)
		self.setWindowTitle("Add Scenario")
		
		type_label = QLabel("&Scenario Type:")
		self.type_combobox = QComboBox()
		type_label.setBuddy(self.type_combobox)
		self.type_combobox.addItems(["External Fire", "Liquid Overfill", "Regulator Failure"])
		device_label = QLabel("&Associated Relief Device:")
		self.device_combobox = QComboBox()
		device_label.setBuddy(self.device_combobox)
		for area in root_node.children:
			for device in area.children:
				self.device_combobox.addItem(device.name, device)
		button_box = QDialogButtonBox(QDialogButtonBox.Ok|QDialogButtonBox.Cancel)
			
		layout = QGridLayout()
		layout.addWidget(type_label, 0, 0)
		layout.addWidget(self.type_combobox, 0, 1)
		layout.addWidget(device_label, 1, 0)
		layout.addWidget(self.device_combobox, 1, 1)
		layout.addWidget(button_box, 2, 1)
		self.setLayout(layout)
		
		button_box.accepted.connect(self.accept)
		button_box.rejected.connect(self.reject)
	def __init__(self):
		super(TransformationParameterWidget, self).__init__()

		self.cancelButton = QPushButton("Cancel")
		self.cancelButton.clicked.connect(self.cancelButtonClicked)

		self.applyButton = QPushButton("Apply")
		self.applyButton.clicked.connect(self.applyButtonClicked)

		self.mainLayout = QGridLayout()
		self.mainLayout.setSpacing(0)
		self.mainLayout.setContentsMargins(0, 0, 0, 0)

		self.widget = QWidget()
		self.widget.setLayout(self.mainLayout)

		self.showControls(False)

		self.transformationWidget = None
		layout = QGridLayout()
		layout.setAlignment(Qt.AlignTop)
		layout.addWidget(self.widget, 0, 0, 1, 2)
		layout.addWidget(self.cancelButton, 1, 0)
		layout.addWidget(self.applyButton, 1, 1)
		self.setLayout(layout)
Example #29
0
    def __init__(self, parent, title, sub_title):
        super(AbstractEntry, self).__init__(parent)

        self.setTitle(title)
        self.setSubTitle(sub_title)

        self.score = QComboBox(self)

        self.score.insertItems(5,
                               ["1 - Poor",
                                "2 - Fair",
                                "3 - Good",
                                "4 - Great",
                                "5 - Outstanding"])

        self.comments = QPlainTextEdit(self)
        self.comments.textChanged.connect(self.comments_changed)

        field = "%s.comments*" % title

        self.registerField(field,
                           self.comments,
                           "plainText",
                           SIGNAL("textChanged()"))

        layout = QGridLayout(self)

        layout.addWidget(QLabel(self.tr("Score:"), self),    0, 0)
        layout.addWidget(self.score,                         0, 1)
        layout.addWidget(QLabel(self.tr("Comments:"), self), 1, 0)
        layout.addWidget(self.comments,                      1, 1)
    def getParameterWidget(self):
        matrixLayout = QGridLayout()
        matrixLayout.setAlignment(Qt.AlignTop)
        matrixLayout.setContentsMargins(0, 0, 0, 0)
        matrixLayout.setSpacing(5)
        matrixLayout.addWidget(QLabel("Transformation matrix:"), 0, 0, 1, 4)
        self.m1Edits = [QLineEdit() for _ in range(4)]
        self.m2Edits = [QLineEdit() for _ in range(4)]
        self.m3Edits = [QLineEdit() for _ in range(4)]
        self.m4Edits = [QLineEdit() for _ in range(4)]
        self.initLineEdits(self.m1Edits, matrixLayout, 1, 0)
        self.initLineEdits(self.m2Edits, matrixLayout, 2, 0)
        self.initLineEdits(self.m3Edits, matrixLayout, 3, 0)
        self.initLineEdits(self.m4Edits, matrixLayout, 4, 0)
        expandingWidget = QWidget()
        expandingWidget.setSizePolicy(
            QSizePolicy(QSizePolicy.Expanding, QSizePolicy.Expanding))
        matrixLayout.addWidget(expandingWidget, 5, 0, 1, 4)

        matrixWidget = QWidget()
        matrixWidget.setLayout(matrixLayout)
        self.transformUpdated(
            self.renderWidget.transformations.completeTransform())

        return matrixWidget
Example #31
0
    def realize(self):
        """This function is part of initialization where it handles
           ModuleAgent creation and wiring and subclass view placement.
        """
        # Create and wire the Agent into the Boxfish tree
        self.agent = self.agent_type(self.parent_frame.agent, self.parent_frame.agent.datatree)
        self.agent.module_scene = self.scene_type(self.agent_type, self.display_name)
        self.parent_frame.agent.registerChild(self.agent)

        # Create and place the module-specific view elements
        self.view = self.createView()
        self.centralWidget = QWidget()

        layout = QGridLayout()
        if isinstance(self.parent(), BFDockWidget):
            layout.addWidget(DragDockLabel(self.parent()), 0, 0, 1, 2)

        # TODO: Replace magic number with not-magic constant
        layout.addWidget(self.view, 100, 0, 1, 2)  # Add view at bottom
        layout.setRowStretch(100, 5)  # view has most row stretch

        left, top, right, bottom = layout.getContentsMargins()
        layout.setContentsMargins(0, 0, 0, 0)
        self.centralWidget.setLayout(layout)

        self.setCentralWidget(self.centralWidget)

        # Tab Dialog stuff
        self.enable_tab_dialog = True
        self.dialog = list()
Example #32
0
 def visual_proxy(self, read_only=False):
     view = QWidget()
     layout = QGridLayout()
     for row, attr in enumerate(["name", "surname", "age"]):
         layout.addWidget(QLabel(attr), row, 0)
         layout.addWidget(self.visual_proxy_attribute(attr, read_only), row, 1)
     view.setLayout(layout)
     return view
    def __init__(self, hyperdeck, state, mainWindow):
        super(RecorderClipSelectionScreen, self).__init__()
        self.hyperdeck = hyperdeck
        self.state = state
        self.mainWindow = mainWindow

        self.selected_clip = None

        layout = QGridLayout()

        lblTitle = TitleLabel("Select clip")
        layout.addWidget(lblTitle, 0, 0, 1, 3)

        self.clipTable = QTableWidget()
        self.clipTable.setColumnCount(2)
        self.clipTable.setHorizontalHeaderLabels(['ID', 'Clip name'])
        self.clipTable.horizontalHeader().setStretchLastSection(True)
        self.clipTable.setSelectionBehavior(
            QAbstractItemView.SelectionBehavior.SelectRows)

        self.clipTable.itemSelectionChanged.connect(self._onClipSelected)

        layout.addWidget(self.clipTable, 1, 0, 1, 3)

        b = ExpandingButton()
        b.setText("Back")
        b.setIcon(QIcon(":icons/go-previous"))
        b.setToolButtonStyle(Qt.ToolButtonStyle.ToolButtonTextBesideIcon)
        b.clicked.connect(mainWindow.stepBack)
        layout.addWidget(b, 2, 0)

        btnRefresh = ExpandingButton()
        btnRefresh.setText('Refresh')
        btnRefresh.setIcon(QIcon(':icons/refresh'))
        btnRefresh.setToolButtonStyle(
            Qt.ToolButtonStyle.ToolButtonTextBesideIcon)

        def refresh():
            self.populateClipsList({})
            hyperdeck.broadcastClipsList()

        btnRefresh.clicked.connect(refresh)

        layout.addWidget(btnRefresh, 2, 1)

        self.btnSelect = ExpandingButton()
        self.btnSelect.setText("Cue clip")
        self.btnSelect.clicked.connect(self._cueClip)
        layout.addWidget(self.btnSelect, 2, 2)

        layout.setRowStretch(0, 0)
        layout.setRowStretch(1, 1)
        layout.setRowStretch(2, 0)

        self.setLayout(layout)

        self.populateClipsList(state.clip_listing)
Example #34
0
    def __init__(self):
        super(RenderWidget, self).__init__()

        # Default volume renderer
        self.renderer = vtkRenderer()
        self.renderer.SetBackground2(0.4, 0.4, 0.4)
        self.renderer.SetBackground(0.1, 0.1, 0.1)
        self.renderer.SetGradientBackground(True)
        self.renderer.SetLayer(0)

        # Overlay renderer which is synced with the default renderer
        self.rendererOverlay = vtkRenderer()
        self.rendererOverlay.SetLayer(1)
        self.rendererOverlay.SetInteractive(0)
        self.renderer.GetActiveCamera().AddObserver("ModifiedEvent",
                                                    self._syncCameras)

        self.rwi = QVTKRenderWindowInteractor(parent=self)
        self.rwi.SetInteractorStyle(vtkInteractorStyleTrackballCamera())
        self.rwi.GetRenderWindow().AddRenderer(self.renderer)
        self.rwi.GetRenderWindow().AddRenderer(self.rendererOverlay)
        self.rwi.GetRenderWindow().SetNumberOfLayers(2)
        self.rwi.SetDesiredUpdateRate(0)

        self.imagePlaneWidgets = [vtkImagePlaneWidget() for i in range(3)]
        for index in range(3):
            self.imagePlaneWidgets[index].DisplayTextOn()
            self.imagePlaneWidgets[index].SetInteractor(self.rwi)
            # Disable the margin for free rotation
            self.imagePlaneWidgets[index].SetMarginSizeX(0.0)
            self.imagePlaneWidgets[index].SetMarginSizeY(0.0)

        self.mapper = vtkOpenGLGPUVolumeRayCastMapper()
        self.mapper.SetAutoAdjustSampleDistances(1)
        self.volume = None
        self.imageData = None
        self.VolumeVisualization = None
        self.shouldResetCamera = False
        self.gridItems = []
        self.orientationGridItems = []

        self.clippingBox = ClippingBox()
        self.clippingBox.setWidget(self)

        # Keep track of the base and user transforms
        self.baseTransform = vtkTransform()
        self.userTransform = vtkTransform()

        self.setMinimumWidth(340)
        self.setMinimumHeight(340)

        layout = QGridLayout(self)
        layout.setSpacing(0)
        layout.setContentsMargins(0, 0, 0, 0)
        layout.addWidget(self.rwi, 0, 0)
        self.setLayout(layout)
Example #35
0
    def createView(self):
        """Creates the module-specific view for the FilterBox module."""
        view = QWidget()

        layout = QGridLayout()
        self.filter_label = QLabel("")
        layout.addWidget(self.filter_label, 0, 0, 1, 1)
        view.setLayout(layout)
        view.resize(20, 20)
        return view
Example #36
0
    def __init__(self, hyperdeck, state, mainWindow):
        super(RecorderClipSelectionScreen, self).__init__()
        self.hyperdeck = hyperdeck
        self.state = state
        self.mainWindow = mainWindow

        self.selected_clip = None

        layout = QGridLayout()

        lblTitle = TitleLabel("Select clip")
        layout.addWidget(lblTitle, 0, 0, 1, 3)

        self.clipTable = QTableWidget()
        self.clipTable.setColumnCount(2)
        self.clipTable.setHorizontalHeaderLabels(['ID', 'Clip name'])
        self.clipTable.horizontalHeader().setStretchLastSection(True)
        self.clipTable.setSelectionBehavior(QAbstractItemView.SelectionBehavior.SelectRows)

        self.clipTable.itemSelectionChanged.connect(self._onClipSelected)

        layout.addWidget(self.clipTable, 1, 0, 1, 3)

        b = ExpandingButton()
        b.setText("Back")
        b.setIcon(QIcon(":icons/go-previous"))
        b.setToolButtonStyle(Qt.ToolButtonStyle.ToolButtonTextBesideIcon)
        b.clicked.connect(mainWindow.stepBack)
        layout.addWidget(b, 2, 0)

        btnRefresh = ExpandingButton()
        btnRefresh.setText('Refresh')
        btnRefresh.setIcon(QIcon(':icons/refresh'))
        btnRefresh.setToolButtonStyle(Qt.ToolButtonStyle.ToolButtonTextBesideIcon)

        def refresh():
            self.populateClipsList({})
            hyperdeck.broadcastClipsList()

        btnRefresh.clicked.connect(refresh)

        layout.addWidget(btnRefresh, 2, 1)

        self.btnSelect = ExpandingButton()
        self.btnSelect.setText("Cue clip")
        self.btnSelect.clicked.connect(self._cueClip)
        layout.addWidget(self.btnSelect, 2, 2)

        layout.setRowStretch(0, 0)
        layout.setRowStretch(1, 1)
        layout.setRowStretch(2, 0)

        self.setLayout(layout)

        self.populateClipsList(state.clip_listing)
Example #37
0
    def __init__(self, fixtures_folder, parent=None):
        QWidget.__init__(self, parent)
        self.current_fixture = None
        self.fixtures_folder = fixtures_folder
        self.setWindowTitle("Frangitron DMX program editor")

        self.text = QPlainTextEdit()
        font = QFont("Monospace")
        font.setStyleHint(QFont.TypeWriter)
        font.setPixelSize(16)
        self.text.setFont(font)
        self.text.setStyleSheet(
            "color: white; background-color: rgb(30, 30, 30)")

        self.combo_fixture = QComboBox()

        self.frame_programs = QWidget()
        self.checkboxes_programs = list()
        self.layout_programs = QGridLayout(self.frame_programs)

        self.spinner_offset = QSpinBox()
        self.spinner_offset.setMinimum(1)
        self.spinner_offset.setMaximum(512)
        self.spinner_offset.setValue(1)
        self.spinner_offset.valueChanged.connect(self.address_changed)

        self.doc = QPlainTextEdit()
        self.doc.setReadOnly(True)
        self.doc.setFont(font)

        self.status = QLabel()

        layout = QGridLayout(self)
        layout.addWidget(self.combo_fixture, 0, 1)
        layout.addWidget(self.spinner_offset, 0, 2)
        layout.addWidget(self.frame_programs, 1, 1)
        layout.addWidget(self.text, 0, 0, 3, 1)
        layout.addWidget(self.doc, 2, 1, 1, 2)
        layout.addWidget(self.status, 3, 0, 1, 3)
        layout.setColumnStretch(0, 60)
        layout.setColumnStretch(1, 40)

        self.resize(1280, 800)

        self.streamer = Streamer(self.fixtures_folder)

        self.combo_fixture.addItems(sorted(self.streamer.fixtures))
        self.combo_fixture.currentIndexChanged.connect(self.fixture_changed)

        self.timer = QTimer()
        self.timer.timeout.connect(self.tick)
        self.timer.start(500.0 / FRAMERATE)
        self.should_reload = True

        self.fixture_changed()
	def __init__(self):
		super(RenderWidget, self).__init__()

		# Default volume renderer
		self.renderer = vtkRenderer()
		self.renderer.SetBackground2(0.4, 0.4, 0.4)
		self.renderer.SetBackground(0.1, 0.1, 0.1)
		self.renderer.SetGradientBackground(True)
		self.renderer.SetLayer(0)

		# Overlay renderer which is synced with the default renderer
		self.rendererOverlay = vtkRenderer()
		self.rendererOverlay.SetLayer(1)
		self.rendererOverlay.SetInteractive(0)
		self.renderer.GetActiveCamera().AddObserver("ModifiedEvent", self._syncCameras)

		self.rwi = QVTKRenderWindowInteractor(parent=self)
		self.rwi.SetInteractorStyle(vtkInteractorStyleTrackballCamera())
		self.rwi.GetRenderWindow().AddRenderer(self.renderer)
		self.rwi.GetRenderWindow().AddRenderer(self.rendererOverlay)
		self.rwi.GetRenderWindow().SetNumberOfLayers(2)
		self.rwi.SetDesiredUpdateRate(0)

		self.imagePlaneWidgets = [vtkImagePlaneWidget() for i in range(3)]
		for index in range(3):
			self.imagePlaneWidgets[index].DisplayTextOn()
			self.imagePlaneWidgets[index].SetInteractor(self.rwi)
			# Disable the margin for free rotation
			self.imagePlaneWidgets[index].SetMarginSizeX(0.0)
			self.imagePlaneWidgets[index].SetMarginSizeY(0.0)

		self.mapper = vtkOpenGLGPUVolumeRayCastMapper()
		self.mapper.SetAutoAdjustSampleDistances(1)
		self.volume = None
		self.imageData = None
		self.VolumeVisualization = None
		self.shouldResetCamera = False
		self.gridItems = []
		self.orientationGridItems = []

		self.clippingBox = ClippingBox()
		self.clippingBox.setWidget(self)

		# Keep track of the base and user transforms
		self.baseTransform = vtkTransform()
		self.userTransform = vtkTransform()

		self.setMinimumWidth(340)
		self.setMinimumHeight(340)

		layout = QGridLayout(self)
		layout.setSpacing(0)
		layout.setContentsMargins(0, 0, 0, 0)
		layout.addWidget(self.rwi, 0, 0)
		self.setLayout(layout)
Example #39
0
                def __init__(self):
                    super().__init__()
                    if separate_colorbars:
                        if rescale_colorbars:
                            self.vmins = tuple(np.min(u[0]) for u in U)
                            self.vmaxs = tuple(np.max(u[0]) for u in U)
                        else:
                            self.vmins = tuple(np.min(u) for u in U)
                            self.vmaxs = tuple(np.max(u) for u in U)
                    else:
                        if rescale_colorbars:
                            self.vmins = (min(np.min(u[0]) for u in U),) * len(U)
                            self.vmaxs = (max(np.max(u[0]) for u in U),) * len(U)
                        else:
                            self.vmins = (min(np.min(u) for u in U),) * len(U)
                            self.vmaxs = (max(np.max(u) for u in U),) * len(U)

                    layout = QHBoxLayout()
                    plot_layout = QGridLayout()
                    self.colorbarwidgets = [cbar_widget(self, vmin=vmin, vmax=vmax) if cbar_widget else None
                                            for vmin, vmax in zip(self.vmins, self.vmaxs)]
                    plots = [widget(self, grid, vmin=vmin, vmax=vmax, bounding_box=bounding_box, codim=codim)
                             for vmin, vmax in zip(self.vmins, self.vmaxs)]
                    if legend:
                        for i, plot, colorbar, l in zip(range(len(plots)), plots, self.colorbarwidgets, legend):
                            subplot_layout = QVBoxLayout()
                            caption = QLabel(l)
                            caption.setAlignment(Qt.AlignHCenter)
                            subplot_layout.addWidget(caption)
                            if not separate_colorbars or backend == 'matplotlib':
                                subplot_layout.addWidget(plot)
                            else:
                                hlayout = QHBoxLayout()
                                hlayout.addWidget(plot)
                                if colorbar:
                                    hlayout.addWidget(colorbar)
                                subplot_layout.addLayout(hlayout)
                            plot_layout.addLayout(subplot_layout, int(i/columns), (i % columns), 1, 1)
                    else:
                        for i, plot, colorbar in zip(range(len(plots)), plots, self.colorbarwidgets):
                            if not separate_colorbars or backend == 'matplotlib':
                                plot_layout.addWidget(plot, int(i/columns), (i % columns), 1, 1)
                            else:
                                hlayout = QHBoxLayout()
                                hlayout.addWidget(plot)
                                if colorbar:
                                    hlayout.addWidget(colorbar)
                                plot_layout.addLayout(hlayout, int(i/columns), (i % columns), 1, 1)
                    layout.addLayout(plot_layout)
                    if not separate_colorbars:
                        layout.addWidget(self.colorbarwidgets[0])
                        for w in self.colorbarwidgets[1:]:
                            w.setVisible(False)
                    self.setLayout(layout)
                    self.plots = plots
Example #40
0
class Board(QWidget):
	def __init__(self, theme, parent=None):
		super(Board, self).__init__(parent)

		self.theme = theme
		self.num = 8

		self.lay = QGridLayout(self)
		self.lay.setContentsMargins(15, 10, 15, 10)
		self.lay.setHorizontalSpacing(0)
		self.lay.setVerticalSpacing(0)

		self.setLayout(self.lay)

		self.diamonds = []
		self.selected = None
		self.generateDiamonds(self.num)

	def generateDiamonds(self, num):
		for y in range(0, num):
			for x in range(0, num):
				diamond = Diamond(random.choice(Colors), self.theme, self)
				diamond.clicked.connect(self.diamondClicked)
				self.lay.addWidget(diamond, x, y)

				self.diamonds.append(diamond)

	def paintEvent(self, event):
		painter = QPainter()

		painter.begin(self)
		self.theme.render(painter, "kdiamond-border")
		painter.end()

	@Slot(Diamond)
	def diamondClicked(self, diamond):
		if self.selected is diamond:
			self.selected = None
			diamond.select(False)
			diamond.update()
		else:
			if self.selected is not None:
				if self.selected.color is diamond.color:
					self.selected.hide()
					diamond.hide()
					self.selected = None
					return

				self.selected.select(False)
				self.selected.update()

			diamond.select(True)
			diamond.update()
			self.selected = diamond
Example #41
0
 def setCanvas(self):
     ''' set widgets for a tab page
      - left side show image of current frame
      - right side show two plots: raw and rms
      - bot: button to edit triggers and slider to adjust 
             video-emg offset
     '''
     
     ########################
     # set matplotlib plots #
     ########################
     self.fig = Figure(dpi=70)
     self.canvas = FigureCanvas(self.fig)
     self.canvas.setParent(self.ui.mainFrame)
     self.axes = self.fig.add_subplot(211)
     self.axesRMS = self.fig.add_subplot(212)
     self.mpl_toolbar = NavigationToolbar2(self.canvas, self.ui.mainFrame)
     self.canvas.mpl_connect('draw_event', self.onDraw)
     
     ####################################
     # add button to matplotlib toolbar #
     #################################### 
     redb = QPushButton('Edit Triggers')
     redb.setCheckable(True)
     self.mpl_toolbar.addWidget(redb)
     redb.clicked[bool].connect(self.toggleEditMode)
     
     # container for current frame of video 
     layout = pq.GraphicsLayoutWidget()
     vb = layout.addViewBox()
     vb.setAspectLocked(True)
     
     self.ri = pq.ImageItem()
     vb.addItem(self.ri)
     
     # layout to organize elements
     grid = QGridLayout()
     wrapper = QWidget()        
     vbox = QVBoxLayout(wrapper)
     splitter = QSplitter()
     
     vbox.addWidget(self.canvas)
     vbox.addWidget(self.mpl_toolbar)
     wrapper.setLayout(vbox)
     
     splitter.addWidget(layout)
     splitter.addWidget(wrapper)
     
     grid.addWidget(splitter)
     
     self.ri.show()
     layout.show()
     self.ui.mainFrame.setLayout(grid)
 def __init__(self, parent=None):
   super(AddRemoveGroupTreeContainer, self).__init__(parent)
   self._tree_spider_group = SpiderGroupTreeView()
   selection_model = self._tree_spider_group.selectionModel()
   selection_model.selectionChanged.connect(self._updateButtonText)
   self._button_add_remove = QPushButton(self.tr("Add launch group..."))
   self._button_add_remove.clicked.connect(self._updateTree)
   self._button_add_remove.setProperty("_state", ButtonStates.NO_SELECTION)
   layout = QGridLayout()
   layout.addWidget(self._tree_spider_group, 0, 0, 1, 2)
   layout.addWidget(self._button_add_remove, 1, 1)
   self.setLayout(layout)
Example #43
0
File: app.py Project: lite/pystut
    def __init__(self, parent=None):
        super(MainWindow, self).__init__(parent)
#        self.setObjectName("MainWindow")
        self.resize(731, 475)
        centralwidget = QWidget(self)
#        centralwidget.setObjectName("centralwidget")
        gridLayout = QGridLayout(centralwidget)
#        gridLayout.setObjectName("gridLayout")
        # textEdit needs to be a class variable.
        self.textEdit = QTextEdit(centralwidget)
#        self.textEdit.setObjectName("textEdit")
        gridLayout.addWidget(self.textEdit, 0, 0, 1, 1)
        self.setCentralWidget(centralwidget)
        menubar = QMenuBar(self)
        menubar.setGeometry(QRect(0, 0, 731, 29))
#        menubar.setObjectName("menubar")
        menu_File = QMenu(menubar)
#        menu_File.setObjectName("menu_File")
        self.setMenuBar(menubar)
        statusbar = QStatusBar(self)
#        statusbar.setObjectName("statusbar")
        self.setStatusBar(statusbar)
        actionShow_GPL = QAction(self)
#        actionShow_GPL.setObjectName("actionShow_GPL")
        actionShow_GPL.triggered.connect(self.showGPL)
        action_About = QAction(self)
#        action_About.setObjectName("action_About")
        action_About.triggered.connect(self.about)       
        iconToolBar = self.addToolBar("iconBar.png")
#------------------------------------------------------
# Add icons to appear in tool bar - step 1
        actionShow_GPL.setIcon(QIcon(":/showgpl.png"))
        action_About.setIcon(QIcon(":/about.png"))
        action_Close = QAction(self)
        action_Close.setCheckable(False)
        action_Close.setObjectName("action_Close")       
        action_Close.setIcon(QIcon(":/quit.png"))
#------------------------------------------------------
# Show a tip on the Status Bar - step 2
        actionShow_GPL.setStatusTip("Show GPL Licence")
        action_About.setStatusTip("Pop up the About dialog.")
        action_Close.setStatusTip("Close the program.")
#------------------------------------------------------
        menu_File.addAction(actionShow_GPL)
        menu_File.addAction(action_About)
        menu_File.addAction(action_Close)
        menubar.addAction(menu_File.menuAction())
 
        iconToolBar.addAction(actionShow_GPL)
        iconToolBar.addAction(action_About)
        iconToolBar.addAction(action_Close)
        action_Close.triggered.connect(self.close)
Example #44
0
File: app.py Project: lite/pystut
    def __init__(self, parent=None):
        super(MainWindow, self).__init__(parent)
        #        self.setObjectName("MainWindow")
        self.resize(731, 475)
        centralwidget = QWidget(self)
        #        centralwidget.setObjectName("centralwidget")
        gridLayout = QGridLayout(centralwidget)
        #        gridLayout.setObjectName("gridLayout")
        # textEdit needs to be a class variable.
        self.textEdit = QTextEdit(centralwidget)
        #        self.textEdit.setObjectName("textEdit")
        gridLayout.addWidget(self.textEdit, 0, 0, 1, 1)
        self.setCentralWidget(centralwidget)
        menubar = QMenuBar(self)
        menubar.setGeometry(QRect(0, 0, 731, 29))
        #        menubar.setObjectName("menubar")
        menu_File = QMenu(menubar)
        #        menu_File.setObjectName("menu_File")
        self.setMenuBar(menubar)
        statusbar = QStatusBar(self)
        #        statusbar.setObjectName("statusbar")
        self.setStatusBar(statusbar)
        actionShow_GPL = QAction(self)
        #        actionShow_GPL.setObjectName("actionShow_GPL")
        actionShow_GPL.triggered.connect(self.showGPL)
        action_About = QAction(self)
        #        action_About.setObjectName("action_About")
        action_About.triggered.connect(self.about)
        iconToolBar = self.addToolBar("iconBar.png")
        #------------------------------------------------------
        # Add icons to appear in tool bar - step 1
        actionShow_GPL.setIcon(QIcon(":/showgpl.png"))
        action_About.setIcon(QIcon(":/about.png"))
        action_Close = QAction(self)
        action_Close.setCheckable(False)
        action_Close.setObjectName("action_Close")
        action_Close.setIcon(QIcon(":/quit.png"))
        #------------------------------------------------------
        # Show a tip on the Status Bar - step 2
        actionShow_GPL.setStatusTip("Show GPL Licence")
        action_About.setStatusTip("Pop up the About dialog.")
        action_Close.setStatusTip("Close the program.")
        #------------------------------------------------------
        menu_File.addAction(actionShow_GPL)
        menu_File.addAction(action_About)
        menu_File.addAction(action_Close)
        menubar.addAction(menu_File.menuAction())

        iconToolBar.addAction(actionShow_GPL)
        iconToolBar.addAction(action_About)
        iconToolBar.addAction(action_Close)
        action_Close.triggered.connect(self.close)
    def initUI(self):
        # container = QWidget(self)
        # container.resize(200, 100);
        # container.setStyleSheet("background-color:black;")

        font_size = QLabel('Font Size')
        font_size.fillColor = QColor(30, 30, 30, 120)
        font_size.penColor = QColor("#333333")

        grid = QGridLayout()
        grid.setContentsMargins(50, 10, 10, 10)
        grid.addWidget(font_size, 0, 0)
        self.setLayout(grid)
 def __init__(self, parent, clients):
     super(ClientStartDialog, self).__init__(parent)
     grid_layout = QGridLayout(self)
     xpos = 0
     ypos = 0
     for client in clients:
         if client.status == ClientStati.NOT_RUNNING:
             start_button = QPushButton(self)
             start_button.setText(client.hostname.decode("utf-8"))
             start_button.clicked.connect(self.start_button_clicked)
             grid_layout.addWidget(start_button, ypos, xpos, 1, 1)
             xpos += 1
     self.clients = clients
Example #47
0
 def __init__(self):
     super(ElevatorApplication, self).__init__()
     self.floor = 0      # Current floor (domain = [0 ... numberFloors-1])
     self.direction = 0  # Direction of the cabin (domain: [-1, 0, 1])
     self.pending = []   # The list of floors that the cabin needs to go to
     self.timer = QTimer(self)
     self.timer.setSingleShot(True)
     self.elevatorWidget = ElevatorWidget(self, self, self.floorButtonPushed, self.cabinButtonPushed)        
     layout = QGridLayout(self)
     layout.addWidget(self.elevatorWidget, 0, 0)
     self.sm = buildStateMachine(self, ElevatorApplication.statemachineData)
     self.sm.start()
     self.show()
Example #48
0
    def __init__(self, parent, title=""):
        """Construct a TabDialog with the ModuleFrame parent and the
           given title.
        """
        super(TabDialog, self).__init__(parent)

        self.setWindowTitle(title)
        self.tabs = QTabWidget(self)
        self.setModal(True)

        # Need a layout to get resizing to work
        layout = QGridLayout()
        layout.addWidget(self.tabs, 0, 0)
        self.setLayout(layout)
Example #49
0
 def __init__(self, spiderName, resumable=False, parent=None):
     super(SpiderToolButton, self).__init__(parent)
     self._drag_start = None
     button_play = QToolButton()
     button_play.setIcon(QIcon("play.png"))
     self.triggered.connect(
         button_play.triggered
     )  # clicking the outer button run the play functionality
     button_play.setIconSize(QSize(32, 32))
     button_resume = QToolButton()
     button_resume.setEnabled(resumable)
     button_resume.setIcon(QIcon("resume.png"))
     button_resume.setIconSize(QSize(32, 32))
     button_pause = QToolButton()
     button_pause.setIcon(QIcon("pause.png"))
     button_pause.setIconSize(QSize(32, 32))
     self.label_spidername = QLabel(spiderName)
     self.label_spidername.setStyleSheet(self.stylesheet_label_spidername)
     layout = QGridLayout()
     layout.addWidget(self.label_spidername, 0, 0)
     layout.addWidget(button_pause, 1, 1)
     layout.addWidget(button_resume, 1, 2)
     layout.addWidget(button_play, 1, 3)
     layout.setContentsMargins(10, 8, 10, 8)
     self.setLayout(layout)
Example #50
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
Example #51
0
	def getParameterWidget(self):
		self.hueSlider = QSlider(Qt.Horizontal)
		self.hueSlider.setMaximum(360)
		self.hueSlider.setValue(self.fixedHue)
		self.hueSlider.valueChanged.connect(self.valueChanged)

		layout = QGridLayout()
		layout.setAlignment(Qt.AlignTop)
		layout.addWidget(QLabel("Base hue"), 0, 0)
		layout.addWidget(self.hueSlider, 0, 1)

		widget = QWidget()
		widget.setLayout(layout)
		return widget
Example #52
0
 def __init__(self, currentGroupNames=[], parent=None):
     super(GroupNameDialog, self).__init__(parent)
     self._current_groupnames = [
         groupname.lower() for groupname in currentGroupNames
     ]
     self.setModal(True)
     self.setWindowTitle(self.tr("Group name"))
     label_prompt = QLabel(self.tr("Enter new launch group name:"))
     self._lineedit__groupname = QLineEdit()
     self._label_warning = QLabel()
     self._label_warning.setStyleSheet("""
   QLabel {
     color: rgb(213, 17, 27);
     font-weight: bold;
   }
 """)
     self._button_ok = QPushButton(self.tr("OK"))
     button_cancel = QPushButton(self.tr("Cancel"))
     self._button_ok.clicked.connect(self._checkGroupName)
     button_cancel.clicked.connect(self.reject)
     layout = QGridLayout()
     row = 0
     col = 0
     layout.addWidget(label_prompt, 0, 0, 1, 4)
     row += 1
     layout.addWidget(self._lineedit__groupname, row, col, 1, 4)
     row += 1
     col += 2
     layout.addWidget(self._button_ok, row, col)
     col += 1
     layout.addWidget(button_cancel, row, col)
     self.setLayout(layout)
Example #53
0
    def __init__(self, parent=None):
        super(AddDialogWidget, self).__init__(parent)

        nameLabel = QLabel("Name")
        addressLabel = QLabel("Address")
        buttonBox = QDialogButtonBox(QDialogButtonBox.Ok
                                     | QDialogButtonBox.Cancel)

        self.nameText = QLineEdit()
        self.addressText = QTextEdit()

        grid = QGridLayout()
        grid.setColumnStretch(1, 2)
        grid.addWidget(nameLabel, 0, 0)
        grid.addWidget(self.nameText, 0, 1)
        grid.addWidget(addressLabel, 1, 0, Qt.AlignLeft | Qt.AlignTop)
        grid.addWidget(self.addressText, 1, 1, Qt.AlignLeft)

        layout = QVBoxLayout()
        layout.addLayout(grid)
        layout.addWidget(buttonBox)

        self.setLayout(layout)

        self.setWindowTitle("Add a Contact")

        buttonBox.accepted.connect(self.accept)
        buttonBox.rejected.connect(self.reject)
Example #54
0
    def initUI(self):
        # hbox = QHBoxLayout()
        hbox = QGridLayout()

        self.lineEdit = QLineEdit()
        self.browseButton = QPushButton("Browse")

        hbox.addWidget(self.lineEdit, 0, 0, )
        hbox.addWidget(self.browseButton, 0, 1)
        hbox.setContentsMargins(0, 0, 0, 0)

        self.browseButton.clicked.connect(self.grabFileName)

        self.setLayout(hbox)
Example #55
0
 def layout(self):
     layout = QGridLayout()
     layout.addWidget(self.btnOverlay, 0, 0)
     layout.addWidget(self.btnOverscan, 0, 1)
     layout.addWidget(self.btnFreeze, 1, 0)
     layout.addWidget(self.btnFade, 1, 1)
     self.setLayout(layout)
    def __init__(self, currentValue):
        super(HexPageChooser, self).__init__()
        self._result = None

        self.setWindowTitle('Choose Page')
        grid = QGridLayout()
        self.setLayout(grid)
        for column in range(16):
            for row in range(16):
                value = row * 0x1000 + column * 0x0100
                label = ClickableLabel('0x%04X' % value, value)
                label.clicked.connect(self._click_handler)
                grid.addWidget(label, row, column)
                if value == currentValue:
                    self._style_as_current(label)