def __init__(self, parent=None):
     QPushButton.__init__(self, parent)
     self.key = None
     self.parent = parent
     self.input = None
     self.joystick = None
     self.setFocusPolicy(Qt.ClickFocus)
Пример #2
0
 def __init__(self, text, styleType, subDialog, resettableValue ):
   '''
   Text may be blank char. 
   In subclasses: 
   Could be 'Color', but <style> being set may be only the background color.
   Then the text could disappear into the background.
   Could be 'Text', and <style> being set is font.
   '''
   QPushButton.__init__(self, config.i18ns.styleTranslate(text))  # Must be init before Resettable
   Resettable.__init__(self, resettableValue)
   
   '''
   type of styleType may actually be pyqtWrapperType, although conceptually it is QFont or QColor
   assert isinstance(styleType, QFont), str(type(styleType))
   '''
   self.styleType = styleType  # <style> being controlled e.g. QColor
   '''
   subDialog is typically static method of some framework dialog class, e.g. QFontDialog
   Or a method that adapts a framework dialog, e.g. QColorDialog, which returns a QColor that not isValid() if canceled.
   It must have API:
   -callable with parameter 'initialValue'
   -return a tuple: (ok, value of <style>) 
   '''
   self.subDialog = subDialog  
   
   self._value = None  # !!! no default value.  !!! See below, this is the Widget's value
   
   self.setAutoFillBackground(True)   # Ensure widget background color change effective ??
   self.clicked.connect(self.handleClicked) # Any other handlers for Signal clicked will also be called.
Пример #3
0
 def __init__(self,parent, text=''):
     QPushButton.__init__(self, parent)
     self.text=text
     self.backgroundColor = QPalette().light().color()
     self.backgroundColor.setRgb(157,157,157) #(220,203,231)
     #self.backgroundColor.setAlpha(0)
     self.brush=QBrush(Qt.SolidPattern)
Пример #4
0
    def __init__(self,parent,wide,high,ppath=None):
        QPushButton.__init__(self,parent)

        self.parent=parent
        self.wide=wide
        self.high=high
        self.resize(self.wide,self.high)
        self.xdis=self.wide/10

        #self.setAttribute(Qt.WA_TranslucentBackground, True)
        self.backgroundColor = QPalette().light().color()
        self.backgroundColor.setRgb(157,157,157) #(220,203,231)
        #self.backgroundColor.setAlpha(100)
        self.brush=QBrush(Qt.SolidPattern)

        if ppath :
            self.path=ppath
        else :
            self.path=QPainterPath()

            self.path.moveTo(self.wide/2, self.high/2-self.xdis)
            self.path.arcTo(0,0, self.wide-2*self.xdis, self.high-2*self.xdis,45,90)
            self.path.closeSubpath()

            self.path.moveTo(self.wide/2-self.xdis, self.high/2)
            self.path.arcTo(0,0,self.wide-2*self.xdis,self.high-2*self.xdis,135,90)
            self.path.closeSubpath()

            self.path.moveTo(self.wide/2, self.high/2+self.xdis)
            self.path.arcTo(0,0,self.wide-2*self.xdis, self.high-2*self.xdis,225,90)
            self.path.closeSubpath()

            self.path.moveTo(self.wide/2+self.xdis, self.high/2)
            self.path.arcTo(0,0,self.wide-2*self.xdis, self.high-2*self.xdis,315,90)
            self.path.closeSubpath()
Пример #5
0
 def __init__(self, parent, color=None):
     QPushButton.__init__(self, parent)
     self.parent = parent
     self.setColor(color)
     self.clicked.connect(self.onClick)
     self.setMinimumSize(QSize(25, 25))
     self.setMaximumSize(QSize(25, 25))
 def __init__(self, graph):
     QPushButton.__init__(self)
     self.graph = graph
     self.setIcon(self.plotWindow.mainwindow.icon_vcursor)
     self.setCheckable(True)
     self.clicked.connect(self.cursorOn)
     self.setStyleSheet("border: 0px")
     self.vLines = {}
