Window - set location, manually set size

This commit is contained in:
MikeTheWatchGuy 2018-12-30 10:31:41 -05:00
parent 3a819477d7
commit 6013da9390
1 changed files with 24 additions and 15 deletions

View File

@ -3020,7 +3020,7 @@ class Window:
def timer_timeout(self, event): def timer_timeout(self, event):
# first, get the results table built # first, get the results table built
# modify the Results table in the parent FlexForm object # modify the Results table in the parent FlexForm object
print('timer timeout') # print('timer timeout')
if self.TimerCancelled: if self.TimerCancelled:
return return
self.LastButtonClicked = self.TimeoutKey self.LastButtonClicked = self.TimeoutKey
@ -3028,6 +3028,7 @@ class Window:
if self.CurrentlyRunningMainloop: if self.CurrentlyRunningMainloop:
self.App.ExitMainLoop() self.App.ExitMainLoop()
def non_block_timer_timeout(self, event): def non_block_timer_timeout(self, event):
# print('non-blocking timer timeout') # print('non-blocking timer timeout')
self.App.ExitMainLoop() self.App.ExitMainLoop()
@ -3040,6 +3041,7 @@ class Window:
# print("quitting window") # print("quitting window")
self.App.ExitMainLoop() self.App.ExitMainLoop()
def Read(self, timeout=None, timeout_key=TIMEOUT_KEY): def Read(self, timeout=None, timeout_key=TIMEOUT_KEY):
if timeout == 0: # timeout of zero runs the old readnonblocking if timeout == 0: # timeout of zero runs the old readnonblocking
event, values = self._ReadNonBlocking() event, values = self._ReadNonBlocking()
@ -3091,9 +3093,7 @@ class Window:
self.CurrentlyRunningMainloop = True self.CurrentlyRunningMainloop = True
# print(f'In main {self.Title}') # print(f'In main {self.Title}')
################################# CALL GUWxTextControlI MAINLOOP ############################ ################################# CALL GUWxTextControlI MAINLOOP ############################
self.App.MainLoop() self.App.MainLoop()
# self.LastButtonClicked = 'TEST'
self.CurrentlyRunningMainloop = False self.CurrentlyRunningMainloop = False
self.TimerCancelled = True self.TimerCancelled = True
if timer: if timer:
@ -3149,18 +3149,18 @@ class Window:
return self return self
if not self.Shown: if not self.Shown:
self.Show(non_blocking=True) self.Show(non_blocking=True)
else: # else:
try: # try:
self.QTApplication.processEvents() # refresh the window # self.QTApplication.processEvents() # refresh the window
except: # except:
print('* ERROR FINALIZING *') # print('* ERROR FINALIZING *')
self.TKrootDestroyed = True # self.TKrootDestroyed = True
Window.DecrementOpenCount() # Window.DecrementOpenCount()
return self return self
def Refresh(self): def Refresh(self):
self.QTApplication.processEvents() # refresh the window # self.QTApplication.processEvents() # refresh the window
return self return self
def VisibilityChanged(self): def VisibilityChanged(self):
@ -4345,7 +4345,7 @@ def PackFormIntoFrame(form, containing_frame, toplevel_form):
if not auto_size_text: if not auto_size_text:
statictext.SetMinSize((width,height)) statictext.SetMinSize((width,height))
if element.Tooltip: if element.Tooltip:
statictext.SetToolTipString(element.Tooltip) statictext.SetToolTip(element.Tooltip)
# ---===--- LABEL widget create and place --- # # ---===--- LABEL widget create and place --- #
# stringvar = tk.StringVar() # stringvar = tk.StringVar()
# element.TKStringVar = stringvar # element.TKStringVar = stringvar
@ -5227,11 +5227,20 @@ def StartupTK(window):
outer2.Add(outersizer, 1, wx.LEFT|wx.RIGHT|wx.EXPAND, border=DEFAULT_MARGINS[0]) outer2.Add(outersizer, 1, wx.LEFT|wx.RIGHT|wx.EXPAND, border=DEFAULT_MARGINS[0])
window.MasterPanel.SetSizer(outer2) window.MasterPanel.SetSizer(outer2)
# TODO - If there's a manually set Size and Location, set them here
outer2.Fit(window.MasterFrame) outer2.Fit(window.MasterFrame)
if window.Location != (None, None):
window.MasterFrame.Move(window.Location[0], window.Location[1])
else:
window.MasterFrame.Center(wx.BOTH)
if window._Size != (None, None):
window.MasterFrame.SetSize(window._Size[0], window._Size[1])
window.MasterFrame.Show() window.MasterFrame.Show()
# ....................................... DONE creating and laying out window ..........................# # ....................................... DONE creating and laying out window ..........................#
if RUN_INSPECTION_TOOL: if RUN_INSPECTION_TOOL:
@ -5249,7 +5258,7 @@ def StartupTK(window):
window.timer = wx.Timer(window.App, id=1234 ) window.timer = wx.Timer(window.App, id=1234 )
window.App.Bind(wx.EVT_TIMER, window.autoclose_timer_callback, id=1234) window.App.Bind(wx.EVT_TIMER, window.autoclose_timer_callback, id=1234)
window.timer.Start(milliseconds=window.AutoCloseDuration*1000, oneShot=wx.TIMER_ONE_SHOT) window.timer.Start(milliseconds=window.AutoCloseDuration*1000, oneShot=wx.TIMER_ONE_SHOT)
# ------------------------------------ MAINLOOP ------------------------------------
if not window.NonBlocking: if not window.NonBlocking:
window.App.MainLoop() window.App.MainLoop()
else: else: