Kiln » TortoiseHg » TortoiseHg
Clone URL:  
Pushed to one repository · View In Graph Contained in 1.9, 1.9.1, and 1.9.2

settings: use event filter for updating desctext on focus

Changeset da0836659083

Parent 7d95d17fd1ca

by Yuya Nishihara

Changes to one file · Browse files at da0836659083 Showing diff from parent 7d95d17fd1ca Diff from another changeset...

 
26
27
28
29
 
30
31
32
 
82
83
84
85
86
87
88
89
90
91
 
110
111
112
113
 
114
115
116
117
118
119
120
121
122
123
124
125
 
138
139
140
141
 
142
143
144
 
147
148
149
150
151
152
153
154
155
156
 
189
190
191
192
 
193
194
195
196
197
198
199
200
201
202
203
204
205
 
781
782
783
784
 
785
786
787
788
789
790
 
791
792
793
 
810
811
812
813
814
815
816
 
820
821
822
823
 
824
825
826
 
26
27
28
 
29
30
31
32
 
82
83
84
 
 
 
 
85
86
87
 
106
107
108
 
109
110
111
112
113
114
 
 
 
 
115
116
117
 
130
131
132
 
133
134
135
136
 
139
140
141
 
 
 
 
142
143
144
 
177
178
179
 
180
181
182
183
184
185
186
 
 
 
 
187
188
189
 
765
766
767
 
768
769
770
771
772
773
774
775
776
777
778
 
795
796
797
 
798
799
800
 
804
805
806
 
807
808
809
810
@@ -26,7 +26,7 @@
   class SettingsCombo(QComboBox):   def __init__(self, parent=None, **opts): - QComboBox.__init__(self, parent) + QComboBox.__init__(self, parent, toolTip=opts['tooltip'])   self.opts = opts   self.setEditable(opts.get('canedit', False))   self.setValidator(opts.get('validator', None)) @@ -82,10 +82,6 @@
  self.resetList()   QComboBox.showPopup(self)   - def focusInEvent(self, e): - self.opts['descwidget'].setHtml(self.opts['tooltip']) - QComboBox.focusInEvent(self, e) -   ## common APIs for all edit widgets     def setValue(self, curvalue): @@ -110,16 +106,12 @@
   class PasswordEntry(QLineEdit):   def __init__(self, parent=None, **opts): - QLineEdit.__init__(self, parent) + QLineEdit.__init__(self, parent, toolTip=opts['tooltip'])   self.opts = opts   self.curvalue = None   self.setEchoMode(QLineEdit.Password)   self.setFixedWidth(ENTRY_WIDTH)   - def focusInEvent(self, e): - self.opts['descwidget'].setHtml(self.opts['tooltip']) - QLineEdit.focusInEvent(self, e) -   ## common APIs for all edit widgets     def setValue(self, curvalue): @@ -138,7 +130,7 @@
   class FontEntry(QPushButton):   def __init__(self, parent=None, **opts): - QPushButton.__init__(self, parent) + QPushButton.__init__(self, parent, toolTip=opts['tooltip'])   self.opts = opts   self.curvalue = None   self.clicked.connect(self.on_clicked) @@ -147,10 +139,6 @@
  self.fname = cpath[11:]   self.setFixedWidth(ENTRY_WIDTH)   - def focusInEvent(self, e): - self.opts['descwidget'].setHtml(self.opts['tooltip']) - QPushButton.focusInEvent(self, e) -   def on_clicked(self, checked):   thgf = qtlib.getfont(self.fname)   dlg = QFontDialog(self) @@ -189,17 +177,13 @@
   class SettingsCheckBox(QCheckBox):   def __init__(self, parent=None, **opts): - QCheckBox.__init__(self, parent) + QCheckBox.__init__(self, parent, toolTip=opts['tooltip'])   self.opts = opts   self.curvalue = None   self.setText(opts['label'])   self.valfunc = self.opts['valfunc']   self.toggled.connect(lambda: self.valfunc(self, self.curvalue))   - def focusInEvent(self, e): - self.opts['descwidget'].setHtml(self.opts['tooltip']) - QCheckBox.focusInEvent(self, e) -   def setFocus(self):   pass   @@ -781,13 +765,14 @@
    for row, (label, cpath, values, tooltip) in enumerate(info):   opts = {'label':label, 'cpath':cpath, 'tooltip':tooltip, - 'descwidget':self.desctext, 'settings':self.settings} + 'settings':self.settings}   if isinstance(values, tuple):   func = values[0]   w = func(opts, values[1])   else:   func = values   w = func(opts) + w.installEventFilter(self)   lbl = QLabel(label)   lbl.installEventFilter(self)   lbl.setToolTip(tooltip) @@ -810,7 +795,6 @@
  for i, name in enumerate(sorted(allexts)):   tt = hglib.tounicode(allexts[name])   opts = {'label':name, 'cpath':'extensions.' + name, 'tooltip':tt, - 'descwidget':self.desctext,   'valfunc':self.validateextensions}   w = genCheckBox(opts)   w.installEventFilter(self) @@ -820,7 +804,7 @@
  return extsinfo, widgets     def eventFilter(self, obj, event): - if event.type() == QEvent.Enter: + if event.type() in (QEvent.Enter, QEvent.FocusIn):   self.desctext.setHtml(obj.toolTip())   if event.type() == QEvent.ToolTip:   return True # tooltip is shown in self.desctext