Пример #7
0
 def __init__(self, parent, currentnode, startnode):
     text = "Null"
     try:
         text = currentnode.get_browse_name().to_string()
     except ua.UaError:
         pass
     QPushButton.__init__(self, text, parent)
     self._current_node = currentnode
     self.start_node = startnode
     self.clicked.connect(self.get_new_node)
Пример #8
0
    def __init__(self,parent,path=None):
        QPushButton.__init__(self,parent)

        self.parent=parent


        #self.setAttribute(Qt.WA_TranslucentBackground, True)
        self.backgroundColor = QPalette().light().color()
        self.backgroundColor.setRgb(157,157,157) #(220,203,231)
        #self.backgroundColor.setAlpha(100)
        self.brush=QBrush(Qt.SolidPattern)
Пример #9
0
 def __init__(self, toolBar, view, model):
     QPushButton.__init__(self, QIcon(':enkiicons/button-ok.png'), "Unc&heck all", toolBar)
     self._action = toolBar.insertWidget(toolBar.actions()[0], self)
     self.setMinimumWidth(QFontMetrics(self.font()).width("Uncheck all)") + 36)
     self.setStyleSheet("padding: 0")
     self.setFlat(True)
     self._view = view
     self._model = model
     self.clicked.connect(self._onTriggered)
     self._model.dataChanged.connect(self._update)
     self._model.rowsInserted.connect(self._update)
     self._model.rowsRemoved.connect(self._update)
     self._update()
Пример #10
0
    def __init__(self, parent):
        QPushButton.__init__(self, parent)

        self.fPixmap     = QPixmap()
        self.fPixmapRect = QRectF(0, 0, 0, 0)

        self.setCheckable(True)
        self.setText("")

        self.fLastColor = self.OFF
        self.fPixmap.load(":/bitmaps/led_off.png")

        self.setColor(self.BLUE)
Пример #11
0
 def __init__(self, item, clearMouseOver, parent = None):
    QPushButton.__init__(self, parent)
    self.item = item
    self.clearMouseOver = clearMouseOver
    self.mouseOver = False
    self.setText(item.name)
    self.setIcon(ListItem.iconCache[item.icon])
    self.setIconSize(QSize(24, 24))
    self.setSizePolicy(QSizePolicy.Ignored, QSizePolicy.Preferred)
    self.setMaximumHeight(75)
    self.setMinimumHeight(35)
    self.setFont(QFont(self.font().family(), 12))
    self.setStyleSheet('text-align: left')
    self.setToolTip(item.name)
Пример #12
0
 def __init__(self, toolBar, view, model):
     QPushButton.__init__(self, QIcon(':enkiicons/scope.png'), "Ex&pand all", toolBar)
     self._action = toolBar.insertWidget(toolBar.actions()[0], self)
     self.setMinimumWidth(QFontMetrics(self.font()).width("Colla&pse all)") + 36)
     self.setStyleSheet("padding: 0")
     self.setFlat(True)
     self._view = view
     self._model = model
     self.clicked.connect(self._onTriggered)
     self._view.expanded.connect(self._update)
     self._view.collapsed.connect(self._update)
     self._model.rowsInserted.connect(self._update)
     self._model.rowsRemoved.connect(self._update)
     self._update()
Пример #13
0
    def __init__(self, parent):
        QPushButton.__init__(self, parent)

        self.fPixmapNormal = QPixmap()
        self.fPixmapDown   = QPixmap()
        self.fPixmapHover  = QPixmap()
        self.fPixmapRect   = QRectF(0, 0, 0, 0)

        self.fIsHovered = False

        self.fTopText      = ""
        self.fTopTextColor = QColor()
        self.fTopTextFont  = QFont()

        self.setText("")
Пример #14
0
    def __init__(self,parent, default_wide, default_high,text=''):
        QPushButton.__init__(self, parent)
        #self.resize(100,80)
        self.default_high=default_high
        self.default_wide=default_wide
        self.xrd=self.default_wide/10
        #self.yrd=self.default_high/10
        self.yrd=self.xrd
        #self.resize(self.default_wide,self.default_high)

        self.backgroundColor = QPalette().light().color()
        self.backgroundColor.setRgb(157,157,157) #(220,203,231)
        #self.backgroundColor.setAlpha(0)
        self.brush=QBrush(Qt.SolidPattern)

        self.textlabel=textQLabel(self,text)
