def show(self): self.root.withdraw() if self.flag: img_file = os.path.join(app.config.sk_share_dir, self.img + '.png') from sk1sdk.tkpng import load_icon load_icon(self.root, img_file, self.img) scrnWt = self.root.winfo_screenwidth() scrnHt = self.root.winfo_screenheight() winXPos = (scrnWt / 2) - (self.width / 2) winYPos = (scrnHt / 2) - (self.height / 2) self.win = Toplevel() self.win.overrideredirect(1) self.win.configure(background='black') self.banner = Label(self.win, image=self.img, cursor='watch', borderwidth=0) self.banner.pack() self.verlb = Label(self.win, text='version %s' % (config.version,), bg='white') self.verlb.place(x=10, y=240) self.verlb['font'] += ' bold' self.txtlb = Label(self.win, text='Start...', bg='white') self.txtlb.place(x=10, y=265) self.progress_bar = SS_ProgressBar(self.win) self.progress_bar.pack(fill=X, side=TOP) geom = (self.width, self.height, winXPos, winYPos) self.win.geometry('%dx%d+%d+%d' % geom) self.win.update()
def show(self): self.root.withdraw() if self.flag: img_file = os.path.join(app.config.sk_share_dir, self.img + '.png') from sk1sdk.tkpng import load_icon load_icon(self.root, img_file, self.img) scrnWt = self.root.winfo_screenwidth() scrnHt = self.root.winfo_screenheight() winXPos = (scrnWt / 2) - (self.width / 2) winYPos = (scrnHt / 2) - (self.height / 2) self.win = Toplevel() self.win.overrideredirect(1) self.win.configure(background='black') self.banner = Label(self.win, image=self.img, cursor='watch', borderwidth=0) self.banner.pack() self.verlb = Label(self.win, text='version %s' % (config.version, ), bg='white') self.verlb.place(x=10, y=240) self.verlb['font'] += ' bold' self.txtlb = Label(self.win, text='Start...', bg='white') self.txtlb.place(x=10, y=265) self.progress_bar = SS_ProgressBar(self.win) self.progress_bar.pack(fill=X, side=TOP) geom = (self.width, self.height, winXPos, winYPos) self.win.geometry('%dx%d+%d+%d' % geom) self.win.update()
def _load_composite_templates(widget, path): """ Loads composite templates. This routine allows UI to look more native. widget - any tk widget for tcl interpreter call path - full path to templates """ files = fs.get_files(path, 'png') for file in files: filename = file[:-4] action = filename.split('_')[-1] result = string.join(filename.split('_')[0:-1], '_') colors = sk1sdk.tkstyle.CURRENT_STYLE.colors mask = Image.open(os.path.join(path, file)) mask.load() mask_color = colors.bg if action == 'sel': mask_color = colors.selectbackground if action == 'fg': mask_color = colors.foreground if action in ['sel', 'fg', 'bg']: color_plate = Image.new('RGB', mask.size, mask_color) color_plate.convert('RGBA') color_plate.putalpha(mask) if action == 'bgmask': bgmask = Image.open( os.path.join(path, 'masks', result + '_mask.png')) color_plate = Image.new('RGB', bgmask.size, mask_color) color_plate.convert('RGBA') color_plate.putalpha(bgmask) color_plate.paste(mask, (0, 0), mask.split()[3]) if action == 'bgselmask': mask_color = colors.selectbackground bgmask = Image.open( os.path.join(path, 'masks', result + '_mask.png')) selmask = Image.open( os.path.join(path, 'masks', result + '_selmask.png')) color_sel = Image.new('RGB', bgmask.size, mask_color) color_sel.convert('RGBA') color_sel.putalpha(selmask) mask_color = colors.bg color_plate = Image.new('RGB', bgmask.size, mask_color) color_plate.convert('RGBA') color_plate.putalpha(bgmask) color_plate.paste(mask, (0, 0), mask.split()[3]) color_plate.paste(color_sel, (0, 0), color_sel.split()[3]) imagefile = NamedTemporaryFile() color_plate.save(imagefile, 'PNG') tkpng.load_icon(widget, imagefile.name, result)
def _load_composite_templates(widget,path): """ Loads composite templates. This routine allows UI to look more native. widget - any tk widget for tcl interpreter call path - full path to templates """ files=fs.get_files(path,'png') for file in files: filename=file[:-4] action=filename.split('_')[-1] result=string.join(filename.split('_')[0:-1],'_') colors=sk1sdk.tkstyle.CURRENT_STYLE.colors mask=Image.open(os.path.join(path,file)) mask.load() mask_color=colors.bg if action=='sel': mask_color=colors.selectbackground if action=='fg': mask_color=colors.foreground if action in ['sel','fg','bg']: color_plate=Image.new('RGB', mask.size, mask_color) color_plate.convert('RGBA') color_plate.putalpha(mask) if action=='bgmask': bgmask=Image.open(os.path.join(path,'masks',result+'_mask.png')) color_plate=Image.new('RGB', bgmask.size, mask_color) color_plate.convert('RGBA') color_plate.putalpha(bgmask) color_plate.paste(mask,(0,0), mask.split()[3]) if action=='bgselmask': mask_color=colors.selectbackground bgmask=Image.open(os.path.join(path,'masks',result+'_mask.png')) selmask=Image.open(os.path.join(path,'masks',result+'_selmask.png')) color_sel=Image.new('RGB', bgmask.size, mask_color) color_sel.convert('RGBA') color_sel.putalpha(selmask) mask_color=colors.bg color_plate=Image.new('RGB', bgmask.size, mask_color) color_plate.convert('RGBA') color_plate.putalpha(bgmask) color_plate.paste(mask,(0,0), mask.split()[3]) color_plate.paste(color_sel,(0,0), color_sel.split()[3]) imagefile=NamedTemporaryFile() color_plate.save(imagefile, 'PNG') tkpng.load_icon(widget, imagefile.name, result)
def _load_icons(widget, icons): """ Internal routine for bulk icon loading. widget - any Tk widget for tk interpreter call icons - icon path list """ for icon in icons: item = os.path.basename(icon)[:-4] tkpng.load_icon(widget, icon, item)
def _load_icons(widget,icons): """ Internal routine for bulk icon loading. widget - any Tk widget for tk interpreter call icons - icon path list """ for icon in icons: item=os.path.basename(icon)[:-4] tkpng.load_icon(widget, icon, item)
def _load_widget_templates(widget,path): """ Recursively loads PNG templates. widget - any tk widget for tcl interpreter call path - full path to templates """ icons=fs.get_files_tree(path,'png') for icon in icons: item=os.path.basename(icon)[:-4] tkpng.load_icon(widget, icon, item)
def _load_widget_templates(widget, path): """ Recursively loads PNG templates. widget - any tk widget for tcl interpreter call path - full path to templates """ icons = fs.get_files_tree(path, 'png') for icon in icons: item = os.path.basename(icon)[:-4] tkpng.load_icon(widget, icon, item)