mirror of
https://github.com/shlomif/PySolFC.git
synced 2025-04-05 00:02:29 -04:00
merge differences between */toolbar.py.
Refactoring.
This commit is contained in:
parent
a452aba812
commit
d3561e0e77
2 changed files with 11 additions and 20 deletions
|
@ -73,16 +73,16 @@ class ToolbarCheckbutton(AbstractToolbarButton, ttk.Checkbutton):
|
||||||
def __init__(self, parent, toolbar, toolbar_name, position, **kwargs):
|
def __init__(self, parent, toolbar, toolbar_name, position, **kwargs):
|
||||||
kwargs['style'] = 'Toolbutton'
|
kwargs['style'] = 'Toolbutton'
|
||||||
ttk.Checkbutton.__init__(self, parent, **kwargs)
|
ttk.Checkbutton.__init__(self, parent, **kwargs)
|
||||||
AbstractToolbarButton.__init__(self, parent, toolbar,
|
AbstractToolbarButton.__init__(
|
||||||
toolbar_name, position)
|
self, parent, toolbar, toolbar_name, position)
|
||||||
|
|
||||||
|
|
||||||
class ToolbarButton(AbstractToolbarButton, ttk.Button):
|
class ToolbarButton(AbstractToolbarButton, ttk.Button):
|
||||||
def __init__(self, parent, toolbar, toolbar_name, position, **kwargs):
|
def __init__(self, parent, toolbar, toolbar_name, position, **kwargs):
|
||||||
kwargs['style'] = 'Toolbutton'
|
kwargs['style'] = 'Toolbutton'
|
||||||
ttk.Button.__init__(self, parent, **kwargs)
|
ttk.Button.__init__(self, parent, **kwargs)
|
||||||
AbstractToolbarButton.__init__(self, parent, toolbar,
|
AbstractToolbarButton.__init__(
|
||||||
toolbar_name, position)
|
self, parent, toolbar, toolbar_name, position)
|
||||||
|
|
||||||
|
|
||||||
class ToolbarSeparator(ttk.Separator):
|
class ToolbarSeparator(ttk.Separator):
|
||||||
|
@ -453,8 +453,6 @@ class PysolToolbarTk:
|
||||||
if self._busy():
|
if self._busy():
|
||||||
return EVENT_HANDLED
|
return EVENT_HANDLED
|
||||||
if self.popup:
|
if self.popup:
|
||||||
# print event.x, event.y, \
|
|
||||||
# event.x_root, event.y_root, event.__dict__
|
|
||||||
self.popup.tk_popup(event.x_root, event.y_root)
|
self.popup.tk_popup(event.x_root, event.y_root)
|
||||||
return EVENT_HANDLED
|
return EVENT_HANDLED
|
||||||
|
|
||||||
|
|
|
@ -36,10 +36,6 @@ from six.moves import tkinter
|
||||||
from .tkwidget import MfxTooltip
|
from .tkwidget import MfxTooltip
|
||||||
|
|
||||||
|
|
||||||
# ************************************************************************
|
|
||||||
# *
|
|
||||||
# ************************************************************************
|
|
||||||
|
|
||||||
class AbstractToolbarButton:
|
class AbstractToolbarButton:
|
||||||
def __init__(self, parent, toolbar, toolbar_name, position):
|
def __init__(self, parent, toolbar, toolbar_name, position):
|
||||||
self.toolbar = toolbar
|
self.toolbar = toolbar
|
||||||
|
@ -125,7 +121,7 @@ class ToolbarFlatSeparator(ToolbarSeparator):
|
||||||
|
|
||||||
class ToolbarLabel(tkinter.Message):
|
class ToolbarLabel(tkinter.Message):
|
||||||
def __init__(self, parent, toolbar, toolbar_name, position, **kwargs):
|
def __init__(self, parent, toolbar, toolbar_name, position, **kwargs):
|
||||||
tkinter.Message.__init__(self, parent, kwargs)
|
tkinter.Message.__init__(self, parent, **kwargs)
|
||||||
self.toolbar = toolbar
|
self.toolbar = toolbar
|
||||||
self.toolbar_name = toolbar_name
|
self.toolbar_name = toolbar_name
|
||||||
self.position = position
|
self.position = position
|
||||||
|
@ -164,7 +160,6 @@ class PysolToolbarTk:
|
||||||
size=0, relief='flat', compound='none'):
|
size=0, relief='flat', compound='none'):
|
||||||
self.top = top
|
self.top = top
|
||||||
self.menubar = menubar
|
self.menubar = menubar
|
||||||
# self._setRelief(relief)
|
|
||||||
self.side = -1
|
self.side = -1
|
||||||
self._tooltips = []
|
self._tooltips = []
|
||||||
self._widgets = []
|
self._widgets = []
|
||||||
|
@ -238,14 +233,14 @@ class PysolToolbarTk:
|
||||||
prev_visible = None
|
prev_visible = None
|
||||||
last_visible = None
|
last_visible = None
|
||||||
for w in self._widgets:
|
for w in self._widgets:
|
||||||
if w.__class__ is ToolbarSeparator:
|
if isinstance(w, ToolbarSeparator):
|
||||||
if prev_visible is None or \
|
if prev_visible is None or isinstance(prev_visible,
|
||||||
prev_visible.__class__ is ToolbarSeparator:
|
ToolbarSeparator):
|
||||||
w.hide()
|
w.hide()
|
||||||
else:
|
else:
|
||||||
w.show(orient=self.orient)
|
w.show(orient=self.orient)
|
||||||
elif w.__class__ is ToolbarFlatSeparator:
|
elif isinstance(w, ToolbarFlatSeparator):
|
||||||
if prev_visible.__class__ is ToolbarSeparator:
|
if isinstance(prev_visible, ToolbarSeparator):
|
||||||
prev_visible.hide()
|
prev_visible.hide()
|
||||||
if w.visible:
|
if w.visible:
|
||||||
prev_visible = w
|
prev_visible = w
|
||||||
|
@ -416,7 +411,7 @@ class PysolToolbarTk:
|
||||||
self.frame.update_idletasks()
|
self.frame.update_idletasks()
|
||||||
|
|
||||||
def updateText(self, **kw):
|
def updateText(self, **kw):
|
||||||
for name in list(kw.keys()):
|
for name in kw.keys():
|
||||||
label = getattr(self, name + "_label")
|
label = getattr(self, name + "_label")
|
||||||
label["text"] = kw[name]
|
label["text"] = kw[name]
|
||||||
|
|
||||||
|
@ -483,8 +478,6 @@ class PysolToolbarTk:
|
||||||
if self._busy():
|
if self._busy():
|
||||||
return EVENT_HANDLED
|
return EVENT_HANDLED
|
||||||
if self.popup:
|
if self.popup:
|
||||||
# print event.x, event.y, event.x_root, \
|
|
||||||
# event.y_root, event.__dict__
|
|
||||||
self.popup.tk_popup(event.x_root, event.y_root)
|
self.popup.tk_popup(event.x_root, event.y_root)
|
||||||
return EVENT_HANDLED
|
return EVENT_HANDLED
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue