Merge pull request #2136 from PySimpleGUI/Dev-latest

Fix for BrowseFiles button, added range to Slider update
This commit is contained in:
PySimpleGUI 2019-11-04 14:57:40 -05:00 committed by GitHub
commit f09b104c2c
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 12 additions and 5 deletions

View File

@ -741,6 +741,7 @@ class Element():
:param event: (unknown) Not used in this function.
"""
# print(f'Button callback event = {obj_to_string_single_obj(event)}')
try:
self.ButtonCallBack()
except:
@ -5153,7 +5154,6 @@ class Window:
"""
Represents a single Window
"""
NumOpenWindows = 0
user_defined_icon = None
hidden_master_root = None
@ -5285,6 +5285,7 @@ class Window:
if finalize:
self.Finalize()
@classmethod
def GetAContainerNumber(cls):
"""
@ -6070,7 +6071,8 @@ class Window:
except:
pass
self.TKrootDestroyed = True
del self
del self.TKroot
del self.Rows
# IT FINALLY WORKED! 29-Oct-2018 was the first time this damned thing got called
@ -7337,6 +7339,7 @@ def _BuildResultsForSubform(form, initialize_only, top_level_form):
value = element.MenuItemChosen
element.MenuItemChosen = None
elif element.Type == ELEM_TYPE_BUTTONMENU:
print(f'Building results. Menu item chosen = {element.MenuItemChosen}')
value = element.MenuItemChosen
element.MenuItemChosen = None

View File

@ -1,5 +1,5 @@
#!/usr/bin/python3
version = __version__ = "0.30.02 Unreleased Menu color Bye bye PyQt5, added 5 extra pixels to window size"
version = __version__ = "0.30.04 Unreleased Menu color Bye bye PyQt5, added 5 extra pixels to window size, FilesBrowse fix, Slider.Update range"
import sys
import types
@ -1328,7 +1328,7 @@ class Button(Element):
if target_element.Type == ELEM_TYPE_BUTTON:
target_element.FileOrFolderName = file_name
else:
target_element.Update(file_name[0])
target_element.Update(file_name)
elif self.BType == BUTTON_TYPE_SAVEAS_FILE:
qt_types = convert_tkinter_filetypes_to_qt(self.FileTypes)
file_name = QFileDialog.getSaveFileName(dir=self.InitialFolder, filter=qt_types)
@ -1486,7 +1486,7 @@ class ButtonMenu(Element):
def _QT_MenuItemChosenCallback(self, item_chosen):
print('IN BUTTON MENU ITEM CALLBACK', item_chosen)
# print('IN BUTTON MENU ITEM CALLBACK', item_chosen)
self.Key = item_chosen.replace('&','') # fool the quit function into thinking this was a key
_element_callback_quit_mainloop(self)
@ -2242,6 +2242,10 @@ class Slider(Element):
self.QT_Slider.setDisabled(True)
elif disabled == False:
self.QT_Slider.setDisabled(False)
if range != (None, None):
self.Range = range
self.QT_Slider.setMinimum(range[0])
self.QT_Slider.setMaximum(range[1])
super().Update(self.QT_Slider, visible=visible)