Merge pull request #925 from MikeTheWatchGuy/Dev-latest

More features for the Pane Element.. Can read values now.
This commit is contained in:
MikeTheWatchGuy 2018-12-14 15:39:05 -05:00 committed by GitHub
commit 125c9eea1e
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 33 additions and 4 deletions

View File

@ -2472,7 +2472,7 @@ class Column(Element):
# Pane # # Pane #
# ---------------------------------------------------------------------- # # ---------------------------------------------------------------------- #
class Pane(Element): class Pane(Element):
def __init__(self, pane_list, background_color=None, size=(None, None), pad=None, orientation='vertical', key=None, visible=True): def __init__(self, pane_list, background_color=None, size=(None, None), pad=None, orientation='vertical', show_handle=True, key=None, visible=True):
''' '''
Container for elements that are stacked into rows Container for elements that are stacked into rows
:param layout: :param layout:
@ -2491,17 +2491,24 @@ class Pane(Element):
self.ParentWindow = None self.ParentWindow = None
self.Rows = [] self.Rows = []
self.TKFrame = None self.TKFrame = None
self.TKColFrame = None self.PanedWindow = None
self.Orientation = orientation self.Orientation = orientation
self.PaneList = pane_list self.PaneList = pane_list
self.ShowHandle = show_handle
bg = background_color if background_color is not None else DEFAULT_BACKGROUND_COLOR bg = background_color if background_color is not None else DEFAULT_BACKGROUND_COLOR
self.Rows = [pane_list]
super().__init__(ELEM_TYPE_PANE, background_color=bg, size=size, pad=pad, key=key, visible=visible) super().__init__(ELEM_TYPE_PANE, background_color=bg, size=size, pad=pad, key=key, visible=visible)
return return
def Update(self, visible=None):
if visible is False:
self.PanedWindow.pack_forget()
elif visible is True:
self.PanedWindow.pack()
@ -3961,6 +3968,18 @@ def BuildResultsForSubform(form, initialize_only, top_level_form):
if element.ReturnValues[0] is not None: # if a button was clicked if element.ReturnValues[0] is not None: # if a button was clicked
button_pressed_text = element.ReturnValues[0] button_pressed_text = element.ReturnValues[0]
if element.Type == ELEM_TYPE_PANE:
element.DictionaryKeyCounter = top_level_form.DictionaryKeyCounter
element.ReturnValuesList = []
element.ReturnValuesDictionary = {}
BuildResultsForSubform(element, initialize_only, top_level_form)
for item in element.ReturnValuesList:
AddToReturnList(top_level_form, item)
if element.UseDictionary:
top_level_form.UseDictionary = True
if element.ReturnValues[0] is not None: # if a button was clicked
button_pressed_text = element.ReturnValues[0]
if element.Type == ELEM_TYPE_TAB_GROUP: if element.Type == ELEM_TYPE_TAB_GROUP:
element.DictionaryKeyCounter = top_level_form.DictionaryKeyCounter element.DictionaryKeyCounter = top_level_form.DictionaryKeyCounter
element.ReturnValuesList = [] element.ReturnValuesList = []
@ -4166,6 +4185,10 @@ def _FindElementFromKeyInSubForm(form, key):
matching_elem = _FindElementFromKeyInSubForm(element, key) matching_elem = _FindElementFromKeyInSubForm(element, key)
if matching_elem is not None: if matching_elem is not None:
return matching_elem return matching_elem
if element.Type == ELEM_TYPE_PANE:
matching_elem = _FindElementFromKeyInSubForm(element, key)
if matching_elem is not None:
return matching_elem
if element.Type == ELEM_TYPE_TAB: if element.Type == ELEM_TYPE_TAB:
matching_elem = _FindElementFromKeyInSubForm(element, key) matching_elem = _FindElementFromKeyInSubForm(element, key)
if matching_elem is not None: if matching_elem is not None:
@ -4379,8 +4402,14 @@ def PackFormIntoFrame(form, containing_frame, toplevel_form):
if element_type == ELEM_TYPE_PANE: if element_type == ELEM_TYPE_PANE:
element.PanedWindow = tk.PanedWindow(tk_row_frame, element.PanedWindow = tk.PanedWindow(tk_row_frame,
orient=tk.VERTICAL if element.Orientation.startswith('v') else tk.HORIZONTAL, orient=tk.VERTICAL if element.Orientation.startswith('v') else tk.HORIZONTAL,
relief=tk.RAISED) relief=tk.RAISED,
)
if element.ShowHandle:
element.PanedWindow.config(showhandle=True)
if element.Size != (None, None):
element.PanedWindow.config(width=element.Size[0], height=element.Size[1])
if element.BackgroundColor is not None and element.BackgroundColor != COLOR_SYSTEM_DEFAULT:
element.PanedWindow.configure(background=element.BackgroundColor)
for pane in element.PaneList: for pane in element.PaneList:
col_frame = tk.Frame(element.PanedWindow) col_frame = tk.Frame(element.PanedWindow)
PackFormIntoFrame(pane, col_frame, toplevel_form) PackFormIntoFrame(pane, col_frame, toplevel_form)