Skip to content

Commit

Permalink
Category browsing updated; ready for alternative packages
Browse files Browse the repository at this point in the history
  • Loading branch information
iMaxxx committed Jan 2, 2014
1 parent 34ab6d0 commit 1670da5
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 12 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -104,11 +104,11 @@ class OpenScreen(ConfigListScreen, Screen ):
</screen>
"""

def __init__(self, session,category_id = "%",category_name=_("Plugins"),onlyupdates=False, limit = "",onlyinstalled=False):
def __init__(self, session,category_id = "%",category_name=_("Plugins"),onlyupdates=False, limit = "",orderby="date_created desc",onlyinstalled=False):
Screen.__init__(self, session)
self.limit = limit
self["title"] = Label("OpenStore // "+_(category_name))
self.orderby="date_created desc"
self.orderby=orderby
self.url = metrixDefaults.URL_GET_PACKAGES
self["itemname"] = Label()
self["author"] = Label()
Expand Down Expand Up @@ -190,6 +190,7 @@ def getPackages(self,isactive=""):
'orderby':self.orderby+" "+self.limit,
'category_id':str(self.category_id)}
data = metrixCore.getWeb(self.url,True,params)
print str(params)
if "<exception status=""error""" in data:
raise Exception("Error loading data")
dom = parseString(data)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -141,7 +141,9 @@ def openCategory(self):
category_name = self["list"+str(self.selectedColumn)].l.getCurrentSelection()[0][1]
onlyupdates = self["list"+str(self.selectedColumn)].l.getCurrentSelection()[0][3]
onlyinstalled = self["list"+str(self.selectedColumn)].l.getCurrentSelection()[0][4]
self.session.open(store_Packages_Browse.OpenScreen,category_id,category_name,onlyupdates=onlyupdates,onlyinstalled=onlyinstalled)
orderby = self["list"+str(self.selectedColumn)].l.getCurrentSelection()[0][5]
limit = self["list"+str(self.selectedColumn)].l.getCurrentSelection()[0][6]
self.session.open(store_Packages_Browse.OpenScreen,category_id,category_name,onlyupdates=onlyupdates,onlyinstalled=onlyinstalled,orderby=orderby,limit=limit)

def openSettings(self):
self.session.open(store_Settings.OpenScreen)
Expand All @@ -152,8 +154,8 @@ def openSettings(self):



def CategoryEntry(self,column_id, item_id,name,image_link="",onlyupdates=False,onlyinstalled=False):
res = [[item_id,name,image_link,onlyupdates,onlyinstalled]]
def CategoryEntry(self,column_id, item_id,name,image_link="",onlyupdates=False,onlyinstalled=False,orderby="",limit=""):
res = [[item_id,name,image_link,onlyupdates,onlyinstalled,orderby,limit]]
pngicon = metrixTools.webPixmap(metrixDefaults.URL_STORE + image_link,"openStoreImage-"+str(column_id)+str(item_id))
res.append(MultiContentEntryPixmapAlphaBlend(pos=(81, 1), size=(128, 128), png=loadPNG(pngicon)))
res.append(MultiContentEntryText(pos=(0, 128), size=(290, 40), font=0, text=_(name),flags = RT_HALIGN_CENTER))
Expand All @@ -164,23 +166,23 @@ def getCategories(self):
selectionEnabled = False
i = 1

list[i].append(self.CategoryEntry(i,"%", _("Installed"), "/img/categories/installed.png",onlyinstalled=True))
list[i].append(self.CategoryEntry(i,"%", _("Installed"), "/img/categories/installed.png",onlyinstalled=True,orderby="date_modified desc",))
metrixTools.callOnMainThread(self.setList,list[i],i)
i += 1
list[i].append(self.CategoryEntry(i,"%", _("Updates"), "/img/categories/updates.png",onlyupdates=True))
list[i].append(self.CategoryEntry(i,"%", _("Updates"), "/img/categories/updates.png",onlyupdates=True,orderby="date_modified desc",))
metrixTools.callOnMainThread(self.setList,list[i],i)
i += 1
list[i].append(self.CategoryEntry(i,9888, _("New"), "/img/categories/new.png"))
list[i].append(self.CategoryEntry(i,"%", _("New"), "/img/categories/new.png",orderby="date_created desc", limit="LIMIT 20"))
metrixTools.callOnMainThread(self.setList,list[i],i)
i += 1
list[i].append(self.CategoryEntry(i,9777, _("Last Modified"), "/img/categories/recent.png"))
list[i].append(self.CategoryEntry(i,"%", _("Last Modified"), "/img/categories/recent.png",orderby="date_modified desc", limit="LIMIT 20"))
metrixTools.callOnMainThread(self.setList,list[i],i)
i = 1
list[i].append(self.CategoryEntry(i,9666, _("Top 50 Downloads"), "/img/categories/top50.png"))
list[i].append(self.CategoryEntry(i,"%%", _("Top 50 Downloads"), "/img/categories/top50.png",orderby="rating desc", limit="LIMIT 50"))
metrixTools.callOnMainThread(self.setList,list[i],i)
i += 1
if config.plugins.MyMetrix.Store.Plugin_Developer.value:
list[i].append(self.CategoryEntry(i,9999, _("My Packages"), "/img/categories/my.png"))
list[i].append(self.CategoryEntry(i,9999, _("My Packages"), "/img/categories/my.png",orderby="date_modified desc",))
metrixTools.callOnMainThread(self.setList,list[i],i)
i += 1
try:
Expand All @@ -191,7 +193,7 @@ def getCategories(self):
item_id = str(entry.getAttributeNode('id').nodeValue)
name = str(entry.getAttributeNode('name').nodeValue)
image_link = str(entry.getAttributeNode('image').nodeValue)
list[i].append(self.CategoryEntry(i,item_id, name, image_link))
list[i].append(self.CategoryEntry(i,item_id, name, image_link,orderby="date_created desc"))
metrixTools.callOnMainThread(self.setList,list[i],i)
i += 1
if i == self.columns+1:
Expand Down

0 comments on commit 1670da5

Please sign in to comment.