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)
Ejemplo n.º 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.
Ejemplo n.º 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)
Ejemplo n.º 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()
Ejemplo n.º 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 = {}
Ejemplo n.º 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)
Ejemplo n.º 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)
Ejemplo n.º 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()
Ejemplo n.º 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)
Ejemplo n.º 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)
Ejemplo n.º 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()
Ejemplo n.º 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("")
Ejemplo n.º 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)
Ejemplo n.º 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()
Ejemplo n.º 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()
Ejemplo n.º 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)
Ejemplo n.º 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;
     }
     """)
Ejemplo n.º 20
0
 def __init__(self, text_getter, app):
     QPushButton.__init__(self, _("Copy"))
     self.clicked.connect(lambda: app.clipboard().setText(text_getter()))
Ejemplo n.º 21
0
 def __init__(self, dialog, label=None):
     QPushButton.__init__(self, label or _("OK"))
     self.clicked.connect(dialog.accept)
     self.setDefault(True)
Ejemplo n.º 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)
Ejemplo n.º 23
0
 def __init__(self, parent):
     QPushButton.__init__(self, parent)
Ejemplo n.º 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)
Ejemplo n.º 25
0
 def __init__(self):
     QPushButton.__init__(self, qtawesome.icon('fa.pause', color='red'), "")
     self.flag = True
Ejemplo n.º 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()
Ejemplo n.º 27
0
 def __init__(self, dialog):
     QPushButton.__init__(self, _("Close"))
     self.clicked.connect(dialog.close)
     self.setDefault(True)
Ejemplo n.º 28
0
 def __init__(self, music_name, music_address):
     QPushButton.__init__(self, '播放')
     self.music_address = music_address
     self.music_name = music_name
Ejemplo n.º 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()
Ejemplo n.º 32
0
 def __init__(self, *args, board):
     QPushButton.__init__(self, *args)
     self.board = board
Ejemplo n.º 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)
Ejemplo n.º 34
0
 def __init__(self, text='', icon=QIcon(), parent=None):
     QPushButton.__init__(self, icon, text, parent)
Ejemplo n.º 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)
Ejemplo n.º 36
0
 def __init__(self, *args, **kw):
     QPushButton.__init__(self, *args, **kw)
     self.last_mouse_pos = None
     self.clicked.connect(self.u)
Ejemplo n.º 37
0
 def __init__(self, text_getter, app):
     QPushButton.__init__(self, _("Copy"))
     self.clicked.connect(lambda: app.clipboard().setText(text_getter()))
Ejemplo n.º 38
0
 def __init__(self, music_name):
     QPushButton.__init__(self, '取关')
     self.music_name = music_name
Ejemplo n.º 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)
Ejemplo n.º 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)
Ejemplo n.º 42
0
 def __init__(self, name):
     QPushButton.__init__(self)
     self.name = name
     self.initUI()
Ejemplo n.º 43
0
	def __init__(self, *args, **kwargs):
		QPushButton.__init__(self, *args, **kwargs)
		self.edit = None
Ejemplo n.º 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()
Ejemplo n.º 45
0
 def __init__(self, dialog):
     QPushButton.__init__(self, _("Close"))
     self.clicked.connect(dialog.close)
     self.setDefault(True)
Ejemplo n.º 46
0
 def __init__(self, text=None):
     QPushButton.__init__(self, text)
Ejemplo n.º 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)
Ejemplo n.º 49
0
 def __init__(self, dialog, label=None):
     QPushButton.__init__(self, label or _("Cancel"))
     self.clicked.connect(dialog.reject)
Ejemplo n.º 50
0
    def __init__(self, state=False):
        """Constructor."""

        QPushButton.__init__(self)

        self.__init_UI(state)
Ejemplo n.º 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)
Ejemplo n.º 52
0
 def __init__(self, dialog, label=None):
     QPushButton.__init__(self, label or _("Cancel"))
     self.clicked.connect(dialog.reject)
Ejemplo n.º 53
0
 def __init__(self, text, func):
     QPushButton.__init__(self, text)
     self.func = func
     self.clicked.connect(func)
Ejemplo n.º 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)
Ejemplo n.º 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)
Ejemplo n.º 56
0
 def __init__(self, text=None):
     QPushButton.__init__(self, text)
Ejemplo n.º 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)
Ejemplo n.º 58
0
 def __init__(self, title):
     QPushButton.__init__(self, title)
     self.setFixedSize(130, 80)
Ejemplo n.º 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")
Ejemplo n.º 60
0
 def __init__(self, dialog, label=None):
     QPushButton.__init__(self, label or _("OK"))
     self.clicked.connect(dialog.accept)
     self.setDefault(True)