Skip to content
Permalink
Browse files

Fix for BrowseFiles button, added range to Slider update

  • Loading branch information...
PySimpleGUI PySimpleGUI
PySimpleGUI authored and PySimpleGUI committed Nov 4, 2019
1 parent a1e77bc commit 31b8f4258651beda00a33b18e63ef3f9716aa5b9
Showing with 12 additions and 5 deletions.
  1. +5 −2 PySimpleGUI.py
  2. +7 −3 PySimpleGUIQt/PySimpleGUIQt.py
@@ -741,6 +741,7 @@ def ButtonReboundCallback(self, event):
: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 @@ def __init__(self, title, layout=None, default_element_size=DEFAULT_ELEMENT_SIZE
if finalize:
self.Finalize()


@classmethod
def GetAContainerNumber(cls):
"""
@@ -6070,7 +6071,8 @@ def Close(self):
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

@@ -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 @@ def _ButtonCallBack(self):
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 @@ def __init__(self, button_text ,menu_def, tooltip=None,disabled=False,


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 @@ def Update(self, value=None, range=(None, None), disabled=None, visible=None):
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)


0 comments on commit 31b8f42

Please sign in to comment.
You can’t perform that action at this time.