Beispiel #1
0
 def enableShadow(self, offset=3, radius=9, color='black'):
     # Enable shadow for mainwidget with given features
     self.__effect = QtGui.QGraphicsDropShadowEffect(self)
     self.__effect.setBlurRadius(radius)
     self.__effect.setOffset(offset)
     self.__effect.setColor(QtGui.QColor(color))
     self.setGraphicsEffect(self.__effect)
Beispiel #2
0
 def create_label(self, start, end):
     print start, end
     self.up = not self.up
     infos = self.danmus[start:end]
     for i, info in enumerate(infos):
         #  if not self.up:
         #  i += 200
         l = QtGui.QLabel(self.centralwidget)
         l.setAlignment(QtCore.Qt.AlignLeading | QtCore.Qt.AlignRight
                        | QtCore.Qt.AlignTop)
         l.setStyleSheet('color: {};'.format(info['color']))
         f = l.font()
         f.setBold(True)
         f.setPointSize(18)
         l.setFont(f)
         des = QtGui.QGraphicsDropShadowEffect()
         des.setOffset(0, 0)
         des.setBlurRadius(6)
         des.setColor(QtGui.QColor('black'))
         l.setGraphicsEffect(des)
         txt = info['text']
         l.setText(txt)
         fm = l.fontMetrics()
         l.setFixedWidth(fm.width(txt))
         l.setFixedHeight(fm.height())
         l.setGeometry(QtCore.QRect(620, fm.height() * i, 0, 0))
         l.show()
         Danmu(l, self).move()
Beispiel #3
0
    def createControllerSection(self):

        #Create frames
        controller_frame = QtGui.QFrame(self)
        controller_left_frame = QtGui.QFrame(controller_frame)
        controller_right_frame = QtGui.QFrame(controller_frame)

        #Create layouts and add content
        controller_left_layout = QtGui.QVBoxLayout(controller_left_frame)
        controller_left_layout.addWidget(self.createControllerComboBox())
        controller_left_layout.addWidget(self.createControllerUnitTable())

        controller_right_layout = QtGui.QVBoxLayout(controller_right_frame)
        controller_right_layout.addLayout(self.createControllerButtons())
        controller_right_layout.addWidget(
            self.createControllerElectrodeTable())

        controller_section_layout = QtGui.QHBoxLayout(self)

        #Add left and right frames to main controller frame
        controller_section_layout.addWidget(controller_left_frame)
        controller_section_layout.addWidget(controller_right_frame)

        controller_frame.setLayout(controller_section_layout)
        controller_frame.setProperty("frameType", "sectionFrame")

        effect = QtGui.QGraphicsDropShadowEffect(controller_frame)
        effect.setOffset(0, 0)
        effect.setBlurRadius(2)
        effect.setColor(QtGui.QColor("#333333"))
        controller_frame.setGraphicsEffect(effect)

        self.createNewControllerDialog()
        return controller_frame
Beispiel #4
0
    def init_text(self, text, style):
        # self.label = QtGui.QLabel(text, parent=self)
        tcolor, bcolor = color_styles.get(style, color_styles['white'])

        effect = QtGui.QGraphicsDropShadowEffect(self)
        effect.setBlurRadius(7)
        effect.setColor(bcolor)
        effect.setOffset(0, 0)

        self.setStyleSheet(
            self._style_tmpl.format(
                font_size=self._font_size,
                font_family=self._font_family,
                color=tcolor,
            ))

        self.setGraphicsEffect(effect)
        self.setContentsMargins(0, 0, 0, 0)

        # layout = QtGui.QVBoxLayout()
        # layout.addWidget(self.label, 0, QtCore.Qt.AlignVCenter)
        # layout.setContentsMargins(0, 0, 0, 0)
        # self.setLayout(layout)

        _msize = self.minimumSizeHint()
        # _msize.setHeight(self.label.height()+16)
        self.resize(_msize)
 def hoverEnterEvent(self, event):
     #effect when cursor over legend items
     effect = QtGui.QGraphicsDropShadowEffect()
     effect.setOffset(1,1)
     effect.setBlurRadius(6)
     self.setGraphicsEffect(effect)
     QtGui.QGraphicsItemGroup.hoverEnterEvent(self, event)
Beispiel #6
0
    def focusInEvent(self, QFocusEvent):
        QtGui.QLineEdit.focusInEvent(self,
                                     QtGui.QFocusEvent(QtCore.QEvent.FocusIn))

        if self.field != None:
            self.parent().parent().setBottomFieldVisibility(self.field)
            effect = QtGui.QGraphicsDropShadowEffect(self)
            effect.setOffset(0, 0)
            effect.setBlurRadius(10)
            effect.setColor(QtGui.QColor("#6533AC"))
            self.setGraphicsEffect(effect)
        else:
            effect = QtGui.QGraphicsDropShadowEffect(self)
            effect.setOffset(0, 0)
            effect.setBlurRadius(10)
            effect.setColor(QtGui.QColor("#1053DA"))
            self.setGraphicsEffect(effect)
 def hoverEnterEvent(self, event):
     QtGui.QGraphicsItem.hoverEnterEvent(self, event)
     effect = QtGui.QGraphicsDropShadowEffect()
     color = QtGui.QColor(Qt.red)
     color.setAlpha(0.4 * 255)
     effect.setColor(color)
     effect.setBlurRadius(10)
     self.setGraphicsEffect(effect)
     self._hover = True
Beispiel #8
0
    def focusInEvent(self, QFocusEvent):
        QtGui.QComboBox.focusInEvent(self,
                                     QtGui.QFocusEvent(QtCore.QEvent.FocusIn))

        effect = QtGui.QGraphicsDropShadowEffect(self)
        effect.setOffset(0, 0)
        effect.setBlurRadius(15)
        effect.setColor(QtGui.QColor("#1053DA"))
        self.setGraphicsEffect(effect)
Beispiel #9
0
    def createPatternSection(self):
        pattern_frame = QtGui.QFrame(self)

        effect = QtGui.QGraphicsDropShadowEffect(pattern_frame)
        effect.setOffset(0, 0)
        effect.setBlurRadius(2)
        effect.setColor(QtGui.QColor("#333333"))
        pattern_frame.setGraphicsEffect(effect)

        return pattern_frame
Beispiel #10
0
 def botao_padrao(self, frame):
     for filho in frame.findChildren(QtGui.QPushButton):
         efeito = QtGui.QGraphicsDropShadowEffect()
         efeito.setColor(QtGui.QColor("#ff00ff"))
         efeito.setOffset(0, 0)
         efeito.setBlurRadius(15)
         filho.setGraphicsEffect(efeito)
         filho.setStyleSheet(
             " QPushButton{border-radius: 10px; border: none; background: #00ffff;}"
             "QPushButton:disabled {background: #FFF}")
Beispiel #11
0
    def createAnalysisSection(self):
        analysis_frame = QtGui.QFrame(self)

        effect = QtGui.QGraphicsDropShadowEffect(analysis_frame)
        effect.setOffset(0, 0)
        effect.setBlurRadius(2)
        effect.setColor(QtGui.QColor("#333333"))
        analysis_frame.setGraphicsEffect(effect)

        return analysis_frame
Beispiel #12
0
 def build_frame_bar(self):
     # Bar rectangle
     self._frame_bar_text_items = list()
     self._frame_bar_rect_item = self.addRect(
         0, 0, self.time_range, self.frame_bar_height, self.transparent_pen,
         QtGui.QBrush(QtCore.Qt.darkGray))
     drop_shadow_effect = QtGui.QGraphicsDropShadowEffect()
     drop_shadow_effect.setBlurRadius(6.0)
     drop_shadow_effect.setOffset(4.0, 4.0)
     self._frame_bar_rect_item.setGraphicsEffect(drop_shadow_effect)
     # Numbers
     for frame_number in range(self.start_frame, self.end_frame,
                               self.frame_number_stride):
         self._frame_bar_text_items.append(self.addText(str(frame_number)))
