diff options
Diffstat (limited to 'build_tools')
-rw-r--r-- | build_tools/bin/bld_resource.py | 161 |
1 files changed, 135 insertions, 26 deletions
diff --git a/build_tools/bin/bld_resource.py b/build_tools/bin/bld_resource.py index 5d08985..f5fd898 100644 --- a/build_tools/bin/bld_resource.py +++ b/build_tools/bin/bld_resource.py @@ -44,6 +44,7 @@ bld_data="%s/.bld_session_data" %homedir print bld_data + class OutLog: def __init__(self, edit, out=None, color=None): """(edit, out=None, color=None) -> can write stdout, stderr to a @@ -79,21 +80,29 @@ class TableWidget(QTableWidget): menu = QMenu(self) # quitAction = menu.addAction("Quit") - editAction = menu.addAction("Edit PKGBUILD") - backupAction = menu.addAction("Backup PKGBUILD") + editAction = menu.addAction("Edit PKGBUILD") + backupAction = menu.addAction("Backup PKGBUILD") + emptyActon = menu.addAction("==================") + makepkgAction = menu.addAction("Make packages") + emptyActon = menu.addAction("==================") + menu.addSeparator() + xtermAction = menu.addAction("Open terminal here") + exploreAction = menu.addAction("Open File browser here") + menu.addSeparator() changeLogAction = menu.addAction("View changelog") - buildLogAction = menu.addAction("View buildlog") + buildLogAction = menu.addAction("View buildlog") + emptyActon = menu.addAction("==================") + adHocAction = menu.addAction("Add to adhoc group") + emptyActon = menu.addAction("==================") + addgroupAction = menu.addAction("Add to group") menu.addSeparator() - xtermAction = menu.addAction("Open terminal here") - exploreAction = menu.addAction("Open File browser here") + promoteAction = menu.addAction("Promote package") + updateAction = menu.addAction("Update pkg from ABS") + md5Action = menu.addAction("Generate MD5 sums") menu.addSeparator() - promoteAction = menu.addAction("Promote package") - updateAction = menu.addAction("Update pkg from ABS") - #depAction = menu.addAction("Check package for dependencies") - md5Action = menu.addAction("Generate MD5 sums") - removeAction = menu.addAction("Remove package") + removeAction = menu.addAction("Remove package") menu.addSeparator() - resetStatus = menu.addAction("Reset status") + resetStatus = menu.addAction("Reset status") resetBuildOrder = menu.addAction("Reset build order") action = menu.exec_(self.mapToGlobal(event.pos())) @@ -101,26 +110,30 @@ class TableWidget(QTableWidget): # qApp.quit() if action == editAction: self.emit(QtCore.SIGNAL('edit()')) - if action == changeLogAction: - self.emit(QtCore.SIGNAL('changeLogAction()')) - if action == buildLogAction: - self.emit(QtCore.SIGNAL('buildLogAction()')) + if action == backupAction: + self.emit(QtCore.SIGNAL('backupAction()')) + if action == makepkgAction: + self.emit(QtCore.SIGNAL("makepkg()")) if action == xtermAction: self.emit(QtCore.SIGNAL('launchxterm()')) if action == exploreAction: self.emit(QtCore.SIGNAL('exploreAction()')) - if action == backupAction: - self.emit(QtCore.SIGNAL('backupAction()')) + if action == changeLogAction: + self.emit(QtCore.SIGNAL('changeLogAction()')) + if action == buildLogAction: + self.emit(QtCore.SIGNAL('buildLogAction()')) + if action == adHocAction: + self.emit(QtCore.SIGNAL('adHocAction()')) + if action ==addgroupAction : + self.emit(QtCore.SIGNAL('addgroupAction()')) + if action == promoteAction: + self.emit(QtCore.SIGNAL('promoteAction()')) if action == updateAction: self.emit(QtCore.SIGNAL('updateAction()')) - #if action == depAction: - # self.emit(QtCore.SIGNAL('depAction()')) if action == md5Action: self.emit(QtCore.SIGNAL('MD5Action()')) if action == removeAction: self.emit(QtCore.SIGNAL('removeAction()')) - if action == promoteAction: - self.emit(QtCore.SIGNAL('promoteAction()')) if action == resetStatus: self.resetstatus() if action == resetBuildOrder: @@ -550,7 +563,7 @@ class Ui_MainWindow(object): self.horizontalLayout_5.setSpacing(0) self.horizontalLayout_5.setMargin(0) self.horizontalLayout_5.setObjectName("horizontalLayout_5") - self.tableWidget =TableWidget(self.groupBox_6) + self.tableWidget = TableWidget(self.groupBox_6) self.tableWidget.setAutoFillBackground(True) self.tableWidget.setFrameShape(QtGui.QFrame.StyledPanel) self.tableWidget.setFrameShadow(QtGui.QFrame.Sunken) @@ -564,7 +577,7 @@ class Ui_MainWindow(object): self.tableWidget.setAlternatingRowColors(True) self.tableWidget.setSelectionBehavior(QtGui.QAbstractItemView.SelectRows) self.tableWidget.setGridStyle(QtCore.Qt.SolidLine) - self.tableWidget.setCornerButtonEnabled(True) + self.tableWidget.setCornerButtonEnabled(False) self.tableWidget.setObjectName("tableWidget") self.tableWidget.setColumnCount(6) self.tableWidget.setRowCount(0) @@ -824,6 +837,7 @@ class Ui_MainWindow(object): self.tableWidget_2.setEditTriggers(QtGui.QAbstractItemView.NoEditTriggers) self.tableWidget_2.setSelectionBehavior(QtGui.QAbstractItemView.SelectRows) 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.setRowCount(0) @@ -1120,6 +1134,10 @@ class Ui_MainWindow(object): self.actionSwitch_to_local.setObjectName("actionSwitch_to_local") self.actionSwitch_to_remote = QtGui.QAction(MainWindow) self.actionSwitch_to_remote.setObjectName("actionSwitch_to_remote") + self.actionClear_Adhoc_Group = QtGui.QAction(MainWindow) + self.actionClear_Adhoc_Group.setObjectName("actionClear_Adhoc_Group") + self.actionCreate_Group = QtGui.QAction(MainWindow) + self.actionCreate_Group.setObjectName("actionCreate_Group") self.menuWelcome.addAction(self.action_Save_make_package_options) self.menuWelcome.addAction(self.actionSave_All_options_including_make_package_option) self.menuWelcome.addSeparator() @@ -1139,17 +1157,25 @@ class Ui_MainWindow(object): self.menuRepository_2.addAction(self.actionReload_ABS_Group_packages) self.menuRepository_2.addSeparator() self.menuRepository_2.addSeparator() + self.menuRepository_2.addSeparator() self.menuRepository_2.addAction(self.actionRemove_Group) self.menuRepository_2.addSeparator() self.menuRepository_2.addSeparator() + self.menuRepository_2.addAction(self.actionCreate_Group) + self.menuRepository_2.addSeparator() + self.menuRepository_2.addSeparator() + self.menuRepository_2.addSeparator() + self.menuRepository_2.addAction(self.actionClear_Adhoc_Group) self.menuSystem.addAction(self.actionRefresh_database) self.menuSystem.addAction(self.actionInstall_all_updates) + self.menuSystem.addSeparator() self.menuSystem.addAction(self.actionSwitch_to_local) self.menuSystem.addAction(self.actionSwitch_to_remote) + self.menuSystem.addSeparator() self.menubar.addAction(self.menuWelcome.menuAction()) + self.menubar.addAction(self.menuAbout.menuAction()) self.menubar.addAction(self.menuRepository_2.menuAction()) self.menubar.addAction(self.menuSystem.menuAction()) - self.menubar.addAction(self.menuAbout.menuAction()) self.retranslateUi(MainWindow) self.tabWidget.setCurrentIndex(4) @@ -1159,7 +1185,6 @@ class Ui_MainWindow(object): #------------- - self.tabWidget.setCurrentIndex(0) #set location column to 5, this is enough to hide it but still accessiable. self.tableWidget.horizontalHeader().resizeSection(4,5) @@ -1208,6 +1233,7 @@ class Ui_MainWindow(object): # makepkg button QtCore.QObject.connect(self.pushButton_go, QtCore.SIGNAL("clicked()"), self.buttonpushed) + QtCore.QObject.connect(self.tableWidget, QtCore.SIGNAL("makepkg()"), self.buttonpushed) #stop button QtCore.QObject.connect(self.pushButton_stop, QtCore.SIGNAL("clicked()"), self.thread.toggle) #thow text to output window @@ -1257,6 +1283,8 @@ class Ui_MainWindow(object): QtCore.QObject.connect(self.tableWidget, QtCore.SIGNAL('MD5Action()'), self.MD5Action ) QtCore.QObject.connect(self.tableWidget, QtCore.SIGNAL('removeAction()'), self.removepkg ) QtCore.QObject.connect(self.tableWidget, QtCore.SIGNAL('promoteAction()'), self.promoteAction ) + QtCore.QObject.connect(self.tableWidget, QtCore.SIGNAL('adHocAction()'), self.addPkgAdhoc ) + QtCore.QObject.connect(self.tableWidget, QtCore.SIGNAL('addgroupAction()'), self.addPkgGroup ) #ABS TABLE ACTIONS QtCore.QObject.connect(self.tableWidget_2 , QtCore.SIGNAL('viewActionABS()') , self.viewABSAction) QtCore.QObject.connect(self.tableWidget_2 ,QtCore.SIGNAL('launchxtermABS()'), self.launchxtermABSAction) @@ -1281,6 +1309,9 @@ class Ui_MainWindow(object): QtCore.QObject.connect(self.actionInstall_all_updates, QtCore.SIGNAL("triggered()"), self.updateSystem) QtCore.QObject.connect(self.actionSwitch_to_local, QtCore.SIGNAL("triggered()"), self.switch_pacman_to_loca) QtCore.QObject.connect(self.actionSwitch_to_remote, QtCore.SIGNAL("triggered()"), self.switch_pacman_to_remote) + QtCore.QObject.connect(self.actionClear_Adhoc_Group, QtCore.SIGNAL("triggered()"), self.clearAdhoc) + QtCore.QObject.connect(self.actionCreate_Group, QtCore.SIGNAL("triggered()"), self.createGroup) + #reload group boxes QtCore.QObject.connect(self.actionReload_Group_packages, QtCore.SIGNAL("triggered()"), self.populate_group_box) @@ -1672,6 +1703,20 @@ class Ui_MainWindow(object): #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() + self.msgyesbox.setWindowTitle(title) + self.msgyesbox.setText(message) + 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 @@ -2026,12 +2071,63 @@ class Ui_MainWindow(object): self.update_ouputwindow(outtext) self.showbox("Error",outtext) + def addPkgAdhoc(self): + group = "%s/adHoc.group" %self.all_settings['group_file_location'] + self.addPkgGroup(group) + + def addPkgGroup(self,group=None): + groupname = group + dir_list = self.find_pkgdir() + if groupname == None: + options = QtGui.QFileDialog.Options() + options |= QtGui.QFileDialog.DontUseNativeDialog + selectedFilter = QtCore.QString() + groupname = QtGui.QFileDialog.getOpenFileName(QtGui.QFileDialog(), + "Select Group File", + self.all_settings['group_file_location'], + "Text Files (*.group);;All Files (*)", selectedFilter, + options) + if groupname.isEmpty(): + outtext="No group file was selected" + self.update_ouputwindow(outtext) + return + filename = groupname + 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 + location = dir.replace(self.all_settings["repo_location"]+"/", "") + outtext = "Adding %s to %s" %(location,group) + self.update_ouputwindow(outtext) + f.write(location) + f.write("\n") + f.close() + + + + + + def actionChangeLog(self): dir_list = self.find_pkgdir() for item,dir in dir_list: itemText= str(item.text()) filename = "%s/__changelog" %(dir) + if not os.path.exists(filename): + rc = self.show_yes_no_box("", "__changelog not found, create the file?") + if rc: + cmd="touch %s" %filename + os.system(cmd) + else: + return + if os.path.exists(filename): cmd = "%s %s" %(self.all_settings['editor'], filename) self.update_ouputwindow(cmd) @@ -2538,6 +2634,18 @@ class Ui_MainWindow(object): cmdargs=["-Sy"] self.run_cmd_thread.value_init(runcmd,cmdargs) + def clearAdhoc(self): + fileName = "%s/adHoc.group" %self.all_settings['group_file_location'] + try: + os.remove(fileName) + outtext="Removed: %s\n Reloading group box" %fileName + except Exception, reason: + outtext = "Couldn't clear %s\n \t Reason: %s" %(fileName,reason) + self.update_ouputwindow(outtext) + self.populate_group_box() + + def createGroup(self): + print "creating group" def updateSystem(self): runcmd="pacman" @@ -2800,5 +2908,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.actionCreate_Group.setText(QtGui.QApplication.translate("MainWindow", "Create Group", None, QtGui.QApplication.UnicodeUTF8)) |