@@ -27,6 +27,7 @@ def __init__(self, parent, controller):
2727 self ._controller = controller
2828 self ._sizer = wx .BoxSizer ()
2929 self ._tag_boxes = []
30+ self ._comment_display = None
3031 self .SetAutoLayout (1 )
3132 self .SetupScrolling (scroll_y = False , scrollIntoView = False )
3233 self .SetSizer (self ._sizer )
@@ -63,10 +64,6 @@ def set_value(self, controller, plugin=None):
6364 if not self ._tag_boxes :
6465 self ._add_tags (list (controller ))
6566 else :
66- # in GTK you can have focus in a dead object
67- # this causes Segmentation Faults
68- # Thus instead of clearing old values and adding new ones
69- # modify the ones that exist
7067 self ._modify_values (controller )
7168 self .build ()
7269
@@ -118,21 +115,14 @@ def GetSelection():
118115 def get_height (self ):
119116 """ Seems that this method is never called """
120117 _ , height = self ._sizer .GetSize ()
121- # print(f"DEBUG: tags height={height}")
122- return height # DEBUG return self._sizer.height
118+ return height
123119
124120
125121class TagBox (wx .TextCtrl ):
126122 tb_properties = None
127123
128124 def __init__ (self , parent , tproperties ):
129125 wx .TextCtrl .__init__ (self , parent , wx .ID_ANY , '' , style = wx .TE_CENTER | wx .TE_NOHIDESEL )
130- """
131- self.SetBackgroundColour(Colour(200, 222, 40))
132- self.SetOwnBackgroundColour(Colour(200, 222, 40))
133- self.SetForegroundColour(Colour(7, 0, 70))
134- self.SetOwnForegroundColour(Colour(7, 0, 70))
135- """
136126 self ._bind ()
137127 self .set_properties (tproperties )
138128
@@ -159,7 +149,7 @@ def _apply_properties(self):
159149
160150 def _get_size (self ):
161151 size = self .GetTextExtent (self .value )
162- offset = 13 if IS_WINDOWS else 26 # On GTK3 labels are bigger
152+ offset = 13 if IS_WINDOWS else 26
163153 return wx .Size (max (size [0 ]+ offset , 75 ), max (size [1 ]+ 3 , 25 ))
164154
165155 def _colorize (self ):
@@ -182,25 +172,19 @@ def on_key_up(self, event):
182172 self .SetValue ('' )
183173
184174 if event .GetKeyCode () != wx .WXK_RETURN :
185- # Don't send skip event if enter key is pressed
186- # On some platforms this event is sent too late and causes crash
187175 event .Skip ()
188176
189177 def _cancel_editing (self ):
190178 self .SetValue (self .tb_properties .text )
191179 self ._colorize ()
192180
193181 def on_char (self , event ):
194- # For some reason at least ESC and F<num> keys are considered chars.
195- # We only special case ESC, though.
196182 if event .GetKeyCode () != wx .WXK_ESCAPE :
197183 self .tb_properties .activate (self )
198184 event .Skip ()
199185
200186 def on_kill_focus (self , event ):
201187 self ._update_value ()
202- # Send skip event only if tagbox is empty and about to be destroyed
203- # On some platforms this event is sent too late and causes crash
204188 if self and self .value != '' :
205189 event .Skip ()
206190
@@ -230,9 +214,8 @@ def properties(tag, controller):
230214
231215
232216class _TagBoxProperties (object ):
233- # DEBUG: Use colours from settings
234- foreground_color = 'black' # Colour(7, 0, 70) #
235- background_color = 'gray' # Colour(200, 222, 40) 'white'
217+ foreground_color = 'black'
218+ background_color = 'gray'
236219 enabled = True
237220 add_new = False
238221
@@ -256,7 +239,6 @@ def change_value(self, value):
256239 self ._tag .controller .execute (ctrlcommands .ChangeTag (self ._tag , value ))
257240
258241 def activate (self , tagbox ):
259- """ Just ignore it """
260242 pass
261243
262244
@@ -265,8 +247,7 @@ class TagBoxProperties(_TagBoxProperties):
265247
266248
267249class AddTagBoxProperties (_TagBoxProperties ):
268- # DEBUG: Use colours from settings
269- foreground_color = 'gray' # Colour(200, 222, 40)
250+ foreground_color = 'gray'
270251 text = '<Add New>'
271252 tooltip = 'Click to add new tag'
272253 modifiable = False
@@ -282,21 +263,18 @@ def activate(self, tagbox):
282263
283264
284265class ForcedTagBoxProperties (_TagBoxProperties ):
285- # DEBUG: Use colours from settings
286266 foreground_color = 'red'
287- background_color = '#D3D3D3' # Colour(200, 222, 40)
267+ background_color = '#D3D3D3'
288268 enabled = False
289269
290270
291271class DefaultTagBoxProperties (_TagBoxProperties ):
292- # DEBUG: Use colours from settings
293272 foreground_color = '#666666'
294- background_color = '#D3D3D3' # Colour(200, 222, 40)
273+ background_color = '#D3D3D3'
295274 enabled = False
296275
297276
298277class TestTagBoxProperties (_TagBoxProperties ):
299- # DEBUG: Use colours from settings
300278 foreground_color = 'orange'
301- background_color = '#D3D3D3' # Colour(200, 222, 40)
279+ background_color = '#D3D3D3'
302280 enabled = False
0 commit comments