Beispiel #13
0
    def selected_effect(self):
        """
		desc:
			Creates the selected effect.

		returns:
			A QGraphicsEffect object.
		"""

        effect = QtGui.QGraphicsDropShadowEffect()
        effect.setColor(QtGui.QColor('#00FF00'))
        effect.setBlurRadius(32)
        effect.setOffset(8, 8)
        return effect
Beispiel #14
0
 def __init__(self, x, y, label='', parent=None):
     self.indicator = self._indicator(x, y, label, parent)
     self.active_color = "rgb(149,255,10)"
     self.nok_active_color = "rgb(179,7,10)"
     self.inactive_color = "rgb(179,173,171)"
     self.blink_thr = IndicatorBlinkThread(self, 1)
     self.blink_thr.status_signal.connect(self.change_active_state)
     self.blink_ok = True
     self.blink_status = 'ok'
     self.light_effect = QtGui.QGraphicsDropShadowEffect(self.indicator)
     self.light_effect.setOffset(0, 0)
     self.light_effect.setBlurRadius(0)
     self.indicator.setGraphicsEffect(self.light_effect)
     self.set_inactive_clr()
Beispiel #15
0
    def __init__(self, coralNode):
        QtGui.QGraphicsWidget.__init__(self)

        self._coralNode = weakref.ref(coralNode)
        self._coralNodeId = coralNode.id()
        self._spacerConstant = 5.0
        self._label = QtGui.QGraphicsSimpleTextItem(self)
        self._containedScene = NodeUiScene(self)
        self._shapePen = QtGui.QPen(QtCore.Qt.NoPen)
        self._attributeUis = []
        self._brush = QtGui.QBrush(self.color())
        self._selectedColor = QtGui.QColor(255, 255, 255)
        self._dropShadowEffect = QtGui.QGraphicsDropShadowEffect()
        self._canOpenThis = False
        self._parentNodeUi = None
        self._nodeUis = []
        self._showingRightClickMenu = False
        self._rightClickMenuItems = []
        self._nameChangedObserver = Observer()
        self._doubleClicked = False
        self._nodeViewWatching = None
        self._attributesProxyEnabled = False
        self._zValue = self.zValue()
        self._currentMagnifyFactor = 1.0

        parentNodeUi = self._addToParentScene(coralNode)
        if parentNodeUi:
            self._parentNodeUi = weakref.ref(parentNodeUi)

        self.setGraphicsEffect(self._dropShadowEffect)

        self._dropShadowEffect.setOffset(0.0, 10.0)
        self._dropShadowEffect.setBlurRadius(8.0)
        self._dropShadowEffect.setColor(QtGui.QColor(0, 0, 0, 50))

        self.setFlag(QtGui.QGraphicsItem.ItemIsMovable)
        self.setFlag(QtGui.QGraphicsItem.ItemIsSelectable)
        self.setAcceptHoverEvents(True)

        self._label.setBrush(self.labelsColor())

        self._shapePen.setColor(self._selectedColor)
        self._shapePen.setWidthF(1.5)

        coralApp.addNameChangedObserver(self._nameChangedObserver,
                                        self.coralNode(),
                                        self._coralNodeNameChanged)
Beispiel #16
0
    def __init__(self, parent=None):
        super(mainWindow, self).__init__(parent)

        self.setupUi(self)

        self.setFixedSize(465, 850)

        self.user_name = os.path.expanduser('~').split("\\")[-1]
        self.label.setText(self.user_name)

        # 隐藏边框
        self.setWindowFlags(QtCore.Qt.FramelessWindowHint)
        # 添加size grip
        size_grip = QtGui.QSizeGrip(self)
        self.sizegrip_layout.addWidget(
            size_grip, 0, QtCore.Qt.AlignBottom | QtCore.Qt.AlignRight)
        # shadow effect
        self.setAttribute(QtCore.Qt.WA_TranslucentBackground)
        self.shadow = QtGui.QGraphicsDropShadowEffect(self)
        self.shadow.setBlurRadius(15)
        self.shadow.setOffset(0, 0)
        self.main_frame.setGraphicsEffect(self.shadow)

        # 绑定鼠标事件
        self.title_bar_grp.last_clicked_pos = self.user_info_grp.last_clicked_pos = None
        self.title_bar_grp.main_dialog = self.user_info_grp.main_dialog = self
        implant_method(self.title_bar_grp, mousePressEvent, "mousePressEvent")
        implant_method(self.title_bar_grp, mouseMoveEvent, "mouseMoveEvent")
        implant_method(self.title_bar_grp, mouseReleaseEvent,
                       "mouseReleaseEvent")
        implant_method(self.user_info_grp, mousePressEvent, "mousePressEvent")
        implant_method(self.user_info_grp, mouseMoveEvent, "mouseMoveEvent")
        implant_method(self.user_info_grp, mouseReleaseEvent,
                       "mouseReleaseEvent")

        self.create_action()
        self.create_tray()

        self.tray_icon.show()

        # 如果想自己去写用户名和对应的ip可以注释掉这句
        self.getUserIp()

        self.tray_icon.activated.connect(self.tray_double_click)
        self.tray_icon.messageClicked.connect(self.message_clicked)
    def setupScene(self):
        self.m_scene.setSceneRect(-300, -200, 600, 460)

        linearGrad = QtGui.QLinearGradient(QtCore.QPointF(-100, -100),
                                           QtCore.QPointF(100, 100))
        linearGrad.setColorAt(0, QtGui.QColor(255, 255, 255))
        linearGrad.setColorAt(1, QtGui.QColor(192, 192, 255))
        self.setBackgroundBrush(linearGrad)

        radialGrad = QtGui.QRadialGradient(30, 30, 30)
        radialGrad.setColorAt(0, QtCore.Qt.yellow)
        radialGrad.setColorAt(0.2, QtCore.Qt.yellow)
        radialGrad.setColorAt(1, QtCore.Qt.transparent)

        pixmap = QtGui.QPixmap(60, 60)
        pixmap.fill(QtCore.Qt.transparent)

        painter = QtGui.QPainter(pixmap)
        painter.setPen(QtCore.Qt.NoPen)
        painter.setBrush(radialGrad)
        painter.drawEllipse(0, 0, 60, 60)
        painter.end()

        self.m_lightSource = self.m_scene.addPixmap(pixmap)
        self.m_lightSource.setZValue(2)

        for i in range(-2, 3):
            for j in range(-2, 3):
                if (i + j) & 1:
                    item = QtGui.QGraphicsEllipseItem(0, 0, 50, 50)
                else:
                    item = QtGui.QGraphicsRectItem(0, 0, 50, 50)

                item.setPen(QtGui.QPen(QtCore.Qt.black, 1))
                item.setBrush(QtGui.QBrush(QtCore.Qt.white))

                effect = QtGui.QGraphicsDropShadowEffect(self)
                effect.setBlurRadius(8)
                item.setGraphicsEffect(effect)
                item.setZValue(1)
                item.setPos(i * 80, j * 80)
                self.m_scene.addItem(item)
                self.m_items.append(item)
Beispiel #18
0
 def build_tag_bar(self):
     # Reset list of graphics items
     self._tag_bar_line_items = list()
     self._tag_bar_polygon_items = list()
     self._tag_bar_text_items = list()
     # Rectangle
     self._tag_bar_rect_item = self.addRect(
         0, self.frame_bar_height + 2, self.time_range, self.tag_bar_height,
         QtGui.QPen(QtCore.Qt.transparent),
         QtGui.QBrush(QtCore.Qt.darkGray))
     drop_shadow_effect = QtGui.QGraphicsDropShadowEffect()
     drop_shadow_effect.setBlurRadius(6.0)
     drop_shadow_effect.setOffset(4.0, 4.0)
     self._tag_bar_rect_item.setGraphicsEffect(drop_shadow_effect)
     # Tags
     for tag in self.tags:
         tag_item = QTimelineTag(tag.name, tag.frame, self)
         self.addItem(tag_item)
         self._tag_bar_text_items.append(tag_item)