Пример #15
0
 def __init__(self, parent=None, icon=None):
     """
     Initialize a IconButton object.
     :param parent: the widget this QButton is connected to :type QObject:
     :param icon: the icon to be displayed in the button :type QIcon:
     """
     QPushButton.__init__(self, parent)
     self.setContentsMargins(0, 0, 0, 0)
     self.setFixedSize(32, 32)
     self.setIconSize(QSize(32, 32))
     self.setIcon(icon)
     self.setStyleSheet("""
     QPushButton {
         border: 0;
     }
     """)
    def __init__(self, module):
        QPushButton.__init__(self)
        self.module = module
        self.setParent(module)
        eyeOn = QPixmap()
        eyeOff = QPixmap()

        eyeOn.load('%s/%s' % (module.mainWindow.imgPath, 'eye_on.png'))
        eyeOff.load('%s/%s' % (module.mainWindow.imgPath, 'eye_off.png'))
        self.iconEyeOn = QIcon(eyeOn)
        self.iconEyeOff = QIcon(eyeOff)

        self.mainWindow = module.mainWindow
        self.setFixedSize(30, 20)
        self.clicked.connect(self.showGB)
        self.setCheckable(True)
        self.showGB()
Пример #17
0
    def __init__(self,parent,wide,high,path=None):
        QPushButton.__init__(self,parent)

        self.parent=parent
        self.wide=wide
        self.high=high
        self.xdis=self.wide/7
        self.ydis=self.xdis

        #self.setAttribute(Qt.WA_TranslucentBackground, True)
        self.backgroundColor = QPalette().light().color()
        self.backgroundColor.setRgb(157,157,157) #(220,203,231)
        #self.backgroundColor.setAlpha(100)
        self.brush=QBrush(Qt.SolidPattern)

        if path :
            self.path=path
        else :
            self.path=QPainterPath()
            self.path.setFillRule(Qt.OddEvenFill)

            self.path.moveTo(self.wide/2, self.high/2-self.xdis)
            self.path.arcTo(0,0, self.wide, self.high,0,360)
            #self.path.closeSubpath()

            self.path.moveTo(self.wide/2-self.xdis/2, self.ydis)
            self.path.lineTo(self.wide/2-self.xdis/2, self.high/2-self.xdis/2)
            self.path.lineTo(self.ydis, self.high/2-self.xdis/2)
            self.path.lineTo(self.ydis, self.high/2+self.xdis/2)
            self.path.lineTo(self.wide/2-self.xdis/2, self.high/2+self.xdis/2)
            self.path.lineTo(self.wide/2-self.xdis/2, self.high-self.ydis)
            self.path.lineTo(self.wide/2+self.xdis/2, self.high-self.ydis)
            self.path.lineTo(self.wide/2+self.xdis/2, self.high/2+self.xdis/2)
            self.path.lineTo(self.wide-self.ydis, self.high/2+self.xdis/2)
            self.path.lineTo(self.wide-self.ydis, self.high/2-self.xdis/2)
            self.path.lineTo(self.wide/2+self.xdis/2, self.high/2-self.xdis/2)
            self.path.lineTo(self.wide/2+self.xdis/2, self.ydis)
            self.path.closeSubpath()
Пример #18
0
    def __init__(self, parent, color=None, on_color_change=None, name='Color', verify_colors=False):
        """

        Args:
            parent: a parent Qt instance
            color: the color name or hexadecimal code (in form of a string)
            on_color_change: a function or method taking old color and a new one
            verify_colors: should the parent be asked if the color is acceptable?
                to verify a color parent.is_acceptable(color) will be invoked
        """
        QPushButton.__init__(self, color, parent)
        self.verify_colors = verify_colors
        self.parent = parent
        self.color = color
        self.name = name
        self.callback = on_color_change

        if color:
            self.set_color(color)
        else:
            self.setText(_('(Not specified)'))

        self.clicked.connect(self.pick_color)
