示例#1
0
文件: diff.py 项目: Hainish/calibre
 def __init__(self, field, is_new, parent, metadata, extra):
     QLineEdit.__init__(self, parent)
     self.is_new = is_new
     self.field = field
     self.metadata = metadata
     if not is_new:
         self.setReadOnly(True)
     self.textChanged.connect(self.changed)
示例#2
0
文件: diff.py 项目: sss/calibre
 def __init__(self, field, is_new, parent, metadata, extra):
     QLineEdit.__init__(self, parent)
     self.is_new = is_new
     self.field = field
     self.metadata = metadata
     if not is_new:
         self.setReadOnly(True)
     self.textChanged.connect(self.changed)
示例#3
0
文件: main.py 项目: kmshi/calibre
 def __init__(self, *args):
     QLineEdit.__init__(self, *args)
     self.setValidator(QRegExpValidator(QRegExp(r'\d+\.\d+'), self))
     self.setToolTip(textwrap.fill('<p>'+_(
         'Go to a reference. To get reference numbers, use the <i>reference '
         'mode</i>, by clicking the reference mode button in the toolbar.')))
     if hasattr(self, 'setPlaceholderText'):
         self.setPlaceholderText(_('Go to...'))
     self.editingFinished.connect(self.editing_finished)
示例#4
0
    def __init__(self, parent=None, completer_widget=None):
        QLineEdit.__init__(self, parent)

        self.sep = ','
        self.space_before_sep = False
        self.add_separator = True
        self.original_cursor_pos = None
        completer_widget = (self
                            if completer_widget is None else completer_widget)

        self.mcompleter = Completer(completer_widget)
        self.mcompleter.item_selected.connect(self.completion_selected,
                                              type=Qt.QueuedConnection)
        self.mcompleter.relayout_needed.connect(self.relayout)
        self.mcompleter.setFocusProxy(completer_widget)
        self.textEdited.connect(self.text_edited)
        self.no_popup = False
示例#5
0
    def __init__(self, parent=None, completer_widget=None):
        QLineEdit.__init__(self, parent)

        self.sep = ','
        self.space_before_sep = False
        self.add_separator = True
        self.original_cursor_pos = None
        completer_widget = (self if completer_widget is None else
                completer_widget)

        self.mcompleter = Completer(completer_widget)
        self.mcompleter.item_selected.connect(self.completion_selected,
                type=Qt.QueuedConnection)
        self.mcompleter.relayout_needed.connect(self.relayout)
        self.mcompleter.setFocusProxy(completer_widget)
        self.textEdited.connect(self.text_edited)
        self.no_popup = False
示例#6
0
文件: complete.py 项目: sss/calibre
    def __init__(self, parent=None, completer_widget=None):
        QLineEdit.__init__(self, parent)

        self.sep = ','
        self.space_before_sep = False
        self.add_separator = True
        self.original_cursor_pos = None

        self._model = CompleteModel(parent=self)
        self._completer = c = QCompleter(self._model, self)
        c.setWidget(self if completer_widget is None else completer_widget)
        c.setCompletionMode(QCompleter.PopupCompletion)
        c.setCaseSensitivity(Qt.CaseInsensitive)
        c.setModelSorting(self._model.sorting)
        c.setCompletionRole(Qt.DisplayRole)
        p = c.popup()
        p.setMouseTracking(True)
        p.entered.connect(self.item_entered)
        c.popup().setAlternatingRowColors(True)

        c.activated.connect(self.completion_selected, type=Qt.QueuedConnection)
        self.textEdited.connect(self.text_edited)
示例#7
0
文件: complete.py 项目: Eksmo/calibre
    def __init__(self, parent=None, completer_widget=None):
        QLineEdit.__init__(self, parent)

        self.sep = ','
        self.space_before_sep = False
        self.add_separator = True
        self.original_cursor_pos = None

        self._model = CompleteModel(parent=self)
        self._completer = c = QCompleter(self._model, self)
        c.setWidget(self if completer_widget is None else completer_widget)
        c.setCompletionMode(QCompleter.PopupCompletion)
        c.setCaseSensitivity(Qt.CaseInsensitive)
        c.setModelSorting(self._model.sorting)
        c.setCompletionRole(Qt.DisplayRole)
        p = c.popup()
        p.setMouseTracking(True)
        p.entered.connect(self.item_entered)
        c.popup().setAlternatingRowColors(True)

        c.activated.connect(self.completion_selected,
                type=Qt.QueuedConnection)
        self.textEdited.connect(self.text_edited)
示例#8
0
 def __init__(self, text, parent):
     if text is None:
         text = ''
     QLineEdit.__init__(self, text, parent)
     self.setEnabled(False)
示例#9
0
	def __init__(self, *args):
		QLineEdit.__init__(self, *args)
 
		QObject.connect(self, SIGNAL('textChanged(QString)'), self.text_changed)
示例#10
0
 def __init__(self, *args):
     QLineEdit.__init__(self, *args)
     self.setValidator(QRegExpValidator(QRegExp(r'(^\d*\.[\d]{1,2}$)|(^[1-9]\d*[\.]$)'), self))
示例#11
0
 def __init__(self, 
              parentWidget, 
              label        = '', 
              labelColumn  = 0,
              text         = '', 
              setAsDefault = True,
              spanWidth    = False
              ):
     """
     Appends a QLineEdit widget to <parentWidget>, a property manager group box.
     
     @param parentWidget: the parent group box containing this widget.
     @type  parentWidget: PM_GroupBox
     
     @param label: The label that appears to the left or right of the 
                   checkbox. 
                   
                   If spanWidth is True, the label will be displayed on
                   its own row directly above the checkbox.
                   
                   To suppress the label, set I{label} to an 
                   empty string.
     @type  label: str
     
     @param labelColumn: The column number of the label in the group box
                         grid layout. The only valid values are 0 (left 
                         column) and 1 (right column). The default is 0 
                         (left column).
     @type  labelColumn: int
     
     @param text: initial value of LineEdit widget.
     @type  text: str
     
     @param setAsDefault: if True, will restore <val> when the
                 "Restore Defaults" button is clicked.
     @type  setAsDefault: bool
     
     @param spanWidth: if True, the widget and its label will span the width
                   of the group box. Its label will appear directly above
                   the widget (unless the label is empty) and is left justified.
     @type  spanWidth: bool
     
     @see: U{B{QLineEdit}<http://doc.trolltech.com/4/qlineedit.html>}
     """
     
     if 0: # Debugging code
         print "PM_LineEdit.__init__():"
         print "  label        = ", label
         print "  labelColumn  = ", labelColumn
         print "  text         = ", text
         print "  setAsDefault = ", setAsDefault
         print "  spanWidth    = ", spanWidth
             
     QLineEdit.__init__(self)
     
     self.parentWidget = parentWidget
     self.label        = label
     self.labelColumn  = labelColumn
     self.setAsDefault = setAsDefault
     self.spanWidth    = spanWidth
     
     if label: # Create this widget's QLabel.
         self.labelWidget = QLabel()
         self.labelWidget.setText(label)
             
     # Set QLineEdit text
     self.setText(text)
     
     # Set default value
     self.defaultText = text
     self.setAsDefault = setAsDefault
                 
     parentWidget.addPmWidget(self)
示例#12
0
 def __init__(self, parent):
     QLineEdit.__init__(self, parent)
     self.mi = None
示例#13
0
 def __init__(self, parent):
     QLineEdit.__init__(self, parent)
     self.mi = None
示例#14
0
    def __init__(self, *args):
        QLineEdit.__init__(self, *args)

        QObject.connect(self, SIGNAL('textChanged(QString)'),
                        self.text_changed)
示例#15
0
 def __init__(self, *args):
     QLineEdit.__init__(self, *args)
     self.setValidator(
         QRegExpValidator(QRegExp(r'(^\d*\.[\d]{1,2}$)|(^[1-9]\d*[\.]$)'),
                          self))
示例#16
0
 def __init__(self, text, parent):
     if text is None:
         text = ''
     QLineEdit.__init__(self, text, parent)
     self.setEnabled(False)
示例#17
0
 def __init__(self, 
              parentWidget, 
              label        = '', 
              labelColumn  = 0,
              text         = '', 
              setAsDefault = True,
              spanWidth    = False
              ):
     """
     Appends a QLineEdit widget to <parentWidget>, a property manager group box.
     
     @param parentWidget: the parent group box containing this widget.
     @type  parentWidget: PM_GroupBox
     
     @param label: The label that appears to the left or right of the 
                   checkbox. 
                   
                   If spanWidth is True, the label will be displayed on
                   its own row directly above the checkbox.
                   
                   To suppress the label, set I{label} to an 
                   empty string.
     @type  label: str
     
     @param labelColumn: The column number of the label in the group box
                         grid layout. The only valid values are 0 (left 
                         column) and 1 (right column). The default is 0 
                         (left column).
     @type  labelColumn: int
     
     @param text: initial value of LineEdit widget.
     @type  text: str
     
     @param setAsDefault: if True, will restore <val> when the
                 "Restore Defaults" button is clicked.
     @type  setAsDefault: bool
     
     @param spanWidth: if True, the widget and its label will span the width
                   of the group box. Its label will appear directly above
                   the widget (unless the label is empty) and is left justified.
     @type  spanWidth: bool
     
     @see: U{B{QLineEdit}<http://doc.trolltech.com/4/qlineedit.html>}
     """
     
     if 0: # Debugging code
         print "PM_LineEdit.__init__():"
         print "  label        = ", label
         print "  labelColumn  = ", labelColumn
         print "  text         = ", text
         print "  setAsDefault = ", setAsDefault
         print "  spanWidth    = ", spanWidth
             
     QLineEdit.__init__(self)
     
     self.parentWidget = parentWidget
     self.label        = label
     self.labelColumn  = labelColumn
     self.setAsDefault = setAsDefault
     self.spanWidth    = spanWidth
     
     if label: # Create this widget's QLabel.
         self.labelWidget = QLabel()
         self.labelWidget.setText(label)
             
     # Set QLineEdit text
     self.setText(text)
     
     # Set default value
     self.defaultText = text
     self.setAsDefault = setAsDefault
                 
     parentWidget.addPmWidget(self)
示例#18
0
 def __init__(self, parent):
     QLineEdit.__init__(self, parent)
     self.pat = re.compile(r'[^0-9a-zA-Z]')
     self.textChanged.connect(self.validate)
示例#19
0
 def __init__(self, parent):
     QLineEdit.__init__(self, parent)
     self.pat = re.compile(r'[^0-9a-zA-Z]')
     self.textChanged.connect(self.validate)