Beispiel #19
0
    def createSensorSection(self):
        sensor_label = QtGui.QLabel("Sensor Section")

        sensor_button = QtGui.QPushButton("Sensor Button")

        sensor_layout = QtGui.QHBoxLayout(self)
        sensor_layout.addWidget(sensor_label, 0, QtCore.Qt.AlignCenter)
        sensor_layout.addWidget(sensor_button, 0, QtCore.Qt.AlignCenter)

        sensor_frame = QtGui.QFrame(self)
        sensor_frame.setLayout(sensor_layout)
        sensor_frame.setProperty("frameType", "sectionFrame")

        effect = QtGui.QGraphicsDropShadowEffect(sensor_frame)
        effect.setOffset(0, 0)
        effect.setBlurRadius(2)
        effect.setColor(QtGui.QColor("#333333"))
        sensor_frame.setGraphicsEffect(effect)

        return sensor_frame
Beispiel #20
0
 def label(self,text,level,percent):
     from PyQt4.QtCore import QObject, SIGNAL
     global count,cnt,nm,ddf,lss
     frame = QtGui.QFrame()
     #frame.setObjectName(QString("frame"+str(cnt))
     frame.setGeometry(QtCore.QRect(count, 25, 201, 101))
     
     if(level=="extreme"):
         frame.setStyleSheet("background-color: rgb(170, 0, 0);\nborder:0.5px solid;\nborder-radius: 5px;\nborder-color: qlineargradient(spread:pad, x1:0.519, y1:0, x2:0.531, y2:1, stop:0.0225989 rgba(164, 164, 164, 255), stop:1 rgba(255, 255, 255, 255));")
     if(level=="high"):
         frame.setStyleSheet("background-color: rgb(255, 96, 0);\nborder:0.5px solid;\nborder-radius: 5px;\nborder-color: qlineargradient(spread:pad, x1:0.519, y1:0, x2:0.531, y2:1, stop:0.0225989 rgba(164, 164, 164, 255), stop:1 rgba(255, 255, 255, 255));")
     if(level=="low"):
         frame.setStyleSheet("background-color: rgb(0, 197, 0);\nborder:0.5px solid;\nborder-radius: 5px;\nborder-color: qlineargradient(spread:pad, x1:0.519, y1:0, x2:0.531, y2:1, stop:0.0225989 rgba(164, 164, 164, 255), stop:1 rgba(255, 255, 255, 255));")	  
     #frame.setStyleSheet("background-color: rgb(255, 0, 0);")
     #frame.setFrameShape(QtGui.QFrame.StyledPanel)
 
     lbl = QtGui.QLabel(frame)
     lbl.setGeometry(QtCore.QRect(2, 5, 196, 61))
     lbl.setWordWrap(True)
     lbl.setStyleSheet("font: 14pt \"Segoe UI\";\nborder:none;")
     lbl.setAlignment(QtCore.Qt.AlignHCenter|QtCore.Qt.AlignTop)
     lbl.setText(text.title())
     lbl_2 = QtGui.QLabel(frame)
     lbl_2.setGeometry(QtCore.QRect(20, 55, 69, 41))
     lbl_2.setStyleSheet("font: 75 28pt \"Segoe UI\";\nborder:none;")
     lbl_2.setAlignment(QtCore.Qt.AlignCenter)
     st=str(percent)
     st+="%"
     lbl_2.setText(st)
     count=count+210
     self.stack.addChildWidget(frame)
     frame.setMouseTracking(True)
     effect=QtGui.QGraphicsDropShadowEffect()
     effect.setBlurRadius(50)
     frame.setGraphicsEffect(effect)
     frame.setObjectName(str("Frame"+str(nm)))       
     lss.append((str("Frame"+str(nm)),text))
     clickable(frame).connect(lambda: self.txtreturn(str(frame.objectName())))            
     cnt=cnt+1
     nm=nm+1
Beispiel #21
0
    def createWindow(self):
        """Draw the main window."""
        self.createMenu()

        with open(THEME + 'serieswatcher.css') as file_:
            self.setStyleSheet(file_.read())

        # Status Bar
        self.status = self.statusBar()
        self.nbEpisodes = QtGui.QLabel()
        self.status.addPermanentWidget(self.nbEpisodes)

        # Header
        self.imageSerie = QtGui.QLabel()
        self.imageSerie.setFixedHeight(140)
        self.imageSerie.setMaximumWidth(758)
        self.imageSerie.setAlignment(Qt.AlignTop)

        self.selectSerie = QtGui.QComboBox()
        self.reloadSelectSerie()

        layoutSerie = QtGui.QHBoxLayout()
        layoutSerie.addWidget(self.selectSerie, 2)

        self.description = QtGui.QLabel()
        self.description.setWordWrap(True)
        self.description.setAlignment(Qt.AlignTop)
        self.description.setScaledContents(True)

        scrollArea = QtGui.QScrollArea()
        scrollArea.setWidgetResizable(True)
        scrollArea.setWidget(self.description)
        scrollArea.setMinimumWidth(350)
        scrollArea.setFixedHeight(120)

        infos = QtGui.QVBoxLayout()
        infos.addLayout(layoutSerie)
        infos.addWidget(scrollArea)

        header = QtGui.QHBoxLayout()
        header.addLayout(infos)
        header.addWidget(self.imageSerie)

        hw = QtGui.QWidget()
        hw.setObjectName('header')
        hw.setLayout(header)
        hw.layout().setContentsMargins(8, 8, 8, 0)

        # Filters
        btnPlay = QtGui.QPushButton(QIcon(ICONS + 'forward.png'), '')
        btnPlay.setFlat(True)
        btnPlay.setToolTip(u"Jouer l'épisode suivant")
        btnPlay.clicked.connect(self.playFirstEpisode)

        btnRand = QtGui.QPushButton(QIcon(ICONS + 'random.png'), '')
        btnRand.setFlat(True)
        btnRand.setToolTip(u'Jouer un épisode au hasard')
        btnRand.clicked.connect(self.playRandomEpisode)

        self.searchBar = QtGui.QLineEdit()
        self.searchBar.setPlaceholderText('Rechercher...')
        self.searchBar.textChanged.connect(self.searchChanged)

        self.selectSeason = QtGui.QComboBox()
        self.selectSeason.currentIndexChanged.connect(self.refreshEpisodes)
        self.selectSeason.setMinimumContentsLength(18)

        self.filter = FilterMenu()
        self.filter.filterChanged.connect(self.refreshEpisodes)

        filterBar = QtGui.QHBoxLayout()
        filterBar.addWidget(btnPlay)
        filterBar.addWidget(btnRand)
        filterBar.addWidget(self.selectSeason)
        filterBar.addWidget(self.filter)
        filterBar.addStretch()
        filterBar.addWidget(self.searchBar)

        fbw = QtGui.QWidget()
        fbw.setObjectName('filterBar')
        fbw.setLayout(filterBar)
        fbw.layout().setContentsMargins(8, 4, 8, 4)
        fbw.setMinimumHeight(35)
        eff = QtGui.QGraphicsDropShadowEffect(self)
        eff.setBlurRadius(3)
        eff.setOffset(0, 0)
        fbw.setGraphicsEffect(eff)

        # Body
        self.episodes = EpisodesViewer()
        self.episodes.refreshEpisodes.connect(self.refreshScreen)
        self.episodes.pressEnter.connect(self.episodesDblClicked)
        self.episodes.viewStatusChanged.connect(self.viewStatusChanged)
        self.episodes.doubleClicked.connect(self.episodesDblClicked)
        self.episodes.playClicked.connect(self.playClicked)
        self.episodes.itemSelectionChanged.connect(self.refreshFooter)
        self.episodes.favoriteChanged.connect(self.favoriteChanged)
        body = QtGui.QHBoxLayout()
        body.addWidget(self.episodes)
        body.layout().setContentsMargins(0, 0, 0, 0)

        # Footer
        self.selectionTitle = QtGui.QLabel()
        self.selectionTitle.setAlignment(Qt.AlignTop)
        self.selectionDescription = QtGui.QLabel()
        self.selectionDescription.setWordWrap(True)
        self.selectionDescription.setAlignment(Qt.AlignTop)

        scrollArea = QtGui.QScrollArea()
        scrollArea.setWidgetResizable(True)
        scrollArea.setWidget(self.selectionDescription)

        self.selectionBtnFavorite = QtGui.QPushButton()
        self.selectionBtnFavorite.setFixedWidth(160)
        self.selectionBtnFavorite.setFlat(True)
        self.selectionBtnFavorite.clicked.connect(self.toggleSelectionFavorite)
        self.selectionBtnView = QtGui.QPushButton()
        self.selectionBtnView.setFlat(True)
        self.selectionBtnView.clicked.connect(self.toggleSelectionViewed)
        self.selectionNumberView = QtGui.QLabel()
        self.selectionLastView = QtGui.QLabel()

        self.selectionIconFavorite = QtGui.QLabel('<img src="%sstar.png" />' %
                                                  ICONS)
        self.selectionIconView = QtGui.QLabel('<img src="%scheck.png" />' %
                                              ICONS)

        episodeBarLayout = QtGui.QGridLayout()
        episodeBarLayout.addWidget(self.selectionIconFavorite, 0, 0)
        episodeBarLayout.addWidget(self.selectionBtnFavorite, 0, 1)
        episodeBarLayout.addWidget(self.selectionIconView, 1, 0)
        episodeBarLayout.addWidget(self.selectionBtnView, 1, 1)
        episodeBarLayout.addWidget(
            QtGui.QLabel('<img src="%seye.png" />' % ICONS), 2, 0)
        episodeBarLayout.addWidget(self.selectionNumberView, 2, 1)
        episodeBarLayout.addWidget(
            QtGui.QLabel('<img src="%scalendar.png" />' % ICONS), 3, 0)
        episodeBarLayout.addWidget(self.selectionLastView, 3, 1)

        bottomLayout = QtGui.QHBoxLayout()
        bottomLayout.addWidget(scrollArea)
        bottomLayout.addLayout(episodeBarLayout)

        footerLayout = QtGui.QVBoxLayout()
        footerLayout.addWidget(self.selectionTitle)
        footerLayout.addLayout(bottomLayout)

        self.footer = QtGui.QWidget()
        self.footer.setObjectName('footer')
        self.footer.setLayout(footerLayout)
        self.footer.hide()

        # Layout
        window = QtGui.QVBoxLayout()
        window.layout().setContentsMargins(0, 0, 0, 8)
        window.addWidget(hw)
        window.addWidget(fbw)
        window.addLayout(body, 1)
        window.addWidget(self.footer)

        win = QtGui.QWidget()
        win.setLayout(window)
        self.setCentralWidget(win)

        # Shortcuts
        sortcuts = [(Qt.CTRL + Qt.Key_F, self.searchBar.setFocus),
                    (Qt.Key_R, self.playRandomEpisode),
                    (Qt.CTRL + Qt.Key_Enter, self.playFirstEpisode),
                    (Qt.Key_F, self.toggleSelectionFavorite),
                    (Qt.Key_V, self.toggleSelectionViewed),
                    (Qt.Key_P, self.playClicked)]
        for key, action in sortcuts:
            QtGui.QShortcut(key, self).activated.connect(action)
Beispiel #22
0
    clockface = QtGui.QLabel(frame1)
    clockface.setObjectName("clockface")
    clockrect = QtCore.QRect(width / 2 - height * .4,
                             height * .45 - height * .4, height * .8,
                             height * .8)
    clockface.setGeometry(clockrect)
    dcolor = QColor(Config.digitalcolor).darker(0).name()
    lcolor = QColor(Config.digitalcolor).lighter(120).name()
    clockface.setStyleSheet(
        "#clockface { background-color: transparent; font-family:sans-serif;" +
        " font-weight: light; color: " + lcolor +
        "; background-color: transparent; font-size: " +
        str(int(Config.digitalsize * xscale)) + "px; " + Config.fontattr + "}")
    clockface.setAlignment(Qt.AlignCenter)
    clockface.setGeometry(clockrect)
    glow = QtGui.QGraphicsDropShadowEffect()
    glow.setOffset(0)
    glow.setBlurRadius(50)
    glow.setColor(QColor(dcolor))
    clockface.setGraphicsEffect(glow)

radar1rect = QtCore.QRect(3 * xscale, 344 * yscale, 300 * xscale, 275 * yscale)
objradar1 = Radar(frame1, Config.radar1, radar1rect, "radar1")

radar2rect = QtCore.QRect(3 * xscale, 622 * yscale, 300 * xscale, 275 * yscale)
objradar2 = Radar(frame1, Config.radar2, radar2rect, "radar2")

radar3rect = QtCore.QRect(13 * xscale, 50 * yscale, 700 * xscale, 700 * yscale)
objradar3 = Radar(frame2, Config.radar3, radar3rect, "radar3")

radar4rect = QtCore.QRect(726 * xscale, 50 * yscale, 700 * xscale,
Beispiel #23
0
    def __init__(self, parent=None):
        super(UiMainWindow, self).__init__(parent)
        QtGui.QApplication.setStyle("GTK")
        self.setWindowIcon(
            QtGui.QIcon('/usr/lib/resetter/data/icons/resetter-launcher2.png'))
        self.error_msg = QtGui.QMessageBox()
        self.error_msg.setIcon(QtGui.QMessageBox.Critical)
        self.error_msg.setWindowTitle("Error")
        self.euid = os.geteuid()
        self.detectRoot()
        directory = ".resetter/data"
        logdir = "/var/log/resetter"
        manifests = "/usr/lib/resetter/data/manifests"
        if not os.path.exists(logdir):
            os.makedirs(logdir)
        self.logger = logging.getLogger(__name__)
        self.logger.setLevel(logging.DEBUG)
        handler = logging.FileHandler('/var/log/resetter/resetter.log')
        handler.setLevel(logging.DEBUG)
        formatter = logging.Formatter(
            '%(asctime)s - %(name)s - %(funcName)s - %(levelname)s - %(message)s'
        )
        handler.setFormatter(formatter)
        self.logger.addHandler(handler)
        if 'PKEXEC_UID' in os.environ:
            self.logger.debug('Program was called via pkexec')
            self.user = pwd.getpwuid(int(os.environ["PKEXEC_UID"])).pw_name
            working_dir = '/home/{}'.format(self.user)
            os.chdir(working_dir)
        elif self.euid == 0 and 'PKEXEC_UID' not in os.environ:
            self.logger.debug("program was called via sudo or gksu")
        #self.uidChange = pwd.getpwnam(self.user).pw_uid
        #os.setuid(self.uidChange)
        #os.seteuid(os.environ["PKEXEC_UID"])
        if not os.path.exists(directory):
            os.makedirs(directory)
        os.chdir(directory)
        cwd = os.getcwd()
        data_dir = os.path.abspath(cwd + "/manifests")
        self.copy(manifests, data_dir)
        #os.seteuid(0)
        self.setAttribute(QtCore.Qt.WA_DeleteOnClose, True)
        self.resize(850, 650)
        palette = QtGui.QPalette()

        self.setPalette(palette)
        self.menubar = QtGui.QMenuBar(self)
        self.menubar.setGeometry(QtCore.QRect(0, 0, 798, 25))
        self.menuFile = QtGui.QMenu(self.menubar)
        self.menuTools = QtGui.QMenu(self.menubar)
        self.menuHelp = QtGui.QMenu(self.menubar)
        self.setMenuBar(self.menubar)
        self.statusbar = QtGui.QStatusBar(self)
        self.setStatusBar(self.statusbar)
        self.actionOpen = QtGui.QAction(self)
        self.actionSaveSnapshot = QtGui.QAction(self)
        self.actionSaveSnapshot.setStatusTip(
            'Save a snapshot of currently installed packages')
        self.actionOpen.triggered.connect(self.openManifest)
        self.actionSaveSnapshot.triggered.connect(self.save)
        self.actionExit = QtGui.QAction(self)
        self.actionExit.setShortcut('Ctrl+Q')
        self.actionExit.setStatusTip('Exit application')
        self.actionExit.triggered.connect(QtGui.qApp.quit)
        self.actionAbout = QtGui.QAction(self)
        self.actionAbout.triggered.connect(self.about)
        self.actionShow_Installed = QtGui.QAction(self)
        self.actionShow_Installed.setStatusTip(
            'Show list of installed packages')
        self.actionShow_Installed.triggered.connect(self.showInstalled)
        self.menuFile.addAction(self.actionOpen)
        self.menuFile.addAction(self.actionSaveSnapshot)
        self.menuFile.addSeparator()
        self.menuFile.addAction(self.actionExit)
        self.menuTools.addAction(self.actionShow_Installed)
        self.menuHelp.addAction(self.actionAbout)
        self.menubar.addAction(self.menuFile.menuAction())
        self.menubar.addAction(self.menuTools.menuAction())
        self.menubar.addAction(self.menuHelp.menuAction())
        self.menuFile.setTitle("File")
        self.menuTools.setTitle("Tools")
        self.menuHelp.setTitle("Help")
        self.actionExit.setText("Exit")
        self.actionOpen.setText("Open manifest")
        self.actionSaveSnapshot.setText('Save')
        self.actionAbout.setText("About")
        self.actionCustom_Reset = QtGui.QAction(self)
        self.menuTools.addAction(self.actionCustom_Reset)
        self.actionCustom_Reset.setText("Custom Reset")
        self.actionCustom_Reset.setStatusTip('Custom Reset')
        self.actionCustom_Reset.triggered.connect(self.customReset)
        self.actionShow_Installed.setText("Show installed")
        font = QtGui.QFont()
        font.setPointSize(25)
        button_style = ("""
                    QPushButton {
                    color: #333;
                    border: 2px solid #555;
                    background-color: #99ccff;
                    border-radius: 30px;
                    padding: 5px;
                    background: qradialgradient(cx: 0.5, cy: -0.6,
                    fx: -0.5, fy: 0.6,
                    radius: 1.35, stop: 0 #fff, stop: 1 #888);
                    }

                    QPushButton:hover {
                    background: qradialgradient(cx: 0.5, cy: 0.3,
                    fx: 0.5, fy: 0.3,
                    radius: 1.35, stop: 0 #fff, stop: 1 #888);
                    min-width: 80px;
                    }

                    QPushButton:pressed {
                    background: qradialgradient(cx: 0.7, cy: -0.7,
                    fx: 0.7, fy: -0.7,
                    radius: 1.35, stop: 0 #fff, stop: 1 #888);
                    }

                    """)
        self.btnReset = QtGui.QPushButton(self)
        self.btnReset.setText("Automatic Reset", )
        self.btnReset.setFixedSize(614, 110)
        self.btnReset.setFont(font)
        self.btnReset.setStyleSheet(button_style)
        self.btnReset.setIcon(
            QtGui.QIcon('/usr/lib/resetter/data/icons/auto-reset-icon.png'))
        self.btnReset.setIconSize(QtCore.QSize(130, 150))
        self.btnReset.clicked.connect(self.warningPrompt)
        self.btnCustomReset = QtGui.QPushButton(self)
        self.btnCustomReset.setText("Custom Reset")
        self.btnCustomReset.setFixedSize(614, 110)
        self.btnCustomReset.setFont(font)
        self.btnCustomReset.setStyleSheet(button_style)
        self.btnCustomReset.clicked.connect(self.customReset)
        self.btnCustomReset.setIcon(
            QtGui.QIcon('/usr/lib/resetter/data/icons/custom-reset-icon.png'))
        self.btnCustomReset.setIconSize(QtCore.QSize(80, 80))
        self.centralWidget = QtGui.QWidget()
        self.os_version_label = QtGui.QLabel()
        self.os_name_label = QtGui.QLabel()
        self.os_codename_label = QtGui.QLabel()
        self.os_info = lsb_release.get_lsb_information()
        dse = QtGui.QGraphicsDropShadowEffect()
        dse.setBlurRadius(5)
        self.os_name_label.setText('OS Name: ' + self.os_info['ID'])
        self.os_version_label.setText('OS version: ' + self.os_info['RELEASE'])
        self.os_name_label.setGraphicsEffect(dse)
        self.os_codename_label.setText('codename: ' + self.os_info['CODENAME'])
        self.image_label = QtGui.QLabel()
        self.pixmap = QtGui.QPixmap(
            "/usr/lib/resetter/data/icons/resetter-logo.png")
        self.pixmap2 = self.pixmap.scaled(614, 182)
        self.image_label.setPixmap(self.pixmap2)
        self.verticalLayout = QtGui.QVBoxLayout()
        self.verticalLayout2 = QtGui.QVBoxLayout()
        self.verticalLayout2.addWidget(self.os_name_label)
        self.verticalLayout2.addWidget(self.os_version_label)
        self.verticalLayout2.addWidget(self.os_codename_label)
        self.verticalLayout2.setAlignment(QtCore.Qt.AlignRight)
        self.verticalLayout.setAlignment(QtCore.Qt.AlignCenter)
        self.verticalLayout.addWidget(self.image_label)
        self.verticalLayout.addLayout(self.verticalLayout2)
        self.verticalLayout.addWidget(self.btnReset)
        self.verticalLayout.addWidget(self.btnCustomReset)
        self.centralWidget.setLayout(self.verticalLayout)
        self.setCentralWidget(self.centralWidget)
        self.center()
        self.manifest = self.detectOS()
        print self.manifest
Beispiel #24
0
    def __init__(self):
        log.debug("initializing MainWindow")
        super(MainWindow, self).__init__()
        MainWindow.Instance = self
        self.titleBarClicked = False
        self.initialized = False

        # Setup
        self.setWindowFlags(QtCore.Qt.FramelessWindowHint)
        self.setAttribute(QtCore.Qt.WA_TranslucentBackground, True)
        self.ui = ui.Ui_MainWindow()
        self.window_handle = self.ui.setupUi(self)
        self.move(Preferences.windowPos[0], Preferences.windowPos[1])
        self.ui.tabWidget.setCurrentIndex(1)

        # Status bar
        self._addDropShadowToText(self.ui.statusBarCountLabel, "#343434")
        self._addDropShadowToText(self.ui.statusLabel, "#343434")
        self.statusBarLogger = StatusBarLogger(self)

        # Setup drop shadow effect on window
        dropShadowEffect = QtGui.QGraphicsDropShadowEffect(self)
        dropShadowEffect.setBlurRadius(20)
        dropShadowEffect.setColor(QtGui.QColor("#000000"))
        dropShadowEffect.setOffset(0,0)
        self.ui.shadowPadding.setGraphicsEffect(dropShadowEffect)
        self._addDropShadowToText(self.ui.titleLabel, "#343434")

        # The Sampler widget (this allows for selection of the tv sample bounds)
        self.sampler = Sampler(self.ui.samplerTab)
        self.sampler.nodesUpdated.connect(self.on_sampler_nodesUpdated)

        # Color tab
        self.updateColorTabFromSettings()
        self._addDropShadowToText(self.ui.fadeDurationLabel, "#121618")
        self._addDropShadowToText(self.ui.colorHueLabel, "#121618")
        self._addDropShadowToText(self.ui.colorSaturationLabel, "#121618")
        self._addDropShadowToText(self.ui.colorBrightnessLabel, "#121618")
        self._addDropShadowToText(self.ui.camSaturationLabel, "#121618")
        self._addDropShadowToText(self.ui.camBrightnessLabel, "#121618")
        self._addDropShadowToText(self.ui.camContrastLabel, "#121618")
        self._addDropShadowToText(self.ui.camGainLabel, "#121618")

        # Server tab
        ipValidator = QtGui.QRegExpValidator()
        ipValidator.setRegExp(QtCore.QRegExp("((1{0,1}[0-9]{0,2}|2[0-4]{1,1}[0-9]{1,1}|25[0-5]{1,1})\\.){3,3}(1{0,1}[0-9]{0,2}|2[0-4]{1,1}[0-9]{1,1}|25[0-5]{1,1})"))
        self.ui.ipField.setValidator(ipValidator)
        self.ui.ipField.setText(Preferences.serverIp)
        self._addDropShadowToText(self.ui.ipLabel, "#121618")

        portValidator = QtGui.QRegExpValidator()
        portValidator.setRegExp(QtCore.QRegExp("([0-9]{1,4}|[1-5][0-9]{4}|6[0-4][0-9]{3}|65[0-4][0-9]{2}|655[0-2][0-9]|6553[0-5])"))
        self.ui.portField.setValidator(portValidator)
        self.ui.portField.setText(str(Preferences.serverPort))
        self._addDropShadowToText(self.ui.portLabel, "#121618")

        # Server communication
        self.serverComm = ServerCommunication()
        self.serverComm.connectTo(Preferences.serverIp, Preferences.serverPort)
        self.updateLoopTimer = QtCore.QTimer()
        self.updateLoopTimer.setSingleShot(False)
        self.updateLoopTimer.timeout.connect(self.updateLoop)
        self.updateLoopTimer.start(33.33)
        self.frameGrabTimer = QtCore.QTimer()
        self.frameGrabTimer.setSingleShot(False)
        self.frameGrabTimer.timeout.connect(self.requestFrame)
        self.frameGrabTimer.start(2000)
        
        # All done
        self.initialized = True
Beispiel #25
0
 def _addDropShadowToText(self, label, hexCode):
     dropShadowEffect = QtGui.QGraphicsDropShadowEffect(self)
     dropShadowEffect.setBlurRadius(0)
     dropShadowEffect.setColor(QtGui.QColor(hexCode))
     dropShadowEffect.setOffset(0,1)
     label.setGraphicsEffect(dropShadowEffect)
Beispiel #26
0
class NodeGFX(QtGui.QGraphicsItem):
    """Display a node."""

    # --------------------------- INIT ---------------------------------------#
    #
    # Initlize the node
    #   n_x - Where in the graphics scene to position the node. x cord
    #   n_y - Where in the graphics scene to position the node. y cord
    #   n_node - Node object from Canvas. Used in construction of node
    #   n_scene - What is the parent scene of this object
    #
    def __init__(self, n_x, n_y, n_node, n_scene, init=True):
        """INIT."""
        super(NodeGFX, self).__init__()
        # Colection of input and output AttributeGFX Objects
        self.gscene = n_scene
        self.inputs = {}
        self.outputs = {}

        # An identifier for selections
        self.io = "node"

        self.base_node = n_node
        # Use information from the passed in node to build
        # this object.
        self.name = self.base_node.name

        # Check to see if this emiter exists on the node. if so connect it
        try:
            self.base_node.update_visual.connect(self.checkvars)
        except Exception, e:
            print "Not a custom node"
            print str(e)

        # Get the node color for styling
        self.nodeMeta = self.base_node.type

        # Load display settings
        self.settings = self.gscene.settings

        self.disp_set = {}
        if self.nodeMeta not in self.settings.display_settings['NODES'].keys():
            self.disp_set = self.settings.display_settings['NODES']['default']
        else:
            self.disp_set = self.settings.display_settings['NODES'][
                self.nodeMeta]

        # The width of a node
        self.width = self.disp_set['min-width']
        self.height = self.disp_set['min-height']

        # Inputs and outputs
        node_inputs = self.base_node.in_attributes
        node_outputs = self.base_node.out_attributes

        self.setFlag(QtGui.QGraphicsItem.ItemIsMovable, True)

        # ------------------------ Set up Node Title --------------------
        f = self.disp_set['fontcolor']
        self.lable = QtGui.QGraphicsTextItem(self.name, self)
        self.lable.setDefaultTextColor(QtGui.QColor(f[0], f[1], f[2]))

        off = self.disp_set['boarderWidth'] / 2
        self.lable.setPos(off, off)

        # ------------------------ Set up layouts for attrs --------------------
        self.inputslayout = _GraphicsLayout(self.disp_set['attribute_offset'],
                                            self)
        self.inputslayout.translate(0, 35)

        self.outputslayout = _GraphicsLayout(self.disp_set['attribute_offset'],
                                             self)
        self.outputslayout.translate(self.disp_set['min-width'], 35)

        self.checkvars()

        # Bools for drawing options.
        self._over = False
        self._selected = False
        self.setGraphicsEffect(QtGui.QGraphicsDropShadowEffect())
        self.setAcceptHoverEvents(True)
Beispiel #27
0
    def createStackUpSection(self):
        stackup_frame = QtGui.QFrame(self)
        layout = QtGui.QVBoxLayout()
        layout.setContentsMargins(16, 8, 16, 8)

        effect = QtGui.QGraphicsDropShadowEffect(stackup_frame)
        effect.setOffset(0, 0)
        effect.setBlurRadius(2)
        effect.setColor(QtGui.QColor("#333333"))
        stackup_frame.setGraphicsEffect(effect)

        stackup_frame.setProperty("frameType", "sectionFrame")

        top_row_layout = QtGui.QHBoxLayout()
        layer_num_label = QtGui.QLabel("Number of layers")
        layer_combo = CustomComboBox()

        add_material_button = self.createStackupAddMaterialButton(
            "Add Material", "./images/stackup/add.svg")
        edit_button = self.createBorderOnlyStackupButtons(
            "Edit", "./images/stackup/edit.svg")
        delete_button = self.createBorderOnlyStackupButtons(
            "Delete", "./images/stackup/delete.svg")

        top_row_layout.addWidget(layer_num_label, 0, QtCore.Qt.AlignLeft)
        top_row_layout.addWidget(layer_combo, 0, QtCore.Qt.AlignLeft)
        top_row_layout.addWidget(add_material_button, 1, QtCore.Qt.AlignRight)
        top_row_layout.addWidget(edit_button, 0, QtCore.Qt.AlignRight)
        top_row_layout.addWidget(delete_button, 0, QtCore.Qt.AlignRight)
        top_row_layout.setContentsMargins(0, 0, 0, 0)

        bottom_layout = QtGui.QHBoxLayout()
        bottom_layout.setContentsMargins(0, 0, 0, 0)

        left_frame = QtGui.QFrame()
        left_frame.setFixedWidth(250)
        left_frame.setStyleSheet("background-color: black;")

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

        bottom_layout.addWidget(left_frame)

        border_label = QtGui.QLabel("")
        border_label.setFixedHeight(4)
        border_label.setStyleSheet("border: 2px solid #ededed;")

        empty_label = QtGui.QLabel("")
        material_label = QtGui.QLabel("MATERIAL")
        rel_perm_label = QtGui.QLabel("RELATIVE PERMITTIVETY")
        thickness_label = QtGui.QLabel("THICKNESS")
        gp_label = QtGui.QLabel("GROUNDED PLANE")

        material_label.setProperty("labelType", "stackUpDescLabel")
        rel_perm_label.setProperty("labelType", "stackUpDescLabel")
        thickness_label.setProperty("labelType", "stackUpDescLabel")
        gp_label.setProperty("labelType", "stackUpDescLabel")

        label_layout = QtGui.QGridLayout()
        label_layout.addWidget(empty_label, 0, 0, QtCore.Qt.AlignCenter)
        label_layout.addWidget(material_label, 0, 1, QtCore.Qt.AlignCenter)
        label_layout.addWidget(rel_perm_label, 0, 2, QtCore.Qt.AlignCenter)
        label_layout.addWidget(thickness_label, 0, 3, QtCore.Qt.AlignCenter)
        label_layout.addWidget(gp_label, 0, 4, QtCore.Qt.AlignCenter)
        label_layout.setColumnStretch(0, 1)
        label_layout.setColumnStretch(1, 1)
        label_layout.setColumnStretch(2, 1)
        label_layout.setColumnStretch(3, 1)
        label_layout.setColumnStretch(4, 1)

        layout.addLayout(top_row_layout)
        layout.addWidget(border_label)
        right_frame.addLayout(label_layout)

        self.layer_list = []

        for i in range(10):
            layer_frame = QtGui.QFrame(stackup_frame)
            layer_frame_layout = QtGui.QGridLayout(layer_frame)
            layer_frame_layout.setContentsMargins(0, 0, 0, 0)

            layer_label = QtGui.QLabel("Layer " + str(i))
            layer_label.setObjectName("layer_label")
            material = CustomComboBox()
            material.setObjectName("material")
            material.addItem("Material 1")
            material.addItem("Material 2")
            material.addItem("Material 3")
            rel_perm = CustomLineEdit()
            rel_perm.setObjectName("rel_perm")
            thickness = QtGui.QLabel("4")
            thickness.setObjectName("thickness")
            thickness.setAlignment(QtCore.Qt.AlignCenter)
            grounded = QtGui.QCheckBox()
            grounded.setObjectName("grounded")

            layer_frame_layout.setColumnStretch(0, 1)
            layer_frame_layout.setColumnStretch(1, 1)
            layer_frame_layout.setColumnStretch(2, 1)
            layer_frame_layout.setColumnStretch(3, 1)
            layer_frame_layout.setColumnStretch(4, 1)

            layer_frame_layout.addWidget(layer_label, 0, 0)
            layer_frame_layout.addWidget(material, 0, 1)
            layer_frame_layout.addWidget(rel_perm, 0, 2)
            layer_frame_layout.addWidget(thickness, 0, 3)
            layer_frame_layout.addWidget(grounded, 0, 4, QtCore.Qt.AlignCenter)

            layer_frame.setProperty("frameType", "layerRowFrame")
            print(layer_frame.height())
            right_frame.addWidget(layer_frame)

            self.layer_list.append(layer_frame)

        bottom_layout.addLayout(right_frame)
        self.disableLayer(3)
        self.disableLayer(4)
        self.disableLayer(5)
        self.disableLayer(6)
        self.disableLayer(7)
        self.disableLayer(8)
        self.disableLayer(9)
        layout.addLayout(bottom_layout)

        stackup_frame.setLayout(layout)
        return stackup_frame
Beispiel #28
0
    def createTracesSection(self):
        traces_frame = QtGui.QFrame(self)

        traces_layout = QtGui.QHBoxLayout()

        right_frame = QtGui.QFrame()
        right_frame_layout = QtGui.QVBoxLayout()

        right_top_frame = QtGui.QFrame()
        right_top_layout = QtGui.QVBoxLayout()

        optional_label = QtGui.QLabel("Optional")
        optional_label.setProperty("labelType", "tracesDescLabel")

        dieelectric_label = QtGui.QLabel("Dieelectric Constant Er")
        dieelectric_field = CustomLineEdit()

        dieelectric_layout = QtGui.QGridLayout()
        dieelectric_layout.addWidget(dieelectric_label, 0, 0)
        dieelectric_layout.addWidget(dieelectric_field, 0, 0)
        dieelectric_layout.setColumnStretch(0, 2)
        dieelectric_layout.setColumnStretch(1, 1)
        dieelectric_layout.setColumnStretch(2, 1)

        resistance_checkbox = CustomCheckBox()
        resistance_label = QtGui.QLabel("Resistance Computation")

        resistance_layout = QtGui.QGridLayout()
        resistance_layout.addWidget(resistance_checkbox, 0, 0)
        resistance_layout.addWidget(resistance_label, 0, 1)
        resistance_layout.setColumnStretch(0, 1)
        resistance_layout.setColumnStretch(1, 3)

        resistivity_layout = QtGui.QGridLayout()
        resistivity_label = QtGui.QLabel("Resistivity (p)")
        resistivety_field = CustomLineEdit()
        resistivity_unit_label = QtGui.QLabel("W*m")
        resistivity_layout.addWidget(resistivity_label, 0, 0)
        resistivity_layout.addWidget(resistivety_field, 0, 1)
        resistivity_layout.addWidget(resistivity_unit_label, 0, 2)
        resistivity_layout.setColumnStretch(0, 2)
        resistivity_layout.setColumnStretch(1, 2)
        resistivity_layout.setColumnStretch(2, 1)

        left_frame = QtGui.QFrame()
        left_frame.setFixedWidth(250)
        left_frame.setProperty("frameType", "sectionFrame")  #Same styling
        left_frame_layout = QtGui.QVBoxLayout()

        left_top_layout = QtGui.QGridLayout()

        traces_label = QtGui.QLabel("TRACES")
        traces_label.setProperty("labelType", "tracesDescLabel")

        no_of_traces_label = QtGui.QLabel("No of traces")
        no_of_traces_label.setProperty("labelType", "tracesNormalLabel")

        width_label = QtGui.QLabel("Width (W)")
        width_label.setProperty("labelType", "tracesNormalLabel")

        thickness_label = QtGui.QLabel("Thickness (T)")
        thickness_label.setProperty("labelType", "tracesNormalLabel")

        no_of_traces_field = CustomLineEdit()
        width_field = CustomLineEdit()
        thickness_field = CustomLineEdit()

        left_top_layout.addWidget(no_of_traces_label, 0, 0)
        left_top_layout.addWidget(width_label, 1, 0)
        left_top_layout.addWidget(thickness_label, 2, 0)

        left_top_layout.addWidget(no_of_traces_field, 0, 1)
        left_top_layout.addWidget(width_field, 1, 1)
        left_top_layout.addWidget(thickness_field, 2, 1)

        left_top_layout.setColumnStretch(0, 2)
        left_top_layout.setColumnStretch(1, 1)
        left_top_layout.setColumnStretch(2, 1)

        spacing_margins_label = QtGui.QLabel("SPACING & MARGINS")
        spacing_margins_label.setProperty("labelType", "tracesDescLabel")
        spacing_label = QtGui.QLabel("Spacing (S)")
        spacing_label.setProperty("labelType", "tracesNormalLabel")

        margins_label = QtGui.QLabel("Margins")
        margins_label.setProperty("labelType", "tracesNormalLabel")

        spacing_field = CustomLineEdit()

        spacing_layout = QtGui.QGridLayout()
        spacing_layout.addWidget(spacing_label, 0, 0)
        spacing_layout.addWidget(spacing_field, 0, 1)

        spacing_layout.setColumnStretch(0, 2)
        spacing_layout.setColumnStretch(1, 1)
        spacing_layout.setColumnStretch(2, 1)

        margins_layout = QtGui.QGridLayout()
        margins_layout.setAlignment(QtCore.Qt.AlignCenter)

        x1_label = QtGui.QLabel("X1")
        x2_label = QtGui.QLabel("X2")
        y1_label = QtGui.QLabel("Y1")
        y2_label = QtGui.QLabel("Y2")

        x1_label.setAlignment(QtCore.Qt.AlignCenter)
        x2_label.setAlignment(QtCore.Qt.AlignCenter)
        y1_label.setAlignment(QtCore.Qt.AlignCenter)
        y2_label.setAlignment(QtCore.Qt.AlignCenter)

        x1_field = CustomLineEdit()
        x2_field = CustomLineEdit()
        y1_field = CustomLineEdit()
        y2_field = CustomLineEdit()

        margins_layout.addWidget(x1_label, 0, 0)
        margins_layout.addWidget(x2_label, 1, 0)
        margins_layout.addWidget(y1_label, 2, 0)
        margins_layout.addWidget(y2_label, 3, 0)

        margins_layout.addWidget(x1_field, 0, 1)
        margins_layout.addWidget(x2_field, 1, 1)
        margins_layout.addWidget(y1_field, 2, 1)
        margins_layout.addWidget(y2_field, 3, 1)

        margins_layout.setColumnStretch(0, 2)
        margins_layout.setColumnStretch(1, 1)
        margins_layout.setColumnStretch(2, 1)

        effect = QtGui.QGraphicsDropShadowEffect(traces_frame)
        effect.setOffset(0, 0)
        effect.setBlurRadius(2)
        effect.setColor(QtGui.QColor("#333333"))
        left_frame.setGraphicsEffect(effect)

        #   right_top_layout.addWidget(optional_label)
        #    right_top_layout.addLayout(dieelectric_layout)
        #     right_top_layout.addLayout(resistance_layout)
        #      right_top_layout.addLayout(resistivity_layout)
        #       right_top_frame.setLayout(right_frame_layout)

        #        right_frame_layout.addWidget(right_top_frame)

        #right_frame.setLayout(right_frame_layout)

        left_frame_layout.addWidget(traces_label)
        left_frame_layout.addLayout(left_top_layout)
        left_frame_layout.addWidget(spacing_margins_label)
        left_frame_layout.addLayout(spacing_layout)
        left_frame_layout.addWidget(margins_label)
        left_frame_layout.addLayout(margins_layout)
        left_frame.setLayout(left_frame_layout)

        traces_layout.addWidget(left_frame)
        traces_layout.addWidget(right_frame)
        traces_frame.setLayout(traces_layout)
        traces_frame.setGraphicsEffect(effect)

        return traces_frame
Beispiel #29
0
    def __init__(self, useData, parent):
        QtGui.QLabel.__init__(self)

        self.pcode = parent
        self.useData = useData

        mainLayout = QtGui.QHBoxLayout()
        mainLayout.setMargin(0)
        self.setScaledContents(True)
        self.setObjectName("mainlabel")
        self.setLayout(mainLayout)

        mainLayout.addStretch(1)

        vbox = QtGui.QVBoxLayout()
        mainLayout.addLayout(vbox)

        vbox.addStretch(1)

        centerLabel = QtGui.QLabel()
        centerLabel.setObjectName("centerlabel")
        centerLabel.setMinimumWidth(500)
        centerLabel.setMinimumHeight(300)
        centerLabel.setScaledContents(True)
        centerLabel.setStyleSheet("""
                            QListView {
                                 show-decoration-selected: 1; /* make the selection span the entire width of the view */
                                 border: none;
                            }

                            QListView::item {
                                 min-height: 20px;
                            }

                            QListView::item:hover {
                                 border: none;
                                 background: #E3E3E3;
                            }

                            QListView::item:selected:!active {
                                 border: 1px solid white;
                                 background: #E3E3E3;
                            }

                            QListView::item:selected:active {
                                 color: white;
                                 background: #3F3F3F;
                            }""")
        vbox.addWidget(centerLabel)

        vbox.addStretch(2)

        shadowEffect = QtGui.QGraphicsDropShadowEffect()
        shadowEffect.setColor(QtGui.QColor("#000000"))
        shadowEffect.setXOffset(0)
        shadowEffect.setYOffset(0)
        shadowEffect.setBlurRadius(20)
        centerLabel.setGraphicsEffect(shadowEffect)

        centralLayout = QtGui.QVBoxLayout()
        centerLabel.setLayout(centralLayout)

        hbox = QtGui.QHBoxLayout()
        centralLayout.addLayout(hbox)

        label = QtGui.QLabel("Getting started...")
        label.setFont(QtGui.QFont("Consolas", 20))
        hbox.addWidget(label)

        hbox.addStretch(1)

        label = QtGui.QLabel()
        label.setScaledContents(True)
        label.setMaximumWidth(35)
        label.setMinimumWidth(35)
        label.setMaximumHeight(35)
        label.setMinimumHeight(35)
        label.setPixmap(
            QtGui.QPixmap(os.path.join("Resources", "images", "compass")))
        hbox.addWidget(label)

        frame = QtGui.QFrame()
        frame.setGeometry(1, 1, 1, 1)
        frame.setFrameShape(frame.HLine)
        frame.setFrameShadow(frame.Plain)
        centralLayout.addWidget(frame)

        label = QtGui.QLabel(
            "For the sake of convenience, most tasks are handled in the "
            "context of a project. Start editing your files by first "
            "creating a project or opening an existing one.")
        label.setWordWrap(True)
        label.setFont(QtGui.QFont("Consolas", 10))
        centralLayout.addWidget(label)

        centralLayout.addStretch(1)

        label = QtGui.QLabel("Recent Projects:")
        label.setStyleSheet("color: #0063A6; font: 12px;")
        centralLayout.addWidget(label)

        self.recentProjectsListWidget = QtGui.QListWidget()
        for i in useData.OPENED_PROJECTS:
            self.recentProjectsListWidget.addItem(QtGui.QListWidgetItem(i))
        self.recentProjectsListWidget.itemDoubleClicked.connect(
            self.openProjectFromList)
        centralLayout.addWidget(self.recentProjectsListWidget)

        frame = QtGui.QFrame()
        frame.setGeometry(1, 1, 1, 1)
        frame.setFrameShape(frame.HLine)
        frame.setFrameShadow(frame.Plain)
        centralLayout.addWidget(frame)

        hbox = QtGui.QHBoxLayout()
        centralLayout.addLayout(hbox)

        openButton = QtGui.QPushButton("Open Project")
        openButton.setIcon(
            QtGui.QIcon(os.path.join("Resources", "images", "wooden-box")))
        openButton.clicked.connect(self.openProject)
        hbox.addWidget(openButton)

        newButton = QtGui.QPushButton("New Project")
        newButton.setIcon(
            QtGui.QIcon(os.path.join("Resources", "images", "inbox--plus")))
        newButton.clicked.connect(self.createProject)
        hbox.addWidget(newButton)

        hbox.addStretch(1)

        homePageButton = QtGui.QPushButton("Visit Homepage")
        homePageButton.setIcon(
            QtGui.QIcon(os.path.join("Resources", "images", "Web")))
        homePageButton.clicked.connect(self.visitHomepage)
        hbox.addWidget(homePageButton)

        mainLayout.addStretch(1)

        style = """
            QLabel#mainlabel {background: #565656;
                    }

            QLabel#centerlabel {border-radius: 2px;
                background: #FFFFFF;
                     }

            QPushButton {min-width: 105;}
            """

        self.setStyleSheet(style)
Beispiel #30
0
def add_shadow():
    shadow = qtw.QGraphicsDropShadowEffect()
    shadow.setBlurRadius(20)
    shadow.setColor(QtCore.Qt.lightGray)
    return shadow