Пример #19
0
 def __init__(self, parent=None, text='', shortcut=''):
     """
     Initialize a Button object.
     :param parent: the widget this QPushButton is connected to :type QObject:
     :param text: the text to be displayed in the button :type str:
     :param shortcut: the keyboard sequence to be used as button shortcut :type str:
     """
     QPushButton.__init__(self, text, parent)
     self.setContentsMargins(0, 0, 0, 0)
     self.setFixedSize(70, 40)
     self.setShortcut(shortcut)
     self.setStyleSheet("""
     QPushButton {
         background: #B7B7B7;
         border: 0;
         color: #484848;
         min-width: 70px;
         min-height: 40px;
         outline: none;
     }
     QPushButton:hover {
         background: #C2C2C2;
     }
     """)
Пример #20
0
 def __init__(self, text_getter, app):
     QPushButton.__init__(self, _("Copy"))
     self.clicked.connect(lambda: app.clipboard().setText(text_getter()))
Пример #21
0
 def __init__(self, dialog, label=None):
     QPushButton.__init__(self, label or _("OK"))
     self.clicked.connect(dialog.accept)
     self.setDefault(True)
Пример #22
0
 def __init__(self, parent, currentnode, startnode):
     text = currentnode.get_browse_name().to_string()
     QPushButton.__init__(self, text, parent)
     self.current_node = currentnode
     self.start_node = startnode
     self.clicked.connect(self.get_new_node)
Пример #23
0
 def __init__(self, parent):
     QPushButton.__init__(self, parent)
Пример #24
0
 def __init__(self, text_getter, app, dialog):
     QPushButton.__init__(self, _("Copy and Close"))
     self.clicked.connect(lambda: app.clipboard().setText(text_getter()))
     self.clicked.connect(dialog.close)
     self.setDefault(True)
Пример #25
0
 def __init__(self):
     QPushButton.__init__(self, qtawesome.icon('fa.pause', color='red'), "")
     self.flag = True
Пример #26
0
 def __init__(self, parent=None):
     QPushButton.__init__(self, parent)
     self.setFixedSize(20, 20)
     self.setIconSize(QSize(12, 12))
     self.clicked.connect(self.choose_color)
     self._color = QColor()
Пример #27
0
 def __init__(self, dialog):
     QPushButton.__init__(self, _("Close"))
     self.clicked.connect(dialog.close)
     self.setDefault(True)
Пример #28
0
 def __init__(self, music_name, music_address):
     QPushButton.__init__(self, '播放')
     self.music_address = music_address
     self.music_name = music_name
Пример #29
0
 def __init__(self, text):
     QPushButton.__init__(self, text)
     self._obj = PFSTableObject()
     self.edited = self._obj.edited
 def __init__(self):
     QPushButton.__init__(self, "Relesed")
     self.setFixedSize(100, 100)
     self.setStyleSheet("background-color: red")
 def __init__(self):
     QPushButton.__init__(self)
     self.init_widget()
Пример #32
0
 def __init__(self, *args, board):
     QPushButton.__init__(self, *args)
     self.board = board
Пример #33
0
	def __init__(self, parent, fileName):
		QPushButton.__init__(self, parent)
		self.fileName = fileName
		self.defaultText = self.tr('(none)')
		self.updateButtonText()
		self.clicked.connect(self.processClick)
Пример #34
0
 def __init__(self, text='', icon=QIcon(), parent=None):
     QPushButton.__init__(self, icon, text, parent)
Пример #35
0
 def __init__(self, text):
     QPushButton.__init__(self, 'Info')
     self.help_text = text
     self.setFocusPolicy(Qt.NoFocus)
     self.setFixedWidth(6 * char_width_in_lineedit())
     self.clicked.connect(self.onclick)
Пример #36
0
 def __init__(self, *args, **kw):
     QPushButton.__init__(self, *args, **kw)
     self.last_mouse_pos = None
     self.clicked.connect(self.u)
Пример #37
0
 def __init__(self, text_getter, app):
     QPushButton.__init__(self, _("Copy"))
     self.clicked.connect(lambda: app.clipboard().setText(text_getter()))
