Esempio n. 1
0
    def __init__(self, parent, controller, page_name, back_command):
        self.back_command = back_command
        self.controller = controller
        self.return_frame = "homePage"
        self.yes_command = None

        cw.ThemedFrame.__init__(self, parent, background_color=dark_color)

        self.errortext = cw.ThemedLabel(
            self,
            "Welcome to the error page.\n\nIf you are seeing this, there was an error with the error page.\n\nFML",
            anchor="center",
            wraplength=500)

        errorframeheight = 100
        self.errortext.place(relx=0.5,
                             rely=0.3,
                             x=-250,
                             width=500,
                             height=4 * errorframeheight,
                             y=-(errorframeheight))

        self.backbuttonframe = cw.ThemedFrame(self,
                                              background_color=dark_color)
        self.backbuttonframe.place(relx=0.5,
                                   rely=1,
                                   y=-(navbuttonheight + 2 * separatorwidth),
                                   width=300,
                                   x=-150,
                                   height=navbuttonheight)

        self.backbutton = cw.navbutton(self.backbuttonframe,
                                       command_name=self.on_back,
                                       text_string="RIP. Take me back.",
                                       background=light_color)
        self.backbutton.place(relwidth=1, relheight=1)

        self.yesnobuttonframe = cw.ThemedFrame(self,
                                               background_color=dark_color)
        self.yesnobuttonframe.place(relx=0.5,
                                    rely=1,
                                    y=-(navbuttonheight + 2 * separatorwidth),
                                    width=300,
                                    x=-150,
                                    height=navbuttonheight)

        self.yesbutton = cw.navbutton(self.yesnobuttonframe,
                                      command_name=self.on_yes,
                                      text_string="Yes",
                                      background=light_color)
        self.yesbutton.place(relx=0, relwidth=0.33, relheight=1)

        self.nobutton = cw.navbutton(self.yesnobuttonframe,
                                     command_name=self.on_no,
                                     text_string="No",
                                     background=light_color)
        self.nobutton.place(relx=0.67, relwidth=0.33, relheight=1)

        self.backbuttonframe.tkraise()
Esempio n. 2
0
    def setbuttons(self, buttonlist):
        if not self.pagetitle == None:  #If a title has been specified make it and space it to fit with the buttons
            self.iconspacer = 5 * searchboxheight - icon_and_search_bar_spacing
            self.titleframe = cw.ThemedFrame(self.searchbox_frame,
                                             background_color=light_color)
            self.titleframe.place(
                relx=1,
                rely=.5,
                x=-self.iconspacer + icon_and_search_bar_spacing,
                y=-((searchboxheight) / 2) + icon_and_search_bar_spacing,
                width=self.iconspacer - 2 * icon_and_search_bar_spacing,
                height=searchboxheight - 2 * icon_and_search_bar_spacing)
            self.title = tk.Label(self.titleframe,
                                  foreground=w,
                                  background=light_color,
                                  text=self.pagetitle,
                                  font=giantboldtext)
            self.title.place(x=0, y=0, relwidth=1, relheight=1)
            self.iconspacer += searchboxheight - 2 * icon_and_search_bar_spacing

        else:
            self.iconspacer = searchboxheight - icon_and_search_bar_spacing

        #Generate a button and link a tooltip for each button in the list
        for button in buttonlist:
            if not button == buttonlist[0]:
                self.iconspacer += searchboxheight - 2 * icon_and_search_bar_spacing
            self.buttonobj = cw.navbutton(self.searchbox_frame,
                                          image_object=button["image"],
                                          command_name=button["callback"])
            self.buttonobj.place(
                relx=1,
                rely=.5,
                x=-self.iconspacer,
                y=-((searchboxheight) / 2) + icon_and_search_bar_spacing,
                width=searchboxheight - 2 * icon_and_search_bar_spacing,
                height=searchboxheight - 2 * icon_and_search_bar_spacing)
            button_ttp = cw.tooltip(self.buttonobj, button["tooltip"])
            self.iconspacer += icon_and_search_bar_spacing

        #add search box with remaining space
        self.iconspacer += icon_and_search_bar_spacing
        self.sb = cw.SearchBox(self.searchbox_frame,
                               command=self.search,
                               placeholder="Search",
                               command_on_keystroke=True)
        self.sb.place(relx=0,
                      rely=.5,
                      x=+icon_and_search_bar_spacing,
                      relwidth=1,
                      width=-(self.iconspacer),
                      height=searchboxheight - 2 * icon_and_search_bar_spacing,
                      y=-((searchboxheight) / 2) + icon_and_search_bar_spacing)
