summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJames Meyer <james.meyer@operamail.com>2009-10-20 04:43:01 (GMT)
committerJames Meyer <james.meyer@operamail.com>2009-10-20 04:43:01 (GMT)
commit77b7545a6b1bd3e6f1a8f16233b049fbb2a86ee4 (patch)
treefcf5ee292c8e87b935e06899702bd89bc6b4f960
parent5b34c13180e4095721b7d0802dfd51751b5992e0 (diff)
downloadlinhes_dev-77b7545a6b1bd3e6f1a8f16233b049fbb2a86ee4.zip
bld: work in progress to adding pkg group support, Just to show groups after selecting them.
-rw-r--r--build_tools/bin/bld_resource.py521
1 files changed, 316 insertions, 205 deletions
diff --git a/build_tools/bin/bld_resource.py b/build_tools/bin/bld_resource.py
index afcb1d6..c19731f 100644
--- a/build_tools/bin/bld_resource.py
+++ b/build_tools/bin/bld_resource.py
@@ -1,3 +1,4 @@
+#!/bin/python
# -*- coding: utf-8 -*-
# Form implementation generated from reading ui file 'bldtest.ui'
@@ -21,6 +22,10 @@ from PyQt4.QtGui import *
import os, sys, time, subprocess, shutil
import shelve, thread, tarfile, tempfile
import distutils.dir_util
+import pprint
+import operator
+import itertools
+
try:
import pexpect
@@ -41,10 +46,10 @@ sepLine="\n-------------------------------------------------"
global bld_data
homedir = os.path.expanduser("~")
bld_data="%s/.bld_session_data" %homedir
-
-print bld_data
-
-
+global masterPkgList
+global masterListPopulated
+masterPkgList=[]
+masterListPopulated=False
class OutLog:
def __init__(self, edit, out=None, color=None):
@@ -105,6 +110,7 @@ class TableWidget(QTableWidget):
menu.addSeparator()
resetStatus = menu.addAction("Reset status")
resetBuildOrder = menu.addAction("Reset build order")
+ resetSize = menu.addAction("Resize to width")
action = menu.exec_(self.mapToGlobal(event.pos()))
#if action == quitAction:
@@ -139,6 +145,8 @@ class TableWidget(QTableWidget):
self.resetstatus()
if action == resetBuildOrder:
self.resetBuildOrder()
+ if action == resetSize:
+ self.resetSize()
def resetstatus(self):
for row in range(self.rowCount()):
@@ -149,6 +157,11 @@ class TableWidget(QTableWidget):
for row in range(self.rowCount()):
self.item(row, 0).setText("")
return
+ def resetSize(self):
+ columnlist=[1,2,4,6,7]
+ for i in columnlist:
+ self.resizeColumnToContents(i)
+ return
def keep_col_in_list(self,itemList,col):
new_itemList=[]
@@ -161,7 +174,7 @@ class TableWidget(QTableWidget):
def pkglocation(self,item):
row = item.row()
- locitem = self.item(row,4)
+ locitem = self.item(row,5)
loc = str(locitem.text())
return loc
@@ -226,16 +239,11 @@ class MyThread(QtCore.QThread):
self.emit(SIGNAL("update(QString)"),outmsg)
self.running = 0
-
- # self.close()
-
def runcmd(self,cmd_in,itemText,itemrow,builddir):
arglist = " ".join(self.mparglist)
cwd=os.getcwd()
os.chdir(builddir)
- #print builddir
cmd="%s %s %s" %(cmd_in, arglist, itemText)
- # print cmd
retcode = -1
try:
logfile = "%s/%s.build.log" %(builddir.strip(),itemText.strip())
@@ -254,28 +262,13 @@ class MyThread(QtCore.QThread):
self.emit(SIGNAL("update(QString)"),line)
pass
return retcode
- #os.chdir(cwd)
- #process = subprocess.Popen(
- #cmd, stdout=subprocess.PIPE, stderr=subprocess.PIPE)
-
- #while True:
- #outitemText = (process.stdout.readline())
- #if outitemText == '' and process.poll() != None:
- #break
- #if outitemText != '':
- #self.emit(SIGNAL("update(QString)"),outitemText)
- ## sys.stdout.write(itemText)
- ##sys.stdout.flush()
- #self.msleep(5)
-
- #retcode = process.poll()
def render(self,cmd_in,itemlist,mparglist):
self.itemlist = itemlist
self.mparglist = mparglist
self.cmd_in = cmd_in
self.running = 0
- self.TIMEOUT=300
+ self.TIMEOUT=300
self.start()
def run(self):
@@ -330,6 +323,117 @@ class MyThread(QtCore.QThread):
self.alive
+class create_pkglist_thread(QtCore.QThread):
+ def __init__(self, parent = None ):
+ QtCore.QThread.__init__(self, parent )
+ self.alive = 1
+ self.running = 0
+ self.n = 0
+ def value_init(self,filename,repo_location,repo_type,group_location):
+ self.group_filename_list = filename
+ self.repo_location = repo_location
+ self.repo_type = repo_type
+ self.group_location=group_location
+ self.start()
+
+ def run(self):
+ total_packages=0
+ for group_filename in self.group_filename_list:
+ group_file="%s/%s.group" %(self.group_location,group_filename)
+ try:
+ f = open(group_file,"r")
+ file_contents = f.readlines()
+ total_packages_temp=len(file_contents)
+ f.close()
+ except:
+ print "couldn't open file: %s" %group_file
+ #outText = "couldn't open file to populate pkg list: %s " %filename
+ #self.update_ouputwindow(outText)
+ #self.comboBox.setEnabled(True)
+ total_packages+=total_packages_temp
+
+ process_pkg_num = 0
+ pkggroup_list=[]
+ for group_filename in self.group_filename_list:
+ group_file="%s/%s.group" %(self.group_location,group_filename)
+ try:
+ f = open(group_file,"r")
+ file_contents = f.readlines()
+ f.close()
+ except:
+ print "couldn't open file: %s" %group_file
+ #outText = "couldn't open file to populate pkg list: %s " %filename
+ #self.update_ouputwindow(outText)
+ #self.comboBox.setEnabled(True)
+ skipped=[]
+
+
+ for index, line in enumerate(file_contents):
+ process_pkg_num+=1
+ progress = ((float(index+1) / float(total_packages)) * 100)
+ currentfile = "%s/%s/PKGBUILD" %(self.repo_location,line.strip())
+ pkglocation = "%s/%s" %(self.repo_location,line.strip())
+ if os.path.isfile(currentfile):
+ pkgname="unknown"
+ pkgversion="unknown"
+ pkgdescription="unknown"
+ pkggroup=[]
+ try:
+ f= open(currentfile,"r")
+ file_contents= f.readlines()
+ f.close()
+ for line in file_contents:
+ if line.strip().startswith("pkgname"):
+ pkgname=line.partition("=")[2]
+
+ elif line.strip().startswith("pkgver"):
+ pkgversion=line.partition("=")[2]
+
+ elif line.strip().startswith("pkgdesc"):
+ pkgdescription=line.partition("=")[2]
+
+ elif line.strip().startswith("groups"):
+ l=line.partition("=")[2].strip()
+ for c in ['(',')',"'"]:
+ l = l.replace( c, '' )
+ pkggroup=l.split()
+
+ except Exception, e:
+ print "Couldn't parse file: %s\n \treason: %s" %(currentfile,e)
+ skipped.append(currentfile)
+ continue
+ for i in pkggroup:
+ pkggroup_list.append(i)
+ itemTextList=[pkgname,pkgversion,"-",pkglocation,pkgdescription,pkggroup]
+ itemDict={"pkgname" : pkgname,
+ "pkgversion" : pkgversion,
+ "pkglocation" : pkglocation,
+ "pkgdescription" : pkgdescription,
+ "pkggroup" : pkggroup,
+ "pkggroupfile": group_filename }
+ masterPkgList.append(itemDict)
+ time.sleep(0.005)
+ progress = ((float(process_pkg_num) / float(total_packages)) * 100)
+ self.emit(SIGNAL("update_progress_bar(float)"),progress)
+
+ self.emit(SIGNAL("pkg_load_list_finished(bool)"),True)
+ if len(skipped) > 0:
+ self.emit(SIGNAL("pkg_load_skipped(PyQt_PyObject)"),skipped)
+
+ grpset = set(pkggroup_list)
+ for i in grpset:
+ groupname="group-%s" %i
+ self.emit(SIGNAL("insert_group(QString)"),groupname)
+
+ def toggle(self):
+ if self.running:
+ self.running = 0
+ else:
+ self.running = 1
+ def stop(self):
+ self.alive = 0
+
+
class load_pkg_thread(QtCore.QThread):
def __init__(self, parent = None ):
@@ -343,58 +447,89 @@ class load_pkg_thread(QtCore.QThread):
self.repo_type = repo_type
self.start()
+
def run(self):
- try:
- f = open(self.group_filename,"r")
- file_contents = f.readlines()
- total_packages=len(file_contents)
- f.close()
- except:
- print "couldn't open file: %s" %self.group_filename
- #outText = "couldn't open file to populate pkg list: %s " %filename
- #self.update_ouputwindow(outText)
- #self.comboBox.setEnabled(True)
skipped=[]
- for index, line in enumerate(file_contents):
-
- progress = ((float(index+1) / float(total_packages)) * 100)
- currentfile = "%s/%s/PKGBUILD" %(self.repo_location,line.strip())
- pkglocation = "%s/%s" %(self.repo_location,line.strip())
- if os.path.isfile(currentfile):
- pkgname="unknown"
- pkgversion="unknown"
- pkgdescription="unknown"
- try:
- f= open(currentfile,"r")
- file_contents= f.readlines()
- f.close()
- for line in file_contents:
- if line.strip().startswith("pkgname"):
- pkgname=line.partition("=")[2]
-
- elif line.strip().startswith("pkgver"):
- pkgversion=line.partition("=")[2]
-
- elif line.strip().startswith("pkgdesc"):
- pkgdescription=line.partition("=")[2]
-
- #package = parched.PKGBUILD(currentfile)
- #pkgname = str(package.name)
- #pkgversion = str(package.version)
- #pkgdescription = str(package.description)
+ if masterListPopulated and self.repo_type != "ABS":
+ if self.group_filename == "All-testing":
+ selected_group=["core-testing","extra-testing"]
+ elif self.group_filename == "All-stable":
+ selected_group=["core","extra"]
+ else:
+ selected_group=[self.group_filename]
+ size = 0
+ list1 = []
+ for key, items in itertools.groupby(masterPkgList, operator.itemgetter('pkggroupfile')):
+ list1.append(list(items))
+ #find total size
+ for item in list1:
+ group_file = item[0]['pkggroupfile']
+ if group_file in selected_group :
+ 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"])
+ else:
+ try:
+ f = open(self.group_filename,"r")
+ file_contents = f.readlines()
+ total_packages=len(file_contents)
+ f.close()
+ except:
+ print "couldn't open file: %s" %self.group_filename
+ #outText = "couldn't open file to populate pkg list: %s " %filename
+ #self.update_ouputwindow(outText)
+ #self.comboBox.setEnabled(True)
+
+ for index, line in enumerate(file_contents):
+ progress = ((float(index+1) / float(total_packages)) * 100)
+ currentfile = "%s/%s/PKGBUILD" %(self.repo_location,line.strip())
+ pkglocation = "%s/%s" %(self.repo_location,line.strip())
+ if os.path.isfile(currentfile):
+ pkgname="unknown"
+ pkgversion="unknown"
+ pkgdescription="unknown"
+ pkggroup=[]
+ try:
+ f= open(currentfile,"r")
+ file_contents= f.readlines()
+ f.close()
+ for line in file_contents:
+ if line.strip().startswith("pkgname"):
+ pkgname=line.partition("=")[2]
+
+ elif line.strip().startswith("pkgver"):
+ pkgversion=line.partition("=")[2]
+
+ elif line.strip().startswith("pkgdesc"):
+ pkgdescription=line.partition("=")[2]
+
+ elif line.strip().startswith("groups"):
+ l=line.partition("=")[2].strip()
+ for c in ['(',')',"'"]:
+ l = l.replace( c, '' )
+ pkggroup=l.split()
+ except Exception, e:
+ print "Couldn't parse file: %s\n \treason: %s" %(currentfile,e)
+ skipped.append(currentfile)
+ continue
+ itemTextList=[pkgname,pkgversion,"-",pkglocation,pkgdescription,pkggroup]
+ if self.repo_type == "ABS":
+ self.emit(SIGNAL("insertItem_ABS(PyQt_PyObject)"),itemTextList)
+ self.emit(SIGNAL("update_progress_bar_ABS(float)"),progress)
+ else:
+ self.emit(SIGNAL("insertItem(PyQt_PyObject)"),itemTextList)
+ self.emit(SIGNAL("update_progress_bar(float)"),progress)
+ time.sleep(0.005)
- except Exception, e:
- print "Couldn't parse file: %s\n \treason: %s" %(currentfile,e)
- skipped.append(currentfile)
- continue
- itemTextList=[pkgname,pkgversion,"-",pkglocation,pkgdescription]
- if self.repo_type == "ABS":
- self.emit(SIGNAL("insertItem_ABS(PyQt_PyObject)"),itemTextList)
- self.emit(SIGNAL("update_progress_bar_ABS(float)"),progress)
- else:
- self.emit(SIGNAL("insertItem(PyQt_PyObject)"),itemTextList)
- self.emit(SIGNAL("update_progress_bar(float)"),progress)
- time.sleep(0.005)
self.emit(SIGNAL("pkg_load_finished(bool)"),True)
if len(skipped) > 0:
self.emit(SIGNAL("pkg_load_skipped(PyQt_PyObject)"),skipped)
@@ -417,7 +552,7 @@ class run_cmd_thread(QtCore.QThread):
def value_init(self,runcmd,args):
self.runcmd = runcmd
self.args = args
- self.TIMEOUT=300
+ self.TIMEOUT=300
self.start()
def run(self):
@@ -448,8 +583,6 @@ class run_cmd_thread(QtCore.QThread):
pass
self.emit(SIGNAL("enable_tab2(bool)"),True)
- #return retcode
-
def toggle(self):
if self.running:
self.running = 0
@@ -459,12 +592,11 @@ class run_cmd_thread(QtCore.QThread):
self.alive = 0
-
class Ui_MainWindow(object):
def setupUi(self, MainWindow):
MainWindow.setObjectName("MainWindow")
MainWindow.setEnabled(True)
- MainWindow.resize(923, 757)
+ MainWindow.resize(982, 870)
MainWindow.setLayoutDirection(QtCore.Qt.LeftToRight)
self.centralwidget = QtGui.QWidget(MainWindow)
self.centralwidget.setObjectName("centralwidget")
@@ -580,7 +712,7 @@ class Ui_MainWindow(object):
self.tableWidget.setGridStyle(QtCore.Qt.SolidLine)
self.tableWidget.setCornerButtonEnabled(False)
self.tableWidget.setObjectName("tableWidget")
- self.tableWidget.setColumnCount(6)
+ self.tableWidget.setColumnCount(7)
self.tableWidget.setRowCount(0)
item = QtGui.QTableWidgetItem()
self.tableWidget.setHorizontalHeaderItem(0, item)
@@ -594,6 +726,8 @@ class Ui_MainWindow(object):
self.tableWidget.setHorizontalHeaderItem(4, item)
item = QtGui.QTableWidgetItem()
self.tableWidget.setHorizontalHeaderItem(5, item)
+ item = QtGui.QTableWidgetItem()
+ self.tableWidget.setHorizontalHeaderItem(6, item)
self.tableWidget.horizontalHeader().setCascadingSectionResizes(True)
self.tableWidget.horizontalHeader().setStretchLastSection(True)
self.horizontalLayout_5.addWidget(self.tableWidget)
@@ -840,7 +974,7 @@ class Ui_MainWindow(object):
self.tableWidget_2.setVerticalScrollMode(QtGui.QAbstractItemView.ScrollPerItem)
self.tableWidget_2.setCornerButtonEnabled(False)
self.tableWidget_2.setObjectName("tableWidget_2")
- self.tableWidget_2.setColumnCount(6)
+ self.tableWidget_2.setColumnCount(7)
self.tableWidget_2.setRowCount(0)
item = QtGui.QTableWidgetItem()
self.tableWidget_2.setHorizontalHeaderItem(0, item)
@@ -854,6 +988,8 @@ class Ui_MainWindow(object):
self.tableWidget_2.setHorizontalHeaderItem(4, item)
item = QtGui.QTableWidgetItem()
self.tableWidget_2.setHorizontalHeaderItem(5, item)
+ item = QtGui.QTableWidgetItem()
+ self.tableWidget_2.setHorizontalHeaderItem(6, item)
self.tableWidget_2.horizontalHeader().setStretchLastSection(True)
self.verticalLayout_6.addWidget(self.tableWidget_2)
self.verticalLayout_9.addWidget(self.groupBox)
@@ -1053,7 +1189,7 @@ class Ui_MainWindow(object):
self.dockWidget_3.setWidget(self.dockWidgetContents_6)
MainWindow.addDockWidget(QtCore.Qt.DockWidgetArea(2), self.dockWidget_3)
self.menubar = QtGui.QMenuBar(MainWindow)
- self.menubar.setGeometry(QtCore.QRect(0, 0, 923, 24))
+ self.menubar.setGeometry(QtCore.QRect(0, 0, 982, 24))
self.menubar.setObjectName("menubar")
self.menuWelcome = QtGui.QMenu(self.menubar)
self.menuWelcome.setEnabled(True)
@@ -1179,17 +1315,16 @@ class Ui_MainWindow(object):
self.menubar.addAction(self.menuSystem.menuAction())
self.retranslateUi(MainWindow)
- self.tabWidget.setCurrentIndex(4)
+ self.tabWidget.setCurrentIndex(0)
self.tabWidget_2.setCurrentIndex(0)
QtCore.QObject.connect(self.actionExit, QtCore.SIGNAL("triggered()"), MainWindow.close)
QtCore.QMetaObject.connectSlotsByName(MainWindow)
-
#-------------
self.tabWidget.setCurrentIndex(0)
#set location column to 5, this is enough to hide it but still accessiable.
- self.tableWidget.horizontalHeader().resizeSection(4,5)
- self.tableWidget_2.horizontalHeader().resizeSection(4,5)
+ self.tableWidget.horizontalHeader().resizeSection(5,5)
+ self.tableWidget_2.horizontalHeader().resizeSection(5,5)
#set order column to 20 wide
self.tableWidget.horizontalHeader().resizeSection(0,20)
self.tableWidget_2.horizontalHeader().resizeSection(0,20)
@@ -1199,16 +1334,9 @@ class Ui_MainWindow(object):
self.thread_pkg_load = load_pkg_thread()
self.run_cmd_thread = run_cmd_thread()
self.upload_file_thread = run_cmd_thread()
-
+ self.createPkgListThread = create_pkglist_thread()
sys.stdout = OutLog(self.textEdit,out=sys.__stdout__)
sys.stderr = OutLog(self.textEdit,out=sys.__stdout__)
- #self.DLG = search.BookmarksDlg(['uno', 'dos'], None)
- #self.DLG.hide()
-
-
-
-
-
#enable/disable t
QtCore.QObject.connect(self.run_cmd_thread, QtCore.SIGNAL("enable_tab2(bool)"), self.enable_tab2)
@@ -1216,6 +1344,8 @@ class Ui_MainWindow(object):
QtCore.QObject.connect(self.run_cmd_thread, SIGNAL("finished()"), self.run_cmd_thread_finished)
QtCore.QObject.connect(self.upload_file_thread, SIGNAL("finished()"), self.upload_thread_finished)
+ QtCore.QObject.connect(self.createPkgListThread,SIGNAL("pkg_load_list_finished(bool)"), self.pkg_load_finished)
+ QtCore.QObject.connect(self.createPkgListThread,SIGNAL("insert_group(QString)"), self.insert_group)
#connect pkgload thread to insert item
QtCore.QObject.connect(self.thread_pkg_load, QtCore.SIGNAL("insertItem(PyQt_PyObject)"), self.insert_item)
@@ -1269,6 +1399,7 @@ class Ui_MainWindow(object):
QtCore.QObject.connect(self.thread,QtCore.SIGNAL("update_progress_bar(int)"),self.update_progress_bar)
QtCore.QObject.connect(self.thread_pkg_load, QtCore.SIGNAL("update_progress_bar_ABS(float)"),self.update_progress_bar_abs)
QtCore.QObject.connect(self.thread_pkg_load, QtCore.SIGNAL("update_progress_bar(float)"),self.update_progress_bar)
+ QtCore.QObject.connect(self.createPkgListThread, QtCore.SIGNAL("update_progress_bar(float)"),self.update_progress_bar)
QtCore.QObject.connect(self.thread_pkg_load, QtCore.SIGNAL("pkg_load_skipped(PyQt_PyObject)"), self.print_skipped_pkg)
@@ -1296,8 +1427,6 @@ class Ui_MainWindow(object):
QtCore.QObject.connect(self.toolButton_7, QtCore.SIGNAL("clicked()"), self.open_copy_location)
QtCore.QObject.connect(self.toolButton_8, QtCore.SIGNAL("clicked()"), self.select_profile_dir)
-
-
#Top menu actions
QtCore.QObject.connect(self.actionSave_output_window_to_file, QtCore.SIGNAL("triggered()"), self.save_text_to_file)
QtCore.QObject.connect(self.actionLoad_configuration_file, QtCore.SIGNAL("triggered()"), self.load_settings_from_file)
@@ -1343,18 +1472,27 @@ class Ui_MainWindow(object):
QtCore.QObject.connect(self.buttonBox, QtCore.SIGNAL("clicked(QAbstractButton*)"), self.show_which_button)
QtCore.QObject.connect(self.toolButton_4, QtCore.SIGNAL("clicked()"), self.select_newpkg_dir)
-
#misc screen
QtCore.QObject.connect(self.pushButton_sync, QtCore.SIGNAL("clicked()"), self.run_sync)
QtCore.QObject.connect(self.create_cd, QtCore.SIGNAL("clicked()"), self.createcd)
QtCore.QObject.connect(self.pushbutton_upload, QtCore.SIGNAL("clicked()"), self.upload_files)
+ def insert_group(self,g):
+ self.comboBox.addItem(g)
+
+ def pkg_load_finished(self):
+ global masterListPopulated
+ masterListPopulated=True
+ self.comboBox.addItem("All-stable")
+ self.comboBox.addItem("All-testing")
+ self.enable_table()
+
def clear_searchbox(self):
self.lineEdit_21.setText('')
+
def clear_searchbox_ABS(self):
self.lineEdit_20.setText('')
-
def searchRepoPkglist(self,textValue):
# print textValue
if textValue=='':
@@ -1391,8 +1529,6 @@ class Ui_MainWindow(object):
if self.tableWidget_2.horizontalScrollBar().value > 5:
self.tableWidget_2.horizontalScrollBar().setValue (0)
-
-
def show_search(self):
print "show"
self.DLG.show()
@@ -1463,7 +1599,6 @@ class Ui_MainWindow(object):
self.update_ouputwindow(line,PrintBoth)
def update_ouputwindow(self,line,PrintBoth=True):
-
self.textEdit.append(line)
if PrintBoth:
self.textEdit_dock.append(line)
@@ -1479,20 +1614,17 @@ class Ui_MainWindow(object):
self.update_ouputwindow(itemText)
self.showbox("Command", "Finished!",True)
-
def upload_thread_finished(self):
itemText="File upload finished"
self.update_ouputwindow(itemText)
self.showbox("File upload", "Finished!",True)
-
-
def print_finished_msg(self,Value):
outText="Finished Loading Packages!!"
self.update_ouputwindow(outText)
self.tableWidget.setSortingEnabled(True)
self.tableWidget_2.setSortingEnabled(True)
- columnlist=[1,2,3,5]
+ columnlist=[1,2,3,6]
for i in columnlist:
self.tableWidget.resizeColumnToContents(i)
self.tableWidget_2.resizeColumnToContents(i)
@@ -1513,7 +1645,6 @@ class Ui_MainWindow(object):
self.tabWidget_2.setEnabled(Value)
def disable_table(self):
-
self.tableWidget.setEnabled(False)
self.comboBox.setEnabled(False)
self.pushButton_8.setEnabled(False)
@@ -1521,7 +1652,6 @@ class Ui_MainWindow(object):
self.disable_go_button()
def enable_table(self):
-
self.tableWidget.setEnabled(True)
self.comboBox.setEnabled(True)
self.pushButton_8.setEnabled(True)
@@ -1536,7 +1666,6 @@ class Ui_MainWindow(object):
self.lineEdit_20.setEnabled(Value)
self.pushButton_2.setEnabled(Value)
-
def set_repo_box(self,Value):
self.comboBox.setEnabled(Value)
self.comboBox_2.setEnabled(Value)
@@ -1553,7 +1682,6 @@ class Ui_MainWindow(object):
self.tableWidget_2.setEnabled(True)
self.comboBox_2.setEnabled(True)
-
def update_status_cell(self,itemrow,itemText,status,itemcol):
item = self.tableWidget.item(itemrow,itemcol)
self.tableWidget.setItemSelected (item, False)
@@ -1571,9 +1699,29 @@ class Ui_MainWindow(object):
pkgversion=itemTextList[1]
pkglocation = itemTextList[3]
pkgdescription=itemTextList[4]
+ pkggroup=itemTextList[5]
+ pkgtooltip=pkgdescription
+ if pkggroup:
+ pkgtooltip+="Groups: "
+ pkgloc=[]
+ pkglist=[]
+ pkgloc.append(pkgname.strip())
+ pkgloc.append(pkglocation)
+ #print pkgloc
+ #for i in pkggroup:
+ #pkglist=[]
+ #pkg_group_name="%s/pkg_group_%s.group" %(self.all_settings['group_file_location'],i)
+ #pkgtuple=(pkgname.strip(),pkglocation)
+ #pkglist.append(pkgtuple)
+ ##pkglist.append(pkgname)
+ #pkglist.append(pkgloc)
+ #self.addPkgGroup(pkg_group_name,pkglist)
+ #pkgtooltip+=" "
+ #pkgtooltip+= i
+# print pkggroup
itr = self.tableWidget.rowCount()
self.tableWidget.insertRow(itr)
- for i in range(0,6):
+ for i in range(0,7):
item = QtGui.QTableWidgetItem()
item.setToolTip(pkgdescription)
item.setFlags(Qt.ItemIsUserCheckable |
@@ -1591,9 +1739,10 @@ class Ui_MainWindow(object):
self.tableWidget.item(itr,1).setText(pkgname)
self.tableWidget.item(itr,2).setText(pkgversion)
self.tableWidget.item(itr,3).setText("-")
- self.tableWidget.item(itr,4).setText(pkglocation)
- self.tableWidget.item(itr,5).setText(pkgdescription)
- self.tableWidget.item(itr,5).setToolTip(pkgdescription)
+ self.tableWidget.item(itr,4).setText(",".join(pkggroup))
+ self.tableWidget.item(itr,5).setText(pkglocation)
+ self.tableWidget.item(itr,6).setText(pkgdescription)
+ self.tableWidget.item(itr,6).setToolTip(pkgtooltip)
self.updateLCDtotal_pkg()
def insert_item_ABS(self,itemTextList):
@@ -1601,9 +1750,19 @@ class Ui_MainWindow(object):
pkgversion=itemTextList[1]
pkglocation = itemTextList[3]
pkgdescription=itemTextList[4]
+ pkggroup=itemTextList[5]
+ pkgtooltip=pkgdescription
+ if pkggroup:
+ pkgtooltip+="Groups: "
+ pkgloc=[]
+ pkglist=[]
+ pkgloc.append(pkgname.strip())
+ pkgloc.append(pkglocation)
+
+
itr = self.tableWidget_2.rowCount()
self.tableWidget_2.insertRow(itr)
- for i in range(0,6):
+ for i in range(0,7):
item = QtGui.QTableWidgetItem()
item.setToolTip(pkgdescription)
item.setFlags(Qt.ItemIsUserCheckable |
@@ -1619,8 +1778,9 @@ class Ui_MainWindow(object):
self.tableWidget_2.item(itr,1).setText(pkgname)
self.tableWidget_2.item(itr,2).setText(pkgversion)
self.tableWidget_2.item(itr,3).setText("-")
- self.tableWidget_2.item(itr,4).setText(pkglocation)
- self.tableWidget_2.item(itr,5).setText(pkgdescription)
+ self.tableWidget_2.item(itr,4).setText(",".join(pkggroup))
+ self.tableWidget_2.item(itr,5).setText(pkglocation)
+ self.tableWidget_2.item(itr,6).setText(pkgdescription)
self.updateLCDtotal_ABS()
def populate_pkg_list(self,repo_value):
@@ -1633,11 +1793,17 @@ class Ui_MainWindow(object):
self.tableWidget.clearContents()
self.tableWidget.setSortingEnabled(False)
self.tableWidget.setRowCount(0)
- filename = self.all_settings['group_file_location'] + "/" + repo_value + ".group"
- outtext="Loading package list from %s" %filename
- self.update_ouputwindow(outtext)
- self.thread_pkg_load.value_init(filename,self.all_settings['repo_location'],"mainrepo")
- headers=[".","Name", "Version", "Status" , "Location", "Description"]
+
+ if masterListPopulated:
+ outtext="Loading package list from memory"
+ self.update_ouputwindow(outtext)
+ self.thread_pkg_load.value_init(repo_value,self.all_settings['repo_location'],"mainrepo")
+ else:
+ filename = self.all_settings['group_file_location'] + "/" + repo_value + ".group"
+ outtext="Loading package list from %s" %filename
+ self.update_ouputwindow(outtext)
+ self.thread_pkg_load.value_init(filename,self.all_settings['repo_location'],"mainrepo")
+ headers=[".","Name", "Version", "Status" ,"Group", "Location", "Description"]
self.tableWidget.setHorizontalHeaderLabels(headers)
def populate_abs_pkg_list(self,abs_repo_value):
@@ -1655,7 +1821,7 @@ class Ui_MainWindow(object):
outtext="Loading package list from %s" %filename
self.update_ouputwindow(outtext)
self.thread_pkg_load.value_init(filename,self.all_settings['abs_location'],"ABS")
- headers=[".","Name", "Version", "Status" , "Location", "Description"]
+ headers=[".","Name", "Version", "Status" ,"Group", "Location", "Description"]
self.tableWidget_2.setHorizontalHeaderLabels(headers)
def select_all(self):
@@ -1670,14 +1836,11 @@ class Ui_MainWindow(object):
total_rows = self.tableWidget_2.rowCount()
self.tableWidget_2.setRangeSelected(QtGui.QTableWidgetSelectionRange(0, 1, total_rows-1, 1), False)
-
def onIndexChanged(self, index):
global repo_value
repo_value = index
self.tableWidget.clear()
if repo_value:
- t=repo_value,
- #thread.start_new_thread(self.populate_pkg_list, (t))
self.populate_pkg_list(repo_value)
def onIndexChanged_ABS(self, index):
@@ -1685,8 +1848,6 @@ class Ui_MainWindow(object):
ABS_repo_value = index
self.tableWidget_2.clear()
if ABS_repo_value:
- t=ABS_repo_value,
- #thread.start_new_thread(self.populate_abs_pkg_list, (t))
self.populate_abs_pkg_list(ABS_repo_value)
def showbox(self,title,message,Modal=True):
@@ -1696,15 +1857,7 @@ class Ui_MainWindow(object):
self.msgbox.setText(message)
self.msgbox.setModal(Modal)
self.msgbox.show()
- #ialog.setModal (self, bool modal)
- #QMessageBox.information(None,title,message)
- #Dialog.setModal (self, bool modal)
- #msgbox = QMessageBox
- #msgBox.setText("The document has been modified.")
- #msgBox.setInformativeText("Do you want to save your changes?")
- #msgBox.setStandardButtons(QMessageBox.Save | QMessageBox.Discard | QMessageBox.Cancel)
- ##msgBox.setDefaultButton(QMessageBox.Save);
- #msgBox.exec
+
def show_yes_no_box(self,title,message,Modal=True):
self.Modal=Modal
self.msgyesbox = QtGui.QMessageBox()
@@ -1713,15 +1866,11 @@ class Ui_MainWindow(object):
self.msgyesbox.setModal(Modal)
self.msgyesbox.setStandardButtons(QMessageBox.Yes | QMessageBox.No);
self.msgyesbox.setDefaultButton(QMessageBox.Save);
- #int ret = self.msgyesbox.exec();
-
if self.msgyesbox.exec_() == 16384 :
return True
else:
return False
-
-
def buttonpushed(self):
itemlist=self.tableWidget.selectedItems()
makepkg_list=[]
@@ -1744,16 +1893,24 @@ class Ui_MainWindow(object):
def populate_group_box(self):
postfix=".group"
+ grouplist=[]
dir_list = os.listdir(self.all_settings['group_file_location'])
self.comboBox.clear()
+ self.comboBox.setInsertPolicy(6)
self.comboBox.setEnabled(False)
for file in dir_list:
if os.path.isfile(self.all_settings['group_file_location']+"/"+file):
if file.endswith(postfix) and not file.startswith("ABS"):
groupname = file[:-len(postfix)]
- self.comboBox.addItem(groupname)
+ grouplist.append(groupname)
#self.comboBox.setCurrentIndex(1)
+ grouplist.sort()
+ for g in grouplist:
+ self.comboBox.addItem(g)
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'])
def populate_abs_group_box(self):
postfix=".group"
@@ -1849,9 +2006,6 @@ class Ui_MainWindow(object):
os.chdir("..")
self.populate_abs_group_box()
-
-
-
def disable_go_button(self):
self.pushButton_go.setEnabled(False)
self.pushButton_stop.setEnabled(True)
@@ -1916,35 +2070,6 @@ class Ui_MainWindow(object):
pass
return False
- #def search_group_file(self,groupfile,spackage):
- ##"""
- ## Searches group file for matching spackage name.
- ## Returns False if the file was not found.
- ##"""
- #filename = bld_config.repo_location + "/" + groupfile + ".group"
- #try:
- #f = open(filename,"r")
- #file_contents = f.readlines()
- #f.close()
- #except:
- #outText = "couldn't open file to search: %s " %filename
- #self.update_ouputwindow(outText)
- #return False
- #for line in file_contents:
- #currentdir = "%s/%s" %(bld_config.repo_location,line.strip())
- #currentfile = "%s/PKGBUILD" %(currentdir)
- #if os.path.isfile(currentfile):
- #try:
- #package = parched.PKGBUILD(currentfile)
- #pkgname = str(package.name)
- #pkgversion = str(package.version)
- #pkgdescription = str(package.description)
- #if pkgname == spackage:
- #return currentdir
- #except:
- #continue
- #return False
-
def runcmd_thread(self,cmd):
os.system(cmd)
@@ -2077,9 +2202,10 @@ class Ui_MainWindow(object):
group = "%s/adHoc.group" %self.all_settings['group_file_location']
self.addPkgGroup(group)
- def addPkgGroup(self,group=None):
+ def addPkgGroup(self,group=None,dir_list=None):
groupname = group
- dir_list = self.find_pkgdir()
+ if dir_list == None:
+ dir_list = self.find_pkgdir()
if groupname == None:
options = QtGui.QFileDialog.Options()
options |= QtGui.QFileDialog.DontUseNativeDialog
@@ -2094,16 +2220,19 @@ class Ui_MainWindow(object):
self.update_ouputwindow(outtext)
return
filename = groupname
+ print filename
try:
f = open(filename,"a")
except:
outtext="Couldn't open file for writing: %s" %filename
print outtext
return False
- print filename
+
for item,dir in dir_list:
- itemText= str(item.text())
- print dir
+ if not type(item) == str:
+ itemText= str(item.text())
+ else:
+ itemText=item.strip()
location = dir.replace(self.all_settings["repo_location"]+"/", "")
outtext = "Adding %s to %s" %(location,group)
self.update_ouputwindow(outtext)
@@ -2111,12 +2240,6 @@ class Ui_MainWindow(object):
f.write("\n")
f.close()
-
-
-
-
-
-
def actionChangeLog(self):
dir_list = self.find_pkgdir()
for item,dir in dir_list:
@@ -2158,7 +2281,6 @@ class Ui_MainWindow(object):
cmd = cmd,
thread.start_new_thread(self.runcmd_thread, cmd)
-
def backupAction(self):
current_time=time.strftime("%Y-%m-%d_%H-%M-%S")
dir_list = self.find_pkgdir()
@@ -2202,7 +2324,6 @@ class Ui_MainWindow(object):
def updatepkg(self,item,dir):
#updates our pkg with the contents from abs
self.update_ouputwindow(sepLine)
-
pkgname = item.text()
itemrow = item.row()
itemcol = item.column()
@@ -2378,7 +2499,6 @@ class Ui_MainWindow(object):
def promote(self,prunedlist,dir):
-
for item in prunedlist:
itemText= str(item.text())
itemrow = item.row()
@@ -2426,8 +2546,6 @@ class Ui_MainWindow(object):
self.update_ouputwindow(outtext)
return True
-
-
def promoteAction(self):
self.update_ouputwindow(sepLine)
self.disable_table()
@@ -2504,9 +2622,6 @@ class Ui_MainWindow(object):
if dir:
self.lineEdit_19.setText(dir)
-
-
-
def select_newpkg_dir(self):
dir = self.getExistingDirectory("Location to create new packages.",self.all_settings['repo_location'])
if dir:
@@ -2659,8 +2774,6 @@ class Ui_MainWindow(object):
outtext = "Could not create group: %s" %(text)
self.update_ouputwindow(outtext)
-
-
def updateSystem(self):
runcmd="pacman"
cmdargs=["-Su","--noconfirm"]
@@ -2672,8 +2785,6 @@ class Ui_MainWindow(object):
def switch_pacman_to_remote(self):
print "switch to remote"
-
-
def save_config_settings(self):
from __main__ import settings_dict
homedir = os.path.expanduser("~")
@@ -2750,9 +2861,7 @@ class Ui_MainWindow(object):
if self.checkBox_ignore.isChecked():
mp_arg_list.append("-d")
return mp_arg_list
-
-#---
-
+#--------------------------------------------------------------
def retranslateUi(self, MainWindow):
MainWindow.setWindowTitle(QtGui.QApplication.translate("MainWindow", "BLD", None, QtGui.QApplication.UnicodeUTF8))
@@ -2772,8 +2881,9 @@ class Ui_MainWindow(object):
self.tableWidget.horizontalHeaderItem(1).setText(QtGui.QApplication.translate("MainWindow", "Name", None, QtGui.QApplication.UnicodeUTF8))
self.tableWidget.horizontalHeaderItem(2).setText(QtGui.QApplication.translate("MainWindow", "Version", None, QtGui.QApplication.UnicodeUTF8))
self.tableWidget.horizontalHeaderItem(3).setText(QtGui.QApplication.translate("MainWindow", "Status", None, QtGui.QApplication.UnicodeUTF8))
- self.tableWidget.horizontalHeaderItem(4).setText(QtGui.QApplication.translate("MainWindow", "Location", None, QtGui.QApplication.UnicodeUTF8))
- self.tableWidget.horizontalHeaderItem(5).setText(QtGui.QApplication.translate("MainWindow", "Description", None, QtGui.QApplication.UnicodeUTF8))
+ self.tableWidget.horizontalHeaderItem(4).setText(QtGui.QApplication.translate("MainWindow", "Group", None, QtGui.QApplication.UnicodeUTF8))
+ self.tableWidget.horizontalHeaderItem(5).setText(QtGui.QApplication.translate("MainWindow", "Location", None, QtGui.QApplication.UnicodeUTF8))
+ self.tableWidget.horizontalHeaderItem(6).setText(QtGui.QApplication.translate("MainWindow", "Description", None, QtGui.QApplication.UnicodeUTF8))
self.tabWidget.setTabText(self.tabWidget.indexOf(self.tab), QtGui.QApplication.translate("MainWindow", "Packages", None, QtGui.QApplication.UnicodeUTF8))
self.groupBox_14.setTitle(QtGui.QApplication.translate("MainWindow", "Profiles", None, QtGui.QApplication.UnicodeUTF8))
self.create_cd.setText(QtGui.QApplication.translate("MainWindow", "Create CD", None, QtGui.QApplication.UnicodeUTF8))
@@ -2819,8 +2929,9 @@ class Ui_MainWindow(object):
self.tableWidget_2.horizontalHeaderItem(1).setText(QtGui.QApplication.translate("MainWindow", "Name", None, QtGui.QApplication.UnicodeUTF8))
self.tableWidget_2.horizontalHeaderItem(2).setText(QtGui.QApplication.translate("MainWindow", "Version", None, QtGui.QApplication.UnicodeUTF8))
self.tableWidget_2.horizontalHeaderItem(3).setText(QtGui.QApplication.translate("MainWindow", "Status", None, QtGui.QApplication.UnicodeUTF8))
- self.tableWidget_2.horizontalHeaderItem(4).setText(QtGui.QApplication.translate("MainWindow", "Location", None, QtGui.QApplication.UnicodeUTF8))
- self.tableWidget_2.horizontalHeaderItem(5).setText(QtGui.QApplication.translate("MainWindow", "Description", None, QtGui.QApplication.UnicodeUTF8))
+ self.tableWidget_2.horizontalHeaderItem(4).setText(QtGui.QApplication.translate("MainWindow", "Group", None, QtGui.QApplication.UnicodeUTF8))
+ self.tableWidget_2.horizontalHeaderItem(5).setText(QtGui.QApplication.translate("MainWindow", "Location", None, QtGui.QApplication.UnicodeUTF8))
+ self.tableWidget_2.horizontalHeaderItem(6).setText(QtGui.QApplication.translate("MainWindow", "Description", None, QtGui.QApplication.UnicodeUTF8))
self.tabWidget.setTabText(self.tabWidget.indexOf(self.tab_5), QtGui.QApplication.translate("MainWindow", "Copy from ABS", None, QtGui.QApplication.UnicodeUTF8))
self.toolButton_3.setText(QtGui.QApplication.translate("MainWindow", "...", None, QtGui.QApplication.UnicodeUTF8))
self.toolButton_2.setText(QtGui.QApplication.translate("MainWindow", "...", None, QtGui.QApplication.UnicodeUTF8))
@@ -2922,6 +3033,6 @@ class Ui_MainWindow(object):
self.actionInstall_all_updates.setText(QtGui.QApplication.translate("MainWindow", "System update", None, QtGui.QApplication.UnicodeUTF8))
self.actionSwitch_to_local.setText(QtGui.QApplication.translate("MainWindow", "Switch to local", None, QtGui.QApplication.UnicodeUTF8))
self.actionSwitch_to_remote.setText(QtGui.QApplication.translate("MainWindow", "Switch to remote", None, QtGui.QApplication.UnicodeUTF8))
- self.actionClear_Adhoc_Group.setText(QtGui.QApplication.translate("MainWindow", "Clear Adhoc Group", None, QtGui.QApplication.UnicodeUTF8))
+ self.actionClear_Adhoc_Group.setText(QtGui.QApplication.translate("MainWindow", "Clear Adhoc Groupe", None, QtGui.QApplication.UnicodeUTF8))
self.actionCreate_Group.setText(QtGui.QApplication.translate("MainWindow", "Create Group", None, QtGui.QApplication.UnicodeUTF8))