From 6928100cf2c70ed16a33fa547793e7426f9bf014 Mon Sep 17 00:00:00 2001 From: James Meyer Date: Sun, 3 Jan 2010 11:11:56 -0600 Subject: bld: add extended group ability. groups that start with a *, are auto generated groups based on the group line in the pkgbuild. --- build_tools/bin/bld_resource.py | 82 ++++++++++++++++++++++++++++++----------- 1 file changed, 60 insertions(+), 22 deletions(-) diff --git a/build_tools/bin/bld_resource.py b/build_tools/bin/bld_resource.py index c19731f..4cd3125 100644 --- a/build_tools/bin/bld_resource.py +++ b/build_tools/bin/bld_resource.py @@ -25,8 +25,8 @@ import distutils.dir_util import pprint import operator import itertools - - +import pprint +pp = pprint.PrettyPrinter(indent=4) try: import pexpect except: @@ -334,6 +334,10 @@ class create_pkglist_thread(QtCore.QThread): self.repo_location = repo_location self.repo_type = repo_type self.group_location=group_location + global masterPkgList + masterPkgList = [] + global masterListPopulated + masterListPopulated=False self.start() def run(self): @@ -403,7 +407,9 @@ class create_pkglist_thread(QtCore.QThread): skipped.append(currentfile) continue for i in pkggroup: - pkggroup_list.append(i) + tmp_pkggroup = group_filename + " " + i + pkggroup_list.append(tmp_pkggroup) + #pkggroup_list.append(i) itemTextList=[pkgname,pkgversion,"-",pkglocation,pkgdescription,pkggroup] itemDict={"pkgname" : pkgname, "pkgversion" : pkgversion, @@ -422,7 +428,7 @@ class create_pkglist_thread(QtCore.QThread): grpset = set(pkggroup_list) for i in grpset: - groupname="group-%s" %i + groupname="*%s" %i self.emit(SIGNAL("insert_group(QString)"),groupname) def toggle(self): @@ -450,33 +456,64 @@ class load_pkg_thread(QtCore.QThread): def run(self): skipped=[] + selected_pkggroup='' + selected_groupfilename=[] + size = 0 if masterListPopulated and self.repo_type != "ABS": if self.group_filename == "All-testing": - selected_group=["core-testing","extra-testing"] + selected_groupfilename=["core-testing","extra-testing"] elif self.group_filename == "All-stable": - selected_group=["core","extra"] + selected_groupfilename=["core","extra"] + elif str(self.group_filename).startswith("*"): + selected_groupfilename=[ str(self.group_filename.replace("*",'')).split()[0] ] + selected_pkggroup=str(self.group_filename.replace("*",'')).partition(" ")[2] else: - selected_group=[self.group_filename] - size = 0 + selected_groupfilename=[str(self.group_filename)] + list1 = [] + add_pkglist=[] + for key, items in itertools.groupby(masterPkgList, operator.itemgetter('pkggroupfile')): list1.append(list(items)) #find total size for item in list1: + use_len = False group_file = item[0]['pkggroupfile'] - if group_file in selected_group : + if group_file in selected_groupfilename : + if selected_pkggroup: + for index,pkg in enumerate(item): + #loop over list to see if pkggroup matches + #if found increase size + pkggroup = pkg['pkggroup'] + if selected_pkggroup in pkggroup: + size = size + 1 + add_pkglist.append(pkg) + else: + use_len = True + + if use_len: size += len(item) totalprocessed=0 - for item in list1: - group_file = item[0]['pkggroupfile'] - if group_file in selected_group : - for index,pkg in enumerate(item): - totalprocessed+=1 - progress = ((float(totalprocessed) / float(size)) * 100) - itemTextList=[pkg["pkgname"],pkg["pkgversion"],"-",pkg["pkglocation"],pkg["pkgdescription"],pkg["pkggroup"]] - self.emit(SIGNAL("insertItem(PyQt_PyObject)"),itemTextList) - self.emit(SIGNAL("update_progress_bar(float)"),progress) - #group_list.append(pkg["pkggroup"]) + #print size + templist=[] + if add_pkglist: + templist = add_pkglist + else: + for item in list1: + group_file = item[0]['pkggroupfile'] + if group_file in selected_groupfilename: + for a in item: + templist.append(a) + + + for index,pkg in enumerate(templist): + totalprocessed+=1 + progress = ((float(totalprocessed) / float(size)) * 100) + itemTextList=[pkg["pkgname"],pkg["pkgversion"],"-",pkg["pkglocation"],pkg["pkgdescription"],pkg["pkggroup"]] + self.emit(SIGNAL("insertItem(PyQt_PyObject)"),itemTextList) + self.emit(SIGNAL("update_progress_bar(float)"),progress) + + #loading from ABS else: try: f = open(self.group_filename,"r") @@ -677,7 +714,7 @@ class Ui_MainWindow(object): self.horizontalLayout.addWidget(self.progressBar) self.comboBox = QtGui.QComboBox(self.groupBox_2) self.comboBox.setEnabled(True) - self.comboBox.setMinimumSize(QtCore.QSize(200, 0)) + self.comboBox.setMinimumSize(QtCore.QSize(250, 0)) self.comboBox.setObjectName("comboBox") self.horizontalLayout.addWidget(self.comboBox) self.pushButton_8 = QtGui.QPushButton(self.groupBox_2) @@ -1892,6 +1929,7 @@ class Ui_MainWindow(object): self.thread.toggle() def populate_group_box(self): + self.disable_table() postfix=".group" grouplist=[] dir_list = os.listdir(self.all_settings['group_file_location']) @@ -1907,7 +1945,7 @@ class Ui_MainWindow(object): grouplist.sort() for g in grouplist: self.comboBox.addItem(g) - self.comboBox.setEnabled(True) + #self.comboBox.setEnabled(True) #kick of thread to create list of stuff self.disable_table() self.createPkgListThread.value_init(grouplist,self.all_settings['repo_location'],"mainrepo",self.all_settings['group_file_location']) @@ -2014,7 +2052,7 @@ class Ui_MainWindow(object): def enable_go_button(self): self.pushButton_go.setEnabled(True) self.pushButton_stop.setEnabled(False) - self.comboBox.setEnabled(True) + #self.comboBox.setEnabled(True) def find_pkgdir(self): #return list of selected pkg locations -- cgit v0.12