Esempio n. 3
0
	def buildbuttonrow(self,title,buttonlist,frame):
		global home_page_button_text_highlight_color

		iconspacer = homebuttonspacing
		for button in buttonlist:
			if not button == buttonlist[0]:
				iconspacer += homebuttonwidth-2*homebuttonspacing

			buttonframe = cw.ThemedFrame(frame,background_color=style.homepage_button_background_color)
			buttonframe.place(rely=.5, x=iconspacer, y = -((homebuttonwidth)/2) + 4*homebuttonspacing,width = homebuttonwidth-2*homebuttonspacing, height=homebuttonwidth-2*homebuttonspacing)
			buttonobj = cw.navbutton(buttonframe,image_object=button["image"],command_name=button["callback"],background = style.homepage_button_background_color)
			buttonobj.place(relwidth=1,relheight=1)
			button_ttp = cw.tooltip(buttonobj,button["tooltip"])
			buttonlabel = cw.ThemedLabel(buttonframe,button["shorttip"],anchor="center",label_font=smallboldtext,foreground=style.homepage_button_text_color,background=home_page_button_text_highlight_color)
			buttonlabel.place(rely=1, relx=0.5, x=-0.5*homebuttonwidth, width=homebuttonwidth, y = -20,height=20) #width = homebuttonwidth-2*homebuttonspacing
			iconspacer += 2*homebuttonspacing

		rowlabel = cw.ThemedLabel(frame,title,anchor="w",label_font=largeboldtext,foreground=style.homepage_category_separator_title_color,background=style.homepage_category_separator_color)
		rowlabel.place(x=0, y = 0,relwidth=1)
Esempio n. 4
0
	def __init__(self, parent, controller,page_name,back_command):
		self.back_command = back_command
		self.controller = controller

		width = guicore.checkguisetting("dimensions","guiwidth")
		height = guicore.checkguisetting("dimensions","guiheight")

		cw.ThemedFrame.__init__(self,parent,background_color= style.about_page_background_color)
		self.outer_frame = cw.ThemedFrame(self,background_color=style.about_page_background_color)
		self.outer_frame.place(relx=0.5,rely=0.5,x=-(width/2),y=-(height/2),width=width,height=height)
		

		#Credits and stuff 
		self.devlabel = cw.ThemedLabel(self.outer_frame, "DEVELOPERS", label_font = columnlabelfont, background = style.about_page_background_color, foreground = columnlabelcolor, anchor="center")
		self.devlabel.place(y=+separatorwidth,x=(2*separatorwidth+0.5*navbuttonheight),relwidth=1,width=-2*(2*separatorwidth+0.5*navbuttonheight))

		self.devframe = cw.ThemedFrame(self.outer_frame, background_color=style.about_page_background_color)
		self.devframe.place(y=+4*separatorwidth+0.5*navbuttonheight,x=separatorwidth,relwidth=1,width=-2*separatorwidth,height=3*navbuttonheight)

		self.lyfeframe = cw.ThemedFrame(self.devframe, background_color=style.about_page_background_color)
		self.lyfeframe.place(relx=0,rely=0,relwidth=0.5,relheight=1)

		self.mintframe = cw.ThemedFrame(self.devframe, background_color=style.about_page_background_color)
		self.mintframe.place(relx=0.5,rely=0,relwidth=0.5,relheight=1)

		try:
			lyfeimage = webhandler.getcachedimage("lyfeonedge") or webhandler.grabgravatar("lyfeonedge") or os.path.join(guicore.assetfolder,notfoundimage)
		except:
			lyfeimage = os.path.join(guicore.assetfolder,notfoundimage)

		#I get an object named after me :D
		self.lyfeonedgeimage = tk.PhotoImage(file=lyfeimage)
		self.lyfeonedge = cw.devbox(self.lyfeframe,"LyfeOnEdge",developers["LyfeOnEdge"]["dev_flavor_text"],self.lyfeonedgeimage,command_name=lambda: webhandler.opentab(developers["LyfeOnEdge"]["project_page_url"]),background=dark_color)
		self.lyfeonedge.place(relx=0.125, relheight=1,relwidth=0.875)

		try:
			pprmntimage = webhandler.getcachedimage("npprmint") or webhandler.grabgravatar("npprmint") or os.path.join(guicore.assetfolder,notfoundimage)
		except:
			pprmntimage = os.path.join(guicore.assetfolder,notfoundimage)

		self.pprmintimage = tk.PhotoImage(file=pprmntimage)
		self.pprmint = cw.devbox(self.mintframe,"pprmint",developers["pprmint"]["dev_flavor_text"],self.pprmintimage,command_name=lambda: webhandler.opentab(developers["pprmint"]["project_page_url"]),background=dark_color)
		self.pprmint.place(relx=0.125, relheight=1,relwidth=0.875)

		self.creditsseparator = cw.Separator(self.outer_frame,color=style.about_page_separator_color)
		self.creditsseparator.place(y=+1*separatorwidth+3*navbuttonheight,x=+separatorwidth,relwidth=1,width=-2*separatorwidth,height=separatorwidth)

		self.thankslabel = cw.ThemedLabel(self.outer_frame,"SPECIAL THANKS", label_font = columnlabelfont, background = style.about_page_background_color, foreground = columnlabelcolor,anchor="center")
		self.thankslabel.place(y=+2*separatorwidth+3*navbuttonheight,x=(2*separatorwidth+0.5*navbuttonheight),relwidth=1,width=-(2*separatorwidth+0.5*navbuttonheight),height=navbuttonheight)

		self.thankstext = cw.ScrolledText(self.outer_frame,background=style.about_page_background_color,borderwidth=0,highlightthickness=0,foreground=lgray,font=smallboldtext,wrap="word")
		self.thankstext.place(y=+0*separatorwidth+4*navbuttonheight,x=separatorwidth,relwidth=1,width=-(2*separatorwidth),relheight=1,height=-(+0*separatorwidth+4*navbuttonheight))
		self.thankstext.insert(END, thankyoutext)
		self.thankstext.config(state=DISABLED)

		#back to main page image and button
		self.returnimage = tk.PhotoImage(file=os.path.join(guicore.assetfolder,"returnbutton.png"))
		self.returnimage = self.returnimage.zoom((3)).subsample(5)

		self.return_button = cw.navbutton(self.outer_frame, image_object=self.returnimage, command_name=back_command)
		self.return_button.place(relx=1, rely=1, x=-(separatorwidth+navbuttonheight), y=-(separatorwidth+navbuttonheight), height=navbuttonheight, width=navbuttonheight)
Esempio n. 5
0
    def __init__(
        self,
        parent,
        controller,
        back_command,
        primary_button_command=None,  #Set this to override the callback of the primary button
        secondary_button_command=None,  #Set this to override the callback of the secondary button (the big button in the details window)
        primary_button_text=None,  #Set this to override the default primary button text 
        secondary_button_text=None,  #Set this to override the default secondary button text 
        version_function=None,  #Set this to override the default callback used to populate the status columm (usually this checks to see if the software has been installed on the selected sd card)
        latest_function=None,  #Set this to override the default callback used to populate the latest column using the software's name
        genre_function=None,  #Set this to override the default callback used to populate the genre column
        status_column="INSTALLED",  #Set this to override the status column title
        page_title=None,  #Set this to apply a page title by the buttons and search box, leave blank to exclude it
        page_name=None,
        softwaregroup=None,  #Set this to the keyword section of the tracking file to log installed software to
        noimage=None,  #Set this to true to disable the info box
        nodetail=None,
        nocheck=None,
    ):

        self.page_name = page_name
        self.controller = controller  #Controller (most toplevel parent)
        self.softwaregroup = softwaregroup  #Make group available
        self.softwarelist = [
        ]  #list to hold software data to populate table and more
        self.tagslist = []
        self.currentselection = 0  #Variable to track currently selected software
        self.currenttagselection = 0  #Variable to track currently selected sub-version
        self.pagetitle = page_title
        self.noimage = noimage
        self.nodetail = nodetail
        self.nocheck = nocheck

        if latest_function:
            self.latest_function = latest_function
        else:
            self.latest_function = self.get_latest_store_version

        if version_function:
            self.version_function = version_function
        else:
            self.version_function = self.get_installed_version

        if genre_function:
            self.genre_function = genre_function
        else:
            self.genre_function = self.get_genre

        cw.ThemedFrame.__init__(self, parent)  #Init frame
        self.bind("<<ShowFrame>>",
                  self.on_show_frame)  #Bind on_show_frame to showframe event

        base_x = 40

        #Default image handling, when pillow isn't installed
        if not guicore.getpilstatus():
            #Shared images
            self.infoimage = tk.PhotoImage(file=os.path.join(
                guicore.assetfolder, "info.png")).zoom(3).subsample(5)
            self.returnimage = tk.PhotoImage(file=os.path.join(
                guicore.assetfolder, "returnbutton.png")).zoom(3).subsample(5)
            self.addrepoimage = tk.PhotoImage(file=os.path.join(
                guicore.assetfolder, "plus.png")).subsample(2)
            self.sdimage = tk.PhotoImage(file=os.path.join(
                guicore.assetfolder, "sd.png")).zoom(2).subsample(4)
        else:
            #open, resize, and convert images to tk format using pillow
            self.infoimage = ImageTk.PhotoImage(
                Image.open(os.path.join(guicore.assetfolder,
                                        "info.png")).resize((base_x, base_x),
                                                            Image.ANTIALIAS))
            self.returnimage = ImageTk.PhotoImage(
                Image.open(
                    os.path.join(guicore.assetfolder,
                                 "returnbutton.png")).resize((base_x, base_x),
                                                             Image.ANTIALIAS))
            self.addrepoimage = ImageTk.PhotoImage(
                Image.open(os.path.join(
                    guicore.assetfolder, "plus.png")).resize(
                        (int(base_x * .9), int(base_x * .9)), Image.ANTIALIAS))
            self.sdimage = ImageTk.PhotoImage(
                Image.open(os.path.join(guicore.assetfolder, "sd.png")).resize(
                    (int(base_x * .8), int(base_x * .8)), Image.ANTIALIAS))

        #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 in self.setbutton due to needing to align the searchbox with the icons
        self.searchbox_frame = cw.ThemedFrame(self.content_frame,
                                              frame_highlightthickness=0,
                                              background_color=light_color,
                                              frame_borderwidth=0)
        self.searchbox_frame.place(
            relx=0.0,
            rely=0.0,
            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.list_frame = cw.ThemedFrame(self.content_frame,
                                         frame_highlightthickness=0)
        self.list_frame.place(relx=0,
                              rely=0,
                              y=searchboxheight,
                              relheight=1,
                              height=-(searchboxheight),
                              relwidth=1)

        #generate table with column labels from list, status column name can be set in declaration
        columns = ["NAME", "GENRE", "LATEST", status_column]
        self.listbox_list = []
        self.maintable = cw.themedtable(self.list_frame, columns, 100)
        self.maintable.place(relheight=1, relwidth=1)
        #bind listboxes to move with mouse scroll
        for column in columns:
            self.maintable.listboxes[column].bind("<MouseWheel>",
                                                  self.OnMouseWheel)
            self.listbox_list.append(self.maintable.listboxes[column])

        #set listboxes to easy names
        self.software_listbox = self.maintable.listboxes["NAME"]
        self.software_listbox.bind('<<ListboxSelect>>', self.CurSelet)

        self.genre_listbox = self.maintable.listboxes["GENRE"]
        self.latest_listbox = self.maintable.listboxes["LATEST"]
        self.status_listbox = self.maintable.listboxes[status_column]

        #Frame for details (raised when details button clicked)
        #past version tags listbox
        self.details_frame = cw.ThemedFrame(self.outer_frame)
        self.details_frame.place(relx=0.0,
                                 rely=0.0,
                                 width=-infoframewidth,
                                 relheight=1,
                                 relwidth=1)

        self.tags_listbox = cw.ThemedListbox(self.details_frame)
        self.tags_listbox.place(relx=0.0, rely=0, relheight=1, relwidth=0.2)
        self.tags_listbox.configure(font=tags_listbox_font)
        self.tags_listbox.configure(font=version_number_font)
        self.tags_listbox.bind('<<ListboxSelect>>', self.CurTagSelet)

        self.patch_notes_separator = cw.Separator(self.details_frame)
        self.patch_notes_separator.place(
            relx=0.2,
            width=separatorwidth,
            rely=0,
            relheight=1,
        )

        #patch notes
        self.scrolling_patch_notes = cw.ScrolledText(
            self.details_frame,
            highlightcolor="black",
            highlightbackground="#d9d9d9",
            font=version_notes_font,
            selectbackground=version_notes_selection_background,
            selectforeground=version_notes_selection_foreground,
            background=version_notes_column_background,
            foreground=version_notes_color,
            wrap="none",
            borderwidth=0,
            highlightthickness=0,
        )
        self.scrolling_patch_notes.place(relx=0.2,
                                         x=+separatorwidth,
                                         rely=0,
                                         relheight=1,
                                         relwidth=0.8,
                                         width=-separatorwidth)

        #frame to hold subframes in far right column
        self.rightcolumn = cw.ThemedFrame(self,
                                          frame_borderwidth=0,
                                          frame_highlightthickness=0)
        self.rightcolumn.place(relx=1,
                               x=-infoframewidth,
                               rely=0.0,
                               relheight=1,
                               width=infoframewidth)

        #column to hold usage details, set using self.setlist()
        self.details_right_column = cw.ThemedFrame(
            self.rightcolumn,
            frame_borderwidth=0,
            frame_highlightthickness=0,
            background_color=light_color)
        self.details_right_column.place(relwidth=1, relheight=1)
        #Details guide for usage details and warnings
        self.details_guide = cw.ScrolledText(self.details_right_column,
                                             borderwidth=0,
                                             highlightthickness=0,
                                             background=light_color,
                                             foreground=guidetextcolor,
                                             wrap=WORD,
                                             font=details_guide_font)
        self.details_guide.place(
            relwidth=1,
            relheight=1,
            height=-(4 * (navbuttonheight + separatorwidth) + separatorwidth))

        #Button to launch the project page for the selected software
        self.project_page_button = cw.navbutton(
            self.details_right_column,
            command_name=self.openprojectpage,
            image_object=None,
            text_string="PROJECT PAGE")
        self.project_page_button.place(relx=0,
                                       rely=1,
                                       y=-4 *
                                       (navbuttonheight + separatorwidth),
                                       height=navbuttonheight,
                                       x=+separatorwidth,
                                       relwidth=1,
                                       width=-(2 * separatorwidth))

        #Button to uninstall selected software
        self.uninstall_button = cw.navbutton(self.details_right_column,
                                             command_name=self.uninstall,
                                             image_object=None,
                                             text_string="UNINSTALL")
        self.uninstall_button.place(relx=0,
                                    rely=1,
                                    y=-3 * (navbuttonheight + separatorwidth),
                                    height=navbuttonheight,
                                    x=+separatorwidth,
                                    relwidth=1,
                                    width=-(2 * separatorwidth))

        #Back to list button frame, placed first so the details button covers it\
        #Set commands based on if they were overridden
        if secondary_button_command == None:
            sbc = self.specificinstall
        else:
            sbc = secondary_button_command

        if secondary_button_text == None:
            sbt = "INSTALL"
        else:
            sbt = secondary_button_text
        self.details_buttons = cw.navbox(
            self.details_right_column,
            primary_button_command=sbc,
            primary_button_text=sbt,
            etc_button_image=self.returnimage,
            etc_button_command=self.showlist,
            left_context_command=self.versioncusordown,
            right_context_command=self.versioncursorup,
        )
        self.details_buttons.place(relx=.5,
                                   rely=1,
                                   x=-100,
                                   y=-87.5,
                                   height=87.5,
                                   width=200)

        #Main column with software details and more
        self.main_right_column = cw.ThemedFrame(self.rightcolumn,
                                                frame_borderwidth=0,
                                                frame_highlightthickness=0,
                                                background_color=light_color)
        self.main_right_column.place(relwidth=1, relheight=1)

        self.infobox = infobox(self.main_right_column)
        #only place infobox if we need it
        if not self.noimage:
            self.infobox.place(
                relwidth=1,
                relheight=1,
            )

        if primary_button_command == None:
            pbc = self.install
            self.software_listbox.bind('<Double-Button-1>', self.install)
        else:
            pbc = primary_button_command
            self.software_listbox.bind('<Double-Button-1>',
                                       primary_button_command)

        if primary_button_text == None:
            pbt = "INSTALL"
        else:
            pbt = primary_button_text

        self.list_buttons_frame = cw.navbox(
            self.main_right_column,
            primary_button_command=pbc,
            primary_button_text=pbt,
            etc_button_image=self.infoimage,
            etc_button_command=self.showdetails,
            left_context_command=self.pagedown,
            right_context_command=self.pageup,
        )
        self.list_buttons_frame.place(relx=.5,
                                      rely=1,
                                      x=-100,
                                      y=-87.5,
                                      height=87.5,
                                      width=200)

        #Make sure list is made visible
        self.showlist()
        self.updateinfobox()
        self.refreshdetailwindow()
        self.updatetable(None)
        self.list_frame.tkraise()
Esempio n. 6
0
    def __init__(self, parent, controller, page_name, back_command):
        pt.page.__init__(self,
                         parent=parent,
                         controller=controller,
                         back_command=back_command,
                         page_title="SD BACKUP MANAGER",
                         primary_button_text="RESTORE",
                         primary_button_command=self.restore,
                         page_name=page_name)

        self.bind("<<ShowFrame>>", self.on_show_frame)

        self.maintable.place_forget()
        self.infobox.place_forget()
        self.details_frame.place_forget()
        self.details_right_column.place_forget()

        self.trashimage = tk.PhotoImage(
            file=os.path.join(guicore.assetfolder, "trash.png")).subsample(2)

        self.list_buttons_frame.etc_button.setcommand(self.delete)
        self.list_buttons_frame.etc_button.setimage(self.trashimage)

        #Button to uninstall selected software
        self.backupbutton = cw.navbutton(self.main_right_column,
                                         command_name=self.backup,
                                         image_object=None,
                                         text_string="MAKE BACKUP")
        self.backupbutton.place(relx=0,
                                rely=1,
                                y=-3 * (navbuttonheight + separatorwidth),
                                height=navbuttonheight,
                                x=+separatorwidth,
                                relwidth=1,
                                width=-(2 * separatorwidth))

        self.openfolderbutton = cw.navbutton(
            self.main_right_column,
            command_name=lambda: open_folder_in_window(locations.backupsfolder
                                                       ),
            image_object=None,
            text_string="OPEN BACKUPS FOLDER")
        self.openfolderbutton.place(relx=0,
                                    rely=1,
                                    y=-4 * (navbuttonheight + separatorwidth),
                                    height=navbuttonheight,
                                    x=+separatorwidth,
                                    relwidth=1,
                                    width=-(2 * separatorwidth))

        columns = [
            "BACKUP",
            "DATE",
        ]
        self.listbox_list = []

        self.backupstable = cw.themedtable(self.list_frame, columns,
                                           tablecolumnwidth)
        self.backupstable.place(
            relx=0.0,
            rely=0.0,
            relheight=1,
            relwidth=1,
        )

        for column in columns:
            self.backupstable.listboxes[column].bind("<MouseWheel>",
                                                     self.OnMouseWheel)
            self.listbox_list.append(self.backupstable.listboxes[column])

        #set listboxes to easy names
        self.software_listbox = self.backupstable.listboxes["BACKUP"]
        self.software_listbox.bind('<<ListboxSelect>>', self.CurSelet)
        self.datecolumn = self.backupstable.listboxes["DATE"]

        self.console = cw.consolebox(self.content_frame)
        self.console.place(relx=0, rely=.7, relwidth=1, relheight=.3)
        self.printtoconsolebox("Select SD card to make or restore backups")

        buttonlist = [
            {
                "image": self.returnimage,
                "callback": back_command,
                "tooltip": "Back to home screen",
            },
            {
                "image": self.sdimage,
                "callback": self.setSDpath,
                "tooltip": "Select SD card",
            },
        ]

        self.setbuttons(buttonlist)

        #Details guide for usage details and warnings
        self.details_guide = cw.ScrolledText(self.main_right_column,
                                             borderwidth=0,
                                             highlightthickness=0,
                                             background=light_color,
                                             foreground=guidetextcolor,
                                             wrap=WORD,
                                             font=details_guide_font)
        self.details_guide.place(
            relwidth=1,
            relheight=1,
            height=-(4 * (navbuttonheight + separatorwidth) + separatorwidth))

        self.setguidetext(details_guide_text)
Esempio n. 7
0
    def __init__(self, parent, controller, page_name, back_command):
        pt.page.__init__(
            self,
            parent=parent,
            controller=controller,
            back_command=back_command,
            page_title="YOUR REPOS",
            page_name=page_name,
            primary_button_command=self.on_new_button,
            primary_button_text="NEW",
            genre_function=self.get_category,
            noimage=True,
            nodetail=True,
            # version_function=self.get_store_installed_version
        )
        self.bind("<<ShowFrame>>", self.on_show_frame)

        self.repoVar = {}
        self.return_frame = "homePage"
        self.maintable.place_forget()
        self.infobox.place_forget()
        self.details_frame.place_forget()
        self.details_right_column.place_forget()

        self.trashimage = tk.PhotoImage(
            file=os.path.join(guicore.assetfolder, "trash.png")).subsample(2)

        self.list_buttons_frame.etc_button.setcommand(
            lambda: self.controller.frames["errorPage"].getanswer(
                self.page_name, "Are you sure you want to delete this repo?",
                self.delete))
        self.list_buttons_frame.etc_button.setimage(self.trashimage)

        buttonlist = [
            {
                "image": self.returnimage,
                "callback":
                lambda: self.controller.show_frame(self.return_frame),
                "tooltip": "Back to home screen",
            },
        ]
        self.setbuttons(buttonlist)

        #usage guide
        self.details_guide = cw.ScrolledText(self.main_right_column,
                                             borderwidth=0,
                                             highlightthickness=0,
                                             background=light_color,
                                             foreground=guidetextcolor,
                                             wrap=WORD,
                                             font=details_guide_font)
        self.details_guide.place(
            relwidth=1,
            relheight=1,
            height=-(2 * (navbuttonheight + separatorwidth) + separatorwidth))

        self.setguidetext(details_guide_text)

        #Make a list of user repos, populate it from the github json, set it as software list
        repolist = guicore.makerepolist()
        repolist = self.populatesoftwarelist(repolist)
        self.setlist(repolist)

        #generate table with column labels from list, status column name can be set in declaration
        columns = ["REPO", "CATEGORY", "SUBFOLDER"]

        self.list_frame = cw.ThemedFrame(self.content_frame,
                                         frame_highlightthickness=0)
        self.list_frame.place(relx=0,
                              rely=0,
                              y=searchboxheight,
                              relheight=1,
                              height=-(searchboxheight),
                              relwidth=1)

        self.listbox_list = []
        self.maintable = cw.themedtable(self.list_frame, columns, 100)
        self.maintable.place(relheight=1, relwidth=1)
        #bind listboxes to move with mouse scroll
        for column in columns:
            self.maintable.listboxes[column].bind("<MouseWheel>",
                                                  self.OnMouseWheel)
            # self.listbox_list.append(self.maintable.listboxes[column])

        #set listboxes to easy names
        for listbox in self.maintable.listboxes:
            self.listbox_list.append(self.maintable.listboxes[listbox])

        # self.listboxlist = self.maintable.listboxes
        self.genre_listbox = self.maintable.listboxes["CATEGORY"]

        self.software_listbox = self.maintable.listboxes["REPO"]
        self.software_listbox.bind('<<ListboxSelect>>', self.CurSelet)

        self.latest_listbox = cw.ThemedListbox(self)
        self.status_listbox = self.maintable.listboxes["SUBFOLDER"]

        #Page frame for adding new repo
        self.addreposcreen = cw.ThemedFrame(self.outer_frame,
                                            background_color=light_color)
        self.addreposcreen.place(x=0, y=0, relwidth=1, relheight=1)

        self.softwarename_box = cw.entrybox(
            self.addreposcreen,
            placeholder=softwarename_placeholder,
        )
        self.softwarename_box.place(relx=0.00,
                                    relwidth=.333,
                                    y=separatorwidth,
                                    height=entryheight,
                                    width=-2 * separatorwidth,
                                    x=+separatorwidth)

        self.new_urlbox = cw.entrybox(
            self.addreposcreen,
            placeholder=new_url_placeholder,
        )
        self.new_urlbox.place(relx=0.334,
                              y=separatorwidth,
                              relwidth=.666,
                              height=entryheight,
                              width=-separatorwidth)

        self.new_descriptionbox = cw.entrybox(
            self.addreposcreen, placeholder=new_description_placeholder)
        self.new_descriptionbox.place(relx=0,
                                      y=2 * (entryheight + 2 * separatorwidth),
                                      relwidth=1,
                                      height=entryheight,
                                      width=-2 * separatorwidth,
                                      x=+separatorwidth)

        self.download_github_button = cw.navbutton(
            self.addreposcreen,
            command_name=lambda: self.download_json_then_list_assets(),
            text_string="NEXT")
        self.download_github_button.place(relx=0,
                                          rely=0,
                                          y=3 *
                                          (entryheight + 2 * separatorwidth),
                                          x=+separatorwidth,
                                          height=entryheight,
                                          width=3 * entryheight)

        #What subfolder do you want the asset to install to?
        "Select install subfolder (omit leading /)\nKeep in mind some .zips already contain\nthe necessary subfolders and should be\n unzipped to the SD root"
        subfolders = [
            "atmosphere",
            "ReiNX",
            "switch",
            "switch/PyNX",
            "sxos",
        ]
        self.subfolder_dropdown = cw.cbox(self.addreposcreen, subfolders,
                                          "subfolder (blank for root)")
        self.subfolder_dropdown.place(relx=0.00,
                                      relwidth=.333,
                                      y=(entryheight + 2.5 * separatorwidth),
                                      height=entryheight,
                                      width=-2 * separatorwidth,
                                      x=+separatorwidth)

        #Which description do you want your app to have
        """Select homebrew genre (optional)"""
        genres = [
            "app", "emu", "experimental", "game", "homebrew", "interpreter",
            "mod", "other", "patch", "save manager", "script", "tool",
            "video player", "shoutouts to simpleflips", "twitch.tv/simpleflips"
        ]
        self.genres_dropdown = cw.cbox(self.addreposcreen, genres,
                                       "genre (up to you)")
        self.genres_dropdown.place(relx=0.334,
                                   relwidth=.333,
                                   y=(entryheight + 2.5 * separatorwidth),
                                   height=entryheight,
                                   width=-separatorwidth)

        #Which page does the repo appear on?
        """Select page to display repo on"""
        categories = ["homebrew", "emulator", "game", "python", "cfw"]
        self.category_dropdown = cw.cbox(self.addreposcreen, categories,
                                         "display page")
        self.category_dropdown.place(relx=0.667,
                                     relwidth=.333,
                                     y=(entryheight + 2.5 * separatorwidth),
                                     height=entryheight,
                                     width=-separatorwidth)
        self.category_dropdown.disabletext()
        # self.category_dropdown.set_text(categories[0])

        self.assetsframe = cw.ThemedFrame(self.addreposcreen,
                                          background_color=light_color)

        self.titleframe = cw.ThemedFrame(self.assetsframe,
                                         background_color=light_color)
        self.titleframe.place(relx=0.25,
                              rely=0,
                              x=-5 * entryheight,
                              y=0,
                              width=10 * entryheight,
                              height=entryheight)
        self.title = tk.Label(self.titleframe,
                              foreground=w,
                              background=light_color,
                              text="Repo Assets",
                              font=giantboldtext)
        self.title.place(x=0, y=0, relwidth=1, relheight=1)

        self.assetslistbox = cw.ScrolledListBox(self.assetsframe)
        self.assetslistbox.place(x=0,
                                 relwidth=0.5,
                                 relheight=1,
                                 y=+entryheight + separatorwidth,
                                 height=-2 * (entryheight + separatorwidth))
        self.assetslistbox.bind('<<ListboxSelect>>', self.AssetSelect)

        # self.assetsguide = cw.ThemedLabel(self.assetsframe, "^Select github asset you wish to manage with this repo. \n This relies on the repo's developer releasing the app with a consistent format.",)
        # self.assetsguide.place(x=0,rely=1,y=-(2*navbuttonheight+separatorwidth), relwidth=1,height=navbuttonheight)
        self.select_asset_button = cw.navbutton(
            self.assetsframe,
            text_string="SELECT",
            command_name=lambda: self.selectasset())
        self.select_asset_button.place(rely=1,
                                       y=-(entryheight),
                                       relx=0.25,
                                       x=-(1.5 * navbuttonheight),
                                       height=entryheight,
                                       width=3 * navbuttonheight)

        #Not placed until needed
        self.asset_pattern_frame = cw.ThemedFrame(self.assetsframe,
                                                  background_color=light_color)
        self.asset_pattern_frame.place(relx=0.5,
                                       x=+separatorwidth,
                                       y=0,
                                       relheight=1,
                                       relwidth=0.5,
                                       width=-separatorwidth)

        self.asset_guide = cw.ScrolledText(self.asset_pattern_frame,
                                           borderwidth=0,
                                           highlightthickness=0,
                                           background=light_color,
                                           foreground=guidetextcolor,
                                           wrap=WORD,
                                           font=details_guide_font)
        self.asset_guide.place(relx=0,
                               rely=0,
                               relheight=1,
                               height=-entryheight,
                               relwidth=1)
        self.asset_guide.insert(END, assetguidetext)
        self.asset_guide.configure(state=DISABLED)

        self.asset_pattern_firstpart_box = cw.entrybox(
            self.asset_pattern_frame,
            placeholder="pattern (filename)",
            justification='right')
        self.asset_pattern_firstpart_box.place(relx=0,
                                               rely=1,
                                               y=-entryheight,
                                               height=entryheight,
                                               relwidth=0.5)

        self.asset_pattern_lastpart_box = cw.entrybox(self.asset_pattern_frame,
                                                      placeholder=".extension")
        self.asset_pattern_lastpart_box.place(relx=0.5,
                                              x=+separatorwidth,
                                              rely=1,
                                              y=-entryheight,
                                              height=entryheight,
                                              relwidth=0.5,
                                              width=-separatorwidth)

        self.returnbuttonframe = cw.ThemedFrame(self.addreposcreen)
        self.returnbuttonframe.place(relx=1,
                                     rely=1,
                                     x=-(separatorwidth + navbuttonheight),
                                     y=-(separatorwidth + entryheight),
                                     height=entryheight,
                                     width=navbuttonheight)
        self.returntoreposcreenbutton = cw.navbutton(
            self.returnbuttonframe,
            image_object=self.returnimage,
            command_name=lambda: self.showmainreposcreen())
        self.returntoreposcreenbutton.place(relwidth=1, relheight=1)

        self.addrepobuttonframe = cw.ThemedFrame(self.addreposcreen,
                                                 background_color=light_color)
        self.addrepobuttonframe.place(relx=0.5,
                                      rely=1,
                                      x=-5 * entryheight,
                                      y=-(entryheight + separatorwidth),
                                      width=10 * entryheight,
                                      height=entryheight)
        self.addrepobutton = cw.navbutton(self.addrepobuttonframe,
                                          text_string="ADD REPO",
                                          command_name=lambda: self.addrepo())
        self.addrepobutton.place(x=0, y=0, relwidth=1, relheight=1)

        self.content_frame.tkraise()
Esempio n. 8
0
    def __init__(self,
                 parent,
                 controller,
                 page_name,
                 back_command,
                 action=None,
                 entry_text=None,
                 on_key_do=False,
                 title=None):
        framework.Frame.__init__(self, parent, controller)
        self.back_command = back_command
        self.controller = controller
        self.action = action
        self.activestatus = False
        self.on_key_do = on_key_do

        self.title = cw.ThemedLabel(self,
                                    None,
                                    anchor="center",
                                    label_font=hugeboldtext,
                                    background=dark_color)
        self.title.place(relx=0.5,
                         rely=.1,
                         x=-0.5 * entryboxwidth,
                         y=+0.5 * entryboxheight,
                         width=entryboxwidth)
        if title: self.title.set(title)

        self.returnimage = tk.PhotoImage(file=os.path.join(
            guicore.assetfolder, "returnbutton.png")).zoom(3).subsample(5)
        self.returnbutton = cw.navbutton(self,
                                         command_name=self.back,
                                         image_object=self.returnimage)
        self.returnbutton.place(relx=1,
                                rely=1,
                                x=-2 * navbuttonheight,
                                y=-2 * navbuttonheight,
                                width=navbuttonheight,
                                height=navbuttonheight)

        self.entry = cw.entrybox(self,
                                 entry_background=light_color,
                                 command=self.action,
                                 entry_font=mondoboldtext,
                                 placeholder=entry_text,
                                 justification="center")
        self.entry.place(relx=0.5,
                         rely=.5,
                         x=-0.5 * entryboxwidth,
                         y=-0.5 * entryboxheight,
                         width=entryboxwidth,
                         height=entryboxheight)
        self.entry.entry.bind("<KeyRelease>", self.on_key)

        self.status = cw.ThemedLabel(self,
                                     None,
                                     anchor="center",
                                     label_font=hugeboldtext,
                                     background=dark_color)
        self.status.place(relx=0.5,
                          rely=.5,
                          x=-0.5 * entryboxwidth,
                          y=+0.5 * entryboxheight,
                          width=entryboxwidth)