def __init__(self, frame): cw.ThemedFrame.__init__(self, frame, background=light_color, frame_borderwidth=0) self.iplabel = cw.ThemedLabel(self, "IP:", label_font=smallboldtext) self.iplabel.place(y=0, x=+separatorwidth, relwidth=0.5, height=15) self.iptext = cw.ThemedLabel(self, "unknown", anchor="e") self.iptext.place(y=0, relx=0.5, relwidth=0.5, width=-separatorwidth, height=15) self.portlabel = cw.ThemedLabel(self, "Port:", label_font=smallboldtext) self.portlabel.place(y=15, x=+separatorwidth, relwidth=0.5, height=15) self.porttext = cw.ThemedLabel(self, "unknown", anchor="e") self.porttext.place(y=15, relx=0.5, relwidth=0.5, width=-separatorwidth, height=15) self.userlabel = cw.ThemedLabel(self, "User:"******"unknown", anchor="e") self.usertext.place(y=30, relx=0.5, relwidth=0.5, width=-separatorwidth, height=15) self.passwordlabel = cw.ThemedLabel(self, "Password:"******"unknown", anchor="e") self.passwordtext.place(y=45, relx=0.5, relwidth=0.5, width=-separatorwidth, height=15) self.usblabel = cw.ThemedLabel(self, "USB:", label_font=smallboldtext) self.usblabel.place(y=60, x=+separatorwidth, relwidth=0.5, height=15) self.usbstatus = cw.ThemedLabel(self, "unknown", anchor="e") self.usbstatus.place(y=60, relx=0.5, relwidth=0.5, width=-separatorwidth, height=15)
def __init__(self, frame): cw.ThemedFrame.__init__(self, frame, background=light_color, frame_borderwidth=0) #holds author picture self.project_art_label = cw.ThemedLabel(self, label_text="project_art", anchor="n") #Homebrew Title self.titlevar = tk.StringVar() self.titlevar.set("") self.project_title_label = cw.ThemedLabel( self, label_text="Welcome to NUT", text_variable=self.titlevar, foreground=info_softwarename_color, label_font=mediumboldtext, anchor="n", wraplength=infoframewidth) #Description self.project_description = cw.ScrolledText( self, background=light_color, foreground=info_description_color, font=info_description_font, borderwidth=0, state=NORMAL, wrap="word", ) #author name self.authorvar = tk.StringVar() self.authorvar.set("") self.author_name_label = cw.ThemedLabel(self, label_text="", text_variable=self.authorvar, foreground=info_author_color, label_font=info_author_font, anchor="n") #Separator self.topsep = cw.ThemedFrame( self, background=lgray, frame_borderwidth=2, ) # self.botsep = cw.ThemedFrame(self, # background = lgray, # frame_borderwidth = 2, # ) self.topsep.place(x=(infoframewidth / 2), y=infoframewidth + 52, height=4, relwidth=0.9, anchor="center") self.project_art_label.place(relx=0.0, rely=0.0, height=infoframewidth, relwidth=1) self.project_title_label.place(relx=0.0, rely=0.0, y=infoframewidth, relwidth=1.0) self.author_name_label.place(relx=0.0, rely=0, y=infoframewidth + self.project_title_label.winfo_height(), relwidth=1.0) self.project_description.place( relx=0.5, rely=0.0, y=+infoframewidth + 75, relheight=1, height=-(infoframewidth + self.project_title_label.winfo_height() + self.author_name_label.winfo_height() + separatorwidth), relwidth=0.95, anchor="n") self.project_description.delete('1.0', END) self.project_description.insert(END, QUICKSTARTTEXT) self.project_description.configure(state=DISABLED)
def __init__(self, parent, controller, cwd=None): self.controller = controller #Controller (most toplevel parent) self.cwd = cwd or controller.cwd or sys.path[0] self.softwarelist = [ ] #list to hold software data to populate table and more self.currentselection = 0 #Variable to track currently selected software in listbox self.needsRefresh = True #Variable to track if reload is needed width = 640 height = 480 minwidth = infoframewidth minheight = 120 self.controller.geometry("{}x{}".format(width, height)) self.controller.minsize( width=minwidth, height=minheight) #minimum size currently supported self.controller.title("NUT") # self.controller.bind("<Configure>", self.reload) cw.ThemedFrame.__init__(self, parent) #Init frame self.bind( "<<ShowFrame>>", self.on_show_frame ) #Bind on_show_frame to showframe event so whenever the frame is raised by the controller it reloads #Full window frame, holds everything self.outer_frame = cw.ThemedFrame(self, frame_borderwidth=0, frame_highlightthickness=0) self.outer_frame.place(relx=0.0, rely=0.0, relheight=1.0, relwidth=1.0) #Frame for main list, contains listboxes and scroll bar, and list titles self.content_frame = cw.ThemedFrame(self.outer_frame, frame_borderwidth=0, frame_highlightthickness=0) self.content_frame.place( relx=0.0, rely=0.0, relheight=1, relwidth=1, width=-infoframewidth, ) self.content_frame.configure(background=dark_color) #The contents of this frame are built backwards when self.setbutton() is called due to needing to align the searchbox with the icons self.searchbox_frame = cw.ButtonRow(self.content_frame, frame_highlightthickness=0, background=light_color, frame_borderwidth=0) self.searchbox_frame.Place( relx=0.0, rely=0.0, height=searchboxheight, relwidth=1, ) #Holds the scan path, hidden when not needed self.scanpathbox_frame = cw.ButtonRow(self.content_frame, frame_highlightthickness=0, background=light_color, frame_borderwidth=0) self.scanpathbox_frame.Put( relx=0.0, rely=0.0, height=searchboxheight, relwidth=1, ) #frame to hold far right column self.rightcolumn = cw.ThemedFrame(self, frame_borderwidth=0, frame_highlightthickness=0, background=light_color) self.rightcolumn.place(relx=1, x=-infoframewidth, rely=0.0, relheight=1, width=infoframewidth) #generate table with column labels from list with column widths columns = [["FILE", None], ["TITLEID", 150], ["TYPE", 60], ["SIZE", 100]] #Frame to hold primary lostbox self.list_frame = cw.ThemedFrame(self.content_frame, frame_highlightthickness=0, background=light_color) self.list_frame.place(relx=0, rely=0, y=searchboxheight, relheight=1, height=-(searchboxheight), relwidth=1) #vertical scroll bar (Not placed, trying to make it only appear when needed) self.vsb = tk.Scrollbar(self.content_frame, orient="vertical", command=self.OnVsb) # self.vsb.place(relx=0.975, rely=0.15, relheight=0.94, relwidth=0.025) self.listbox_list = [] popupcommands = [["Blacklist", self.blacklistTitle], ["Remove", self.removeTitle]] self.maintable = cw.themedtable(self.list_frame, columns, popup_callback=self.refresh) self.maintable.place(relheight=1, relwidth=1, x=+separatorwidth, height=-separatorwidth, width=-separatorwidth) self.maintable.addpopupcommands(popupcommands) # bind listboxes to move with mouse scroll for column in columns: self.maintable.listboxes[column[0]].bind("<MouseWheel>", self.OnMouseWheel) #set listboxes to easy names for listbox in self.maintable.listboxes: self.listbox_list.append(self.maintable.listboxes[listbox]) self.filelistbox = self.maintable.listboxes["FILE"] self.titleidlistbox = self.maintable.listboxes["TITLEID"] self.typelistbox = self.maintable.listboxes["TYPE"] self.sizelistbox = self.maintable.listboxes["SIZE"] #Bind selecting an item to CurSelet self.filelistbox.bind('<<ListboxSelect>>', self.CurSelet) self.filelistbox.bind('<ButtonRelease-3>', self.on_right_click) for listbox in self.listbox_list: listbox.bind("<MouseWheel>", self.OnMouseWheel) self.infobox = infobox(self.rightcolumn) self.infobox.place( x=0, relwidth=1, y=0, relheight=1, height=-(stats_box_height + navbuttonheight + 2 * separatorwidth)) self.left_context_button = cw.navbutton(self.rightcolumn, command_name=self.cursordown, text_string="PREV", background=dark_color) self.right_context_button = cw.navbutton(self.rightcolumn, command_name=self.cursorup, text_string="NEXT", background=dark_color) self.left_context_button.place(relx=0, rely=1, y=-(navbuttonheight + separatorwidth), x=+separatorwidth, relwidth=0.5, width=-(2 * separatorwidth), height=navbuttonheight) self.right_context_button.place(relx=0.5, rely=1, y=-(navbuttonheight + separatorwidth), x=+0.5 * separatorwidth, relwidth=0.5, width=-(2 * separatorwidth), height=navbuttonheight) self.stats_box = statbox(self.rightcolumn) self.stats_box.place( x=0, rely=1, y=-(stats_box_height + navbuttonheight + separatorwidth), relwidth=1, height=stats_box_height + separatorwidth) self.speed = cw.ThemedLabel(self.stats_box, "n/a mbps") # self.speed.place(y=75, x=+separatorwidth, relwidth = 0.8, height = 15) self.text = cw.ThemedLabel(self.stats_box, "n/a") # self.text.place(y=90, x=+separatorwidth, relwidth = 0.8, height = 15) self.progbar = cw.progBar(self.stats_box) self.progbar.Place(y=60, relx=0, relwidth=1, width=-2 * separatorwidth, x=+separatorwidth, height=15) self.progbar.hide() self.infoimage = tk.PhotoImage( file=os.path.join(self.cwd, "assets/info.png")).subsample(2) self.addimage = tk.PhotoImage( file=os.path.join(self.cwd, "assets/plus.png")).subsample(2) #Pil breaks this image self.scanimage = tk.PhotoImage( file=os.path.join(self.cwd, "assets/scan.png")).subsample(2) self.infoimage = ImageTk.PhotoImage( Image.open(os.path.join(self.cwd, "assets/info.png")).resize( (40, 40), Image.ANTIALIAS)) self.addimage = ImageTk.PhotoImage( Image.open(os.path.join(self.cwd, "assets/plus.png")).resize( (25, 25), Image.ANTIALIAS)) self.folderimage = ImageTk.PhotoImage( Image.open(os.path.join(self.cwd, "assets/folder.png")).resize( (25, 25), Image.ANTIALIAS)) self.ximage = ImageTk.PhotoImage( Image.open(os.path.join(self.cwd, "assets/plus.png")).rotate(45).resize( (25, 25), Image.ANTIALIAS)) #Set this to a list of buttons to appear next to the path bar buttonlist = [ { "image": self.addimage, "callback": lambda: self.scanpathbox_frame.show(), "tooltip": "Scan a folder", }, { "image": self.infoimage, "callback": lambda: self.controller.show_frame("helpFrame"), "tooltip": "Help", }, ] scanbuttonlist = [ { "image": self.ximage, "callback": lambda: self.scanpathbox_frame.hide(), "tooltip": "Back", }, { "image": self.folderimage, "callback": self.selectRomsFolder, "tooltip": "Select Rom Folder", }, { "image": self.scanimage, "callback": lambda: on_scan(self), "tooltip": "Scan Rom Folder", }, ] self.searchbox_frame.setbuttons( buttonlist, set_pathbox=True, pathbox_placeholder="Search", pathbox_callback=self.updatetable, pathbox_callback_on_keystroke=True, ) self.scanpathbox_frame.setbuttons(scanbuttonlist, set_pathbox=True, pathbox_placeholder="Path to scan") self.sp = self.scanpathbox_frame.sb self.sb = self.searchbox_frame.sb # self.searchbox_frame..set(str((os.path.abspath(Config.paths.scan)))) self.showmainframe() self.refresh() self.klock() Users.export()
def __init__(self, parent, controller): self.controller = controller #Controller (most toplevel parent) self.needsRefresh = True #Variable to track if reload is needed width = infoframewidth + 10 height = 95 minwidth = infoframewidth + 10 minheight = 95 self.controller.geometry("{}x{}".format(width, height)) self.controller.minsize( width=minwidth, height=minheight) #minimum size currently supported self.controller.resizable(False, False) self.controller.title("MUNK") cw.ThemedFrame.__init__(self, parent) #Init frame self.bind( "<<ShowFrame>>", self.on_show_frame ) #Bind on_show_frame to showframe event so whenever the frame is raised by the controller it reloads #Box to hold nut transfer info #----------------------------------------------------------------------------------- self.stats_box = statbox(self) self.stats_box.place(relwidth=1, relheight=1) self.speed = cw.ThemedLabel(self, "n/a mbps") # self.speed.place(y=75, x=+separatorwidth, relwidth = 0.8, height = 15) self.text = cw.ThemedLabel(self, "n/a") # self.text.place(y=90, x=+separatorwidth, relwidth = 0.8, height = 15) self.progbar = cw.ProgressBar(self) #self.progbar.special_place() # self.progbar.place(y = 115, x=+separatorwidth, relwidth = 0.8, height =15) #----------------------------------------------------------------------------------- self.scanpathbox_frame = cw.ButtonRow(self.stats_box) self.scanpathbox_frame.place(x=0, y=75, relwidth=1, height=20) #Images for buttons self.folderimage = ImageTk.PhotoImage( Image.open("assets/folder.png").resize((20, 20), Image.ANTIALIAS)) self.scanimage = tk.PhotoImage(file="assets/scan.png").subsample(3) buttonlist = [ { "image": self.scanimage, "callback": lambda: on_scan(self), "tooltip": "Scan Rom Folder", }, { "image": self.folderimage, "callback": self.selectRomsFolder, "tooltip": "Select Rom Folder", }, ] self.scanpathbox_frame.setbuttons(buttonlist, set_pathbox=True, pathbox_placeholder="Scan", frame_height=75, sep_width=separatorwidth / 2, background=light_color, font=smallertext) self.sp = self.scanpathbox_frame.sb Users.export()