Permalink
Browse files

Merge pull request #974 from MikeTheWatchGuy/Dev-latest

Dev latest
  • Loading branch information...
MikeTheWatchGuy committed Dec 25, 2018
2 parents 5652d86 + cc2d7af commit 578833569d1751097d5056a6ce015c5e1c199ddd
Showing with 21 additions and 15 deletions.
  1. +3 −3 DemoPrograms/Demo_Base64_Image_Encoder.py
  2. +18 −12 { → PySimpleGUIWx}/PySimpleGUIWx.py
@@ -19,7 +19,7 @@ def main():
sg.PopupCancel('Cancelled - No valid folder entered')
return
try:
namesonly = [f for f in os.listdir(folder) if f.endswith('.png')]
namesonly = [f for f in os.listdir(folder) if f.endswith('.png') or f.endswith('.ico')]
except:
sg.PopupCancel('Cancelled - No valid folder entered')
return
@@ -29,11 +29,11 @@ def main():
for i, file in enumerate(namesonly):
contents = open(os.path.join(folder, file), 'rb').read()
encoded = base64.b64encode(contents)
outfile.write(f'{file[:file.index(".")]} = {encoded}\n')
outfile.write('\n{} = {}\n\n'.format(file[:file.index(".")], encoded))
sg.OneLineProgressMeter('Base64 Encoding', i+1, len(namesonly),key='_METER_')

outfile.close()
sg.Popup('Completed!', 'Encoded %s files'% i)
sg.Popup('Completed!', 'Encoded %s files'%(i+1))


if __name__ == '__main__':
@@ -2527,7 +2527,7 @@ def __init__(self, menu=None, filename=None, data=None, data_base64=None, toolti

self.App = wx.App(False)
frame = wx.Frame(None, title='Tray icon frame')
self.TaskBarIcon = SystemTray.CustomTaskBarIcon(frame, self.App, self.Menu, filename=self.Filename, tooltip=tooltip)
self.TaskBarIcon = SystemTray.CustomTaskBarIcon(frame, self.App, self.Menu, filename=self.Filename, data_base64=data_base64, tooltip=tooltip)

# self.App.MainLoop()

@@ -2540,20 +2540,21 @@ def __init__(self, frame, app, menu, filename=None, data_base64=None, tooltip=No
self.menu_item_chosen = None
self.menu = menu
self.id_to_text = {}
self.filename = filename
self.data_base64 = data_base64
self.tooltip = tooltip or wx.EmptyString

if filename:
icon = wx.Icon(filename, wx.BITMAP_TYPE_ICO)
if tooltip is not None:
self.SetIcon(icon, tooltip=tooltip)
else:
self.SetIcon(icon)
self.icon = wx.Icon(filename, wx.BITMAP_TYPE_ICO)
self.SetIcon(self.icon, tooltip=self.tooltip)
elif data_base64:
ico1 = base64.b64decode(data_base64)
fout = open("zzztemp_icon.ico", "wb")
fout.write(ico1)
fout.close()
icon = wx.Icon('zzztemp_icon.ico', wx.BITMAP_TYPE_ICO)
self.TrayIcon.SetIcon(icon, tooltip=tooltip)
# os.remove("zzztemp_icon.ico")
self.icon = wx.Icon('zzztemp_icon.ico', wx.BITMAP_TYPE_ICO)
self.SetIcon(self.icon, tooltip=self.tooltip)
os.remove("zzztemp_icon.ico")
self.Bind(wx.adv.EVT_TASKBAR_LEFT_DOWN, self.OnTaskBarLeftClick)
self.Bind(wx.adv.EVT_TASKBAR_LEFT_DCLICK, self.OnTaskBarLeftDoubleClick)
self.Bind(wx.adv.EVT_TASKBAR_RIGHT_DOWN, self.OnTaskBarRightClick)
@@ -2657,11 +2658,11 @@ def timer_timeout(self, event):


def Hide(self):
self.TrayIcon.hide()
self.TaskBarIcon.RemoveIcon()


def UnHide(self):
self.TrayIcon.show()
self.TaskBarIcon.SetIcon(icon=self.TaskBarIcon.icon, tooltip=self.TaskBarIcon.tooltip)


def ShowMessage(self, title, message, filename=None, data=None, data_base64=None, messageicon=None, time=10000):
@@ -5053,7 +5054,12 @@ def StartupTK(window):

frame.Bind(wx.EVT_CLOSE, window.OnClose)

frame.SetIcon(wx.Icon(window.WindowIcon))
try:
with open(window.WindowIcon, 'r') as icon_file:
pass
frame.SetIcon(wx.Icon(window.WindowIcon))
except:
pass

if window.BackgroundColor is not None and window.BackgroundColor != COLOR_SYSTEM_DEFAULT:
panel.SetBackgroundColour(window.BackgroundColor)

0 comments on commit 5788335

Please sign in to comment.