Пример #38
0
 def __init__(self, music_name):
     QPushButton.__init__(self, '取关')
     self.music_name = music_name
Пример #39
0
 def __init__(self, *args, **kwargs):
     QPushButton.__init__(self, *args, **kwargs)
     self.timer = QTimer()
     self.timer.setSingleShot(True)
     self.timer.timeout.connect(self.clicked.emit)
     super().clicked.connect(self.checkDoubleClick)
Пример #40
0
 def __init__(self, text, func):
     QPushButton.__init__(self, text)
     self.func = func
     self.clicked.connect(func)
 def __init__(self):
     QPushButton.__init__(self)
     self.setText("Click to raise error")
     self.clicked.connect(self.error)
Пример #42
0
 def __init__(self, name):
     QPushButton.__init__(self)
     self.name = name
     self.initUI()
Пример #43
0
	def __init__(self, *args, **kwargs):
		QPushButton.__init__(self, *args, **kwargs)
		self.edit = None
Пример #44
0
 def __init__(self, parent=None):
     QPushButton.__init__(self, parent)
     self.setFixedSize(20, 20)
     self.setIconSize(QSize(12, 12))
     self.clicked.connect(self.choose_color)
     self._color = QColor()
Пример #45
0
 def __init__(self, dialog):
     QPushButton.__init__(self, _("Close"))
     self.clicked.connect(dialog.close)
     self.setDefault(True)
Пример #46
0
 def __init__(self, text=None):
     QPushButton.__init__(self, text)
Пример #47
0
 def __init__(self, text_getter, app, dialog):
     QPushButton.__init__(self, _("Copy and Close"))
     self.clicked.connect(lambda: app.clipboard().setText(text_getter()))
     self.clicked.connect(dialog.close)
     self.setDefault(True)
 def __init__(self, title):
     QPushButton.__init__(self, title)
     self.setAcceptDrops(True)
Пример #49
0
 def __init__(self, dialog, label=None):
     QPushButton.__init__(self, label or _("Cancel"))
     self.clicked.connect(dialog.reject)
Пример #50
0
    def __init__(self, state=False):
        """Constructor."""

        QPushButton.__init__(self)

        self.__init_UI(state)
Пример #51
0
 def __init__(self, text, task, on_success=None, on_error=None):
     QPushButton.__init__(self, text)
     self.task = task
     self.on_success = on_success
     self.on_error = on_error
     self.clicked.connect(self.run_task)
Пример #52
0
 def __init__(self, dialog, label=None):
     QPushButton.__init__(self, label or _("Cancel"))
     self.clicked.connect(dialog.reject)
Пример #53
0
 def __init__(self, text, func):
     QPushButton.__init__(self, text)
     self.func = func
     self.clicked.connect(func)
Пример #54
0
 def __init__(self, text, task, on_success=None, on_error=None):
     QPushButton.__init__(self, text)
     self.task = task
     self.on_success = on_success
     self.on_error = on_error
     self.clicked.connect(self.run_task)
Пример #55
0
	def __init__(self, parent, fileName):
		QPushButton.__init__(self, parent)
		self.fileName = fileName
		self.defaultText = self.tr('(none)')
		self.updateButtonText()
		self.clicked.connect(self.processClick)
Пример #56
0
 def __init__(self, text=None):
     QPushButton.__init__(self, text)
Пример #57
0
 def __init__(self, text):
     QPushButton.__init__(self, '?')
     self.help_text = text
     self.setFocusPolicy(Qt.NoFocus)
     self.setFixedWidth(20)
     self.clicked.connect(self.onclick)
Пример #58
0
 def __init__(self, title):
     QPushButton.__init__(self, title)
     self.setFixedSize(130, 80)
Пример #59
0
 def __init__(self, parent=None):
     QPushButton.__init__(self, parent)
     self.setMenu(self.__richflag())
     # flag
     self.setIcon(QIcon(getPath("iconDir", "yeahdoc/flag/default.png")))
     self.setText("default.png")
Пример #60
0
 def __init__(self, dialog, label=None):
     QPushButton.__init__(self, label or _("OK"))
     self.clicked.connect(dialog.accept)
     self.setDefault(True)