Merge pull request #1042 from PySimpleGUI/Dev-latest

Dev latest
This commit is contained in:
MikeTheWatchGuy 2019-01-05 15:07:13 -05:00 committed by GitHub
commit f6cdbca4ae
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 21 additions and 21 deletions

View File

@ -3231,8 +3231,8 @@ class Window:
def FindElementWithFocus(self): def FindElementWithFocus(self):
return self.FocusElement return self.FocusElement
element = _FindElementWithFocusInSubForm(self) # element = _FindElementWithFocusInSubForm(self)
return element # return element
def SaveToDisk(self, filename): def SaveToDisk(self, filename):
try: try:
@ -3250,16 +3250,8 @@ class Window:
print('*** Error loading form to disk ***') print('*** Error loading form to disk ***')
def GetScreenDimensions(self): def GetScreenDimensions(self):
if Window.QTApplication is None: size = wx.GetDisplaySize()
Window.QTApplication = QApplication(sys.argv) return size
try:
screen = Window.QTApplication.primaryScreen()
except:
return None, None
size = screen.size()
screen_width = size.width()
screen_height = size.height()
return screen_width, screen_height
def Move(self, x, y): def Move(self, x, y):
self.QT_QMainWindow.move(x, y) self.QT_QMainWindow.move(x, y)
@ -3356,10 +3348,10 @@ class Window:
self._Hidden = False self._Hidden = False
def Disappear(self): def Disappear(self):
self.AlphaChannel = 0 self.MasterFrame.SetTransparent(0)
def Reappear(self): def Reappear(self):
self.AlphaChannel = 255 self.MasterFrame.SetTransparent(255)
def SetAlpha(self, alpha): def SetAlpha(self, alpha):
''' '''
@ -3367,19 +3359,18 @@ class Window:
:param alpha: From 0 to 1 with 0 being completely transparent :param alpha: From 0 to 1 with 0 being completely transparent
:return: :return:
''' '''
self._AlphaChannel = alpha self._AlphaChannel = alpha*255
if self._AlphaChannel is not None: if self._AlphaChannel is not None:
self.QT_QMainWindow.setWindowOpacity(self._AlphaChannel) self.MasterFrame.SetTransparent(self._AlphaChannel)
@property @property
def AlphaChannel(self): def AlphaChannel(self):
return self._AlphaChannel return self._AlphaChannel
@AlphaChannel.setter @AlphaChannel.setter
def AlphaChannel(self, alpha): def AlphaChannel(self, alpha):
self._AlphaChannel = alpha self.SetAlpha(alpha)
if self._AlphaChannel is not None:
self.QT_QMainWindow.setWindowOpacity(self._AlphaChannel)
def BringToFront(self): def BringToFront(self):
self.QTMainWindow.activateWindow(self.QT_QMainWindow) self.QTMainWindow.activateWindow(self.QT_QMainWindow)
@ -3387,8 +3378,8 @@ class Window:
def CurrentLocation(self): def CurrentLocation(self):
location = self.QT_QMainWindow.geometry() location = self.MasterFrame.GetPosition()
return location.left(), location.top() return location
# class QTMainWindow(QWidget): # class QTMainWindow(QWidget):
# def __init__(self,enable_key_events, window): # def __init__(self,enable_key_events, window):
@ -5264,6 +5255,12 @@ def StartupTK(window):
if window.NoTitleBar: if window.NoTitleBar:
window.MasterFrame.SetWindowStyleFlag(wx.NO_BORDER) window.MasterFrame.SetWindowStyleFlag(wx.NO_BORDER)
if window.KeepOnTop:
window.MasterFrame.ToggleWindowStyle(wx.STAY_ON_TOP)
# if flags:
# window.MasterFrame.SetWindowStyleFlag(flags)
# else: # else:
# window.MasterFrame.SetWindowStyleFlag(0) # window.MasterFrame.SetWindowStyleFlag(0)
@ -5290,6 +5287,9 @@ def StartupTK(window):
if window._Size != (None, None): if window._Size != (None, None):
window.MasterFrame.SetSize(window._Size[0], window._Size[1]) window.MasterFrame.SetSize(window._Size[0], window._Size[1])
if window._AlphaChannel is not None:
window.SetAlpha(window._AlphaChannel)
window.MasterFrame.Show() window.MasterFrame.Show()