comparison bing4desktop/bing4desktop.py @ 13:73fd89b46da4

bing4desktop-0.240206-3
author prymula <prymula76@outlook.com>
date Tue, 06 Feb 2024 17:47:04 +0100
parents c01d7edb9cb9
children 18816a0c1fc2
comparison
equal deleted inserted replaced
12:74d743cf58cb 13:73fd89b46da4
20 import json 20 import json
21 import tempfile 21 import tempfile
22 import shutil 22 import shutil
23 import glob 23 import glob
24 24
25 ver = "0.240206-0" 25 ver = "0.240206-3"
26 26
27 BING_URI_BASE = "http://www.bing.com" 27 BING_URI_BASE = "http://www.bing.com"
28 BING_WALLPAPER_PATH = "/HPImageArchive.aspx?format=js&idx=1&n=1&mkt=en-US" 28 BING_WALLPAPER_PATH = "/HPImageArchive.aspx?format=js&idx=1&n=1&mkt=en-US"
29 full_path="" 29 full_path=""
30 actualImage = -1 30 actualImage = -1
181 self.window = tk.Tk() 181 self.window = tk.Tk()
182 self.image = None 182 self.image = None
183 for ico in ['./bing.ico', '/usr/share/bing4desktop/bing.ico']: 183 for ico in ['./bing.ico', '/usr/share/bing4desktop/bing.ico']:
184 try: 184 try:
185 self.image = Image.open(ico) 185 self.image = Image.open(ico)
186 except FileNotFoundError as fs: 186 except:
187 print ('W bieżącym katalogu, brak ikony, ', fs) 187 print ('W bieżącym katalogu, brak ikony ' + ico)
188 finally: 188 finally:
189 break 189 if self.image != None:
190 190 break
191 #if self.image != None:
192 # break
193 191
194 self.tmp = None 192 self.tmp = None
195 self.menu = ( 193 self.menu = (
196 item("Ustaw Tapetę", lambda icon, item: wp.set(full_path, True)), 194 item("Ustaw Tapetę", lambda icon, item: wp.set(full_path, True)),
197 item('Tapeta poprzednia', lambda icon, item: self.change_pic(1)), 195 item('Tapeta poprzednia', lambda icon, item: self.change_pic(1)),
212 self.window.mainloop() 210 self.window.mainloop()
213 211
214 def about(self): 212 def about(self):
215 global ver 213 global ver
216 messagebox.showinfo("Bing4Desktop","Inspracja:\npystray.readthedocs.io/en/latest/usage.html\n\nNapisał: Prymula\n\nLuty 2024\n\nLicencja:\nPublic Domain\n\nWersja: "+ver) 214 messagebox.showinfo("Bing4Desktop","Inspracja:\npystray.readthedocs.io/en/latest/usage.html\n\nNapisał: Prymula\n\nLuty 2024\n\nLicencja:\nPublic Domain\n\nWersja: "+ver)
217 # możliwe że nieprawidlowe 215 # możliwe że nieprawidlowe po wyjściu z aplikacji zwróci bląd :(
218 self.window.destroy() 216 self.window.destroy()
219 self.window.update() 217 self.window.update()
220 218
221 def change_pic(self, n): 219 def change_pic(self, n):
222 global actualImage, BING_WALLPAPER_PATH 220 global actualImage, BING_WALLPAPER_PATH