"header": {
"comment": "eric project file for project QtGentools",
"copyright": "Copyright (C) 2021 Andrew Foster, qtgentools@liquid.me.uk",
- "saved": "2021-06-30, 00:16:36"
+ "saved": "2021-06-30, 08:26:38"
},
"project": {
"AUTHOR": "Andrew Foster",
"README.*": "OTHERS",
"makefile": "OTHERS"
},
- "FORMS": [],
+ "FORMS": [
+ "ui/mainwindow.ui"
+ ],
"HASH": "d281728577b1da42b1c49d27174d437ec65311a5",
"IDLPARAMS": {
"DefinedNames": [],
"RESOURCES": [],
"SOURCES": [
"__init__.py",
- "qtgentools.py"
+ "qtgentools.py",
+ "ui/Ui_mainwindow.py",
+ "ui/mainwindow.py"
],
"SPELLEXCLUDES": "",
"SPELLLANGUAGE": "",
+#!/usr/bin/env python
+from PyQt5 import QtWidgets
+from ui.mainwindow import MainWindow
+
+if __name__ == "__main__":
+ import sys
+ app = QtWidgets.QApplication(sys.argv)
+ ui = MainWindow()
+ ui.show()
+ sys.exit(app.exec_())
+
class Ui_MainWindow(object):
def setupUi(self, MainWindow):
MainWindow.setObjectName("MainWindow")
- MainWindow.resize(714, 450)
+ MainWindow.resize(685, 452)
self.centralWidget = QtWidgets.QWidget(MainWindow)
self.centralWidget.setObjectName("centralWidget")
self.gridLayout_2 = QtWidgets.QGridLayout(self.centralWidget)
self.s_tv_results.setAlternatingRowColors(True)
self.s_tv_results.setSelectionMode(QtWidgets.QAbstractItemView.NoSelection)
self.s_tv_results.setSelectionBehavior(QtWidgets.QAbstractItemView.SelectItems)
- self.s_tv_results.setSortingEnabled(True)
+ self.s_tv_results.setSortingEnabled(False)
self.s_tv_results.setWordWrap(False)
self.s_tv_results.setObjectName("s_tv_results")
- self.s_tv_results.header().setSortIndicatorShown(True)
+ self.s_tv_results.header().setCascadingSectionResizes(False)
+ self.s_tv_results.header().setSortIndicatorShown(False)
+ self.s_tv_results.header().setStretchLastSection(True)
self.gridLayout.addWidget(self.s_tv_results, 3, 0, 1, 11)
self.verticalLayout_4 = QtWidgets.QVBoxLayout()
self.verticalLayout_4.setObjectName("verticalLayout_4")
self.tw_1.addTab(self.tab_search, "")
self.tab_depgraph = QtWidgets.QWidget()
self.tab_depgraph.setObjectName("tab_depgraph")
- self.gridLayout_3 = QtWidgets.QGridLayout(self.tab_depgraph)
- self.gridLayout_3.setObjectName("gridLayout_3")
+ self.gridLayout_4 = QtWidgets.QGridLayout(self.tab_depgraph)
+ self.gridLayout_4.setObjectName("gridLayout_4")
self.d_rb_select = QtWidgets.QRadioButton(self.tab_depgraph)
self.d_rb_select.setChecked(True)
self.d_rb_select.setObjectName("d_rb_select")
- self.gridLayout_3.addWidget(self.d_rb_select, 0, 0, 1, 1)
+ self.gridLayout_4.addWidget(self.d_rb_select, 0, 0, 1, 1)
self.d_cb_category = QtWidgets.QComboBox(self.tab_depgraph)
self.d_cb_category.setObjectName("d_cb_category")
self.d_cb_category.addItem("")
- self.gridLayout_3.addWidget(self.d_cb_category, 0, 1, 1, 2)
+ self.gridLayout_4.addWidget(self.d_cb_category, 0, 1, 1, 1)
self.d_cb_package = QtWidgets.QComboBox(self.tab_depgraph)
self.d_cb_package.setObjectName("d_cb_package")
self.d_cb_package.addItem("")
- self.gridLayout_3.addWidget(self.d_cb_package, 0, 3, 1, 1)
+ self.gridLayout_4.addWidget(self.d_cb_package, 0, 2, 1, 1)
self.d_cb_version = QtWidgets.QComboBox(self.tab_depgraph)
self.d_cb_version.setObjectName("d_cb_version")
self.d_cb_version.addItem("")
- self.gridLayout_3.addWidget(self.d_cb_version, 0, 4, 1, 1)
+ self.gridLayout_4.addWidget(self.d_cb_version, 0, 3, 1, 1)
+ self.gridLayout_3 = QtWidgets.QGridLayout()
+ self.gridLayout_3.setObjectName("gridLayout_3")
self.d_label_depth = QtWidgets.QLabel(self.tab_depgraph)
self.d_label_depth.setMaximumSize(QtCore.QSize(60, 16777215))
font = QtGui.QFont()
self.d_label_depth.setLayoutDirection(QtCore.Qt.LeftToRight)
self.d_label_depth.setAlignment(QtCore.Qt.AlignRight|QtCore.Qt.AlignTrailing|QtCore.Qt.AlignVCenter)
self.d_label_depth.setObjectName("d_label_depth")
- self.gridLayout_3.addWidget(self.d_label_depth, 0, 5, 1, 1)
+ self.gridLayout_3.addWidget(self.d_label_depth, 0, 0, 1, 1)
self.d_le_depth = QtWidgets.QLineEdit(self.tab_depgraph)
sizePolicy = QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.Preferred, QtWidgets.QSizePolicy.Fixed)
sizePolicy.setHorizontalStretch(0)
self.d_le_depth.setBaseSize(QtCore.QSize(30, 0))
self.d_le_depth.setInputMask("")
self.d_le_depth.setObjectName("d_le_depth")
- self.gridLayout_3.addWidget(self.d_le_depth, 0, 6, 1, 1)
- spacerItem3 = QtWidgets.QSpacerItem(50, 20, QtWidgets.QSizePolicy.Expanding, QtWidgets.QSizePolicy.Minimum)
- self.gridLayout_3.addItem(spacerItem3, 0, 7, 1, 1)
+ self.gridLayout_3.addWidget(self.d_le_depth, 0, 1, 1, 1)
+ self.d_ckb_installed = QtWidgets.QCheckBox(self.tab_depgraph)
+ self.d_ckb_installed.setObjectName("d_ckb_installed")
+ self.gridLayout_3.addWidget(self.d_ckb_installed, 1, 0, 1, 2)
+ self.gridLayout_4.addLayout(self.gridLayout_3, 0, 4, 2, 1)
+ spacerItem3 = QtWidgets.QSpacerItem(0, 48, QtWidgets.QSizePolicy.Expanding, QtWidgets.QSizePolicy.Minimum)
+ self.gridLayout_4.addItem(spacerItem3, 0, 5, 2, 1)
self.d_pb_calculate = QtWidgets.QPushButton(self.tab_depgraph)
self.d_pb_calculate.setObjectName("d_pb_calculate")
- self.gridLayout_3.addWidget(self.d_pb_calculate, 0, 8, 1, 2)
+ self.gridLayout_4.addWidget(self.d_pb_calculate, 0, 6, 1, 1)
self.d_rb_manual = QtWidgets.QRadioButton(self.tab_depgraph)
self.d_rb_manual.setObjectName("d_rb_manual")
- self.gridLayout_3.addWidget(self.d_rb_manual, 1, 0, 1, 1)
+ self.gridLayout_4.addWidget(self.d_rb_manual, 1, 0, 1, 1)
self.d_le_package = QtWidgets.QLineEdit(self.tab_depgraph)
self.d_le_package.setEnabled(False)
+ self.d_le_package.setText("")
+ self.d_le_package.setPlaceholderText("")
self.d_le_package.setObjectName("d_le_package")
- self.gridLayout_3.addWidget(self.d_le_package, 1, 1, 1, 4)
- self.d_ckb_installed = QtWidgets.QCheckBox(self.tab_depgraph)
- self.d_ckb_installed.setObjectName("d_ckb_installed")
- self.gridLayout_3.addWidget(self.d_ckb_installed, 1, 5, 1, 4)
+ self.gridLayout_4.addWidget(self.d_le_package, 1, 1, 1, 3)
+ spacerItem4 = QtWidgets.QSpacerItem(20, 18, QtWidgets.QSizePolicy.Minimum, QtWidgets.QSizePolicy.Fixed)
+ self.gridLayout_4.addItem(spacerItem4, 1, 6, 1, 1)
self.d_tv_results = QtWidgets.QTreeView(self.tab_depgraph)
sizePolicy = QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.MinimumExpanding, QtWidgets.QSizePolicy.Expanding)
sizePolicy.setHorizontalStretch(0)
self.d_tv_results.setSizePolicy(sizePolicy)
self.d_tv_results.setMinimumSize(QtCore.QSize(0, 250))
self.d_tv_results.setObjectName("d_tv_results")
- self.gridLayout_3.addWidget(self.d_tv_results, 2, 0, 1, 10)
+ self.gridLayout_4.addWidget(self.d_tv_results, 2, 0, 1, 7)
self.d_pbar = QtWidgets.QProgressBar(self.tab_depgraph)
self.d_pbar.setProperty("value", 0)
self.d_pbar.setTextVisible(True)
self.d_pbar.setFormat("")
self.d_pbar.setObjectName("d_pbar")
- self.gridLayout_3.addWidget(self.d_pbar, 3, 0, 1, 10)
+ self.gridLayout_4.addWidget(self.d_pbar, 3, 0, 1, 7)
+ self.gridLayout_7 = QtWidgets.QGridLayout()
+ self.gridLayout_7.setObjectName("gridLayout_7")
self.d_pb_expand = QtWidgets.QPushButton(self.tab_depgraph)
self.d_pb_expand.setObjectName("d_pb_expand")
- self.gridLayout_3.addWidget(self.d_pb_expand, 4, 0, 1, 1)
+ self.gridLayout_7.addWidget(self.d_pb_expand, 0, 0, 1, 1)
self.d_pb_collapse = QtWidgets.QPushButton(self.tab_depgraph)
self.d_pb_collapse.setObjectName("d_pb_collapse")
- self.gridLayout_3.addWidget(self.d_pb_collapse, 4, 1, 1, 1)
- spacerItem4 = QtWidgets.QSpacerItem(372, 27, QtWidgets.QSizePolicy.Expanding, QtWidgets.QSizePolicy.Minimum)
- self.gridLayout_3.addItem(spacerItem4, 4, 2, 1, 8)
+ self.gridLayout_7.addWidget(self.d_pb_collapse, 0, 1, 1, 1)
+ spacerItem5 = QtWidgets.QSpacerItem(3000, 27, QtWidgets.QSizePolicy.Expanding, QtWidgets.QSizePolicy.Minimum)
+ self.gridLayout_7.addItem(spacerItem5, 0, 2, 1, 1)
+ self.label = QtWidgets.QLabel(self.tab_depgraph)
+ sizePolicy = QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.Minimum, QtWidgets.QSizePolicy.Preferred)
+ sizePolicy.setHorizontalStretch(0)
+ sizePolicy.setVerticalStretch(0)
+ sizePolicy.setHeightForWidth(self.label.sizePolicy().hasHeightForWidth())
+ self.label.setSizePolicy(sizePolicy)
+ self.label.setMaximumSize(QtCore.QSize(100, 16777215))
+ self.label.setObjectName("label")
+ self.gridLayout_7.addWidget(self.label, 0, 3, 1, 1)
+ self.d_lcd_deps = QtWidgets.QLCDNumber(self.tab_depgraph)
+ self.d_lcd_deps.setSegmentStyle(QtWidgets.QLCDNumber.Flat)
+ self.d_lcd_deps.setObjectName("d_lcd_deps")
+ self.gridLayout_7.addWidget(self.d_lcd_deps, 0, 4, 1, 1)
+ self.gridLayout_4.addLayout(self.gridLayout_7, 4, 0, 1, 7)
self.tw_1.addTab(self.tab_depgraph, "")
self.tab_update = QtWidgets.QWidget()
self.tab_update.setObjectName("tab_update")
self.tree_buttongroup.addButton(self.e_rb_update)
self.gridLayout_5.addWidget(self.e_rb_update, 0, 1, 1, 1)
self.e_cb_deep = QtWidgets.QCheckBox(self.tab_update)
- self.e_cb_deep.setChecked(True)
+ self.e_cb_deep.setChecked(False)
self.e_cb_deep.setObjectName("e_cb_deep")
self.gridLayout_5.addWidget(self.e_cb_deep, 0, 2, 1, 1)
self.e_rb_world = QtWidgets.QRadioButton(self.tab_update)
- self.e_rb_world.setChecked(True)
+ self.e_rb_world.setCheckable(True)
+ self.e_rb_world.setChecked(False)
self.e_rb_world.setObjectName("e_rb_world")
self.atom_buttongroup = QtWidgets.QButtonGroup(MainWindow)
self.atom_buttongroup.setObjectName("atom_buttongroup")
self.atom_buttongroup.addButton(self.e_rb_world)
self.gridLayout_5.addWidget(self.e_rb_world, 0, 3, 1, 1)
self.e_rb_atom = QtWidgets.QRadioButton(self.tab_update)
+ self.e_rb_atom.setChecked(True)
self.e_rb_atom.setObjectName("e_rb_atom")
self.atom_buttongroup.addButton(self.e_rb_atom)
self.gridLayout_5.addWidget(self.e_rb_atom, 0, 4, 1, 1)
- spacerItem5 = QtWidgets.QSpacerItem(44, 20, QtWidgets.QSizePolicy.Expanding, QtWidgets.QSizePolicy.Minimum)
- self.gridLayout_5.addItem(spacerItem5, 0, 5, 1, 1)
+ spacerItem6 = QtWidgets.QSpacerItem(44, 20, QtWidgets.QSizePolicy.Expanding, QtWidgets.QSizePolicy.Minimum)
+ self.gridLayout_5.addItem(spacerItem6, 0, 5, 1, 1)
self.e_pb_go = QtWidgets.QPushButton(self.tab_update)
self.e_pb_go.setObjectName("e_pb_go")
self.gridLayout_5.addWidget(self.e_pb_go, 0, 6, 1, 1)
MainWindow.setCentralWidget(self.centralWidget)
self.retranslateUi(MainWindow)
- self.tw_1.setCurrentIndex(1)
+ self.tw_1.setCurrentIndex(0)
QtCore.QMetaObject.connectSlotsByName(MainWindow)
def retranslateUi(self, MainWindow):
_translate = QtCore.QCoreApplication.translate
MainWindow.setWindowTitle(_translate("MainWindow", "PyGentools"))
self.s_pb_expand_pkg.setToolTip(_translate("MainWindow", "<html><head/><body><p>Expand all categories to show packages</p></body></html>"))
- self.s_pb_expand_pkg.setText(_translate("MainWindow", "Expand Pkgs"))
+ self.s_pb_expand_pkg.setText(_translate("MainWindow", "Exp Categories"))
self.s_pb_updatedb.setToolTip(_translate("MainWindow", "<!DOCTYPE HTML PUBLIC \"-//W3C//DTD HTML 4.0//EN\" \"http://www.w3.org/TR/REC-html40/strict.dtd\">\n"
"<html><head><meta name=\"qrichtext\" content=\"1\" /><style type=\"text/css\">\n"
"p, li { white-space: pre-wrap; }\n"
self.d_label_depth.setText(_translate("MainWindow", "Depth:"))
self.d_le_depth.setToolTip(_translate("MainWindow", "<html><head/><body><p>Set the depth to which the dependencies are calculated (0 = full depth)</p></body></html>"))
self.d_le_depth.setText(_translate("MainWindow", "1"))
+ self.d_ckb_installed.setToolTip(_translate("MainWindow", "<html><head/><body><p>Experimental feature:</p><p>May result in spurious parent/child relationships in depgraph</p><p>The packages listed are still the correct dependencies.</p></body></html>"))
+ self.d_ckb_installed.setText(_translate("MainWindow", "Exclude Installed"))
self.d_pb_calculate.setToolTip(_translate("MainWindow", "<html><head/><body><p>Click to do stuff</p></body></html>"))
self.d_pb_calculate.setText(_translate("MainWindow", "Calculate"))
self.d_rb_manual.setText(_translate("MainWindow", "Enter Package"))
- self.d_le_package.setPlaceholderText(_translate("MainWindow", "=category/package-version"))
- self.d_ckb_installed.setToolTip(_translate("MainWindow", "<html><head/><body><p>Experimental feature:</p><p>May result in spurious parent/child relationships in depgraph</p><p>The packages listed are still the correct dependencies.</p></body></html>"))
- self.d_ckb_installed.setText(_translate("MainWindow", "Do Not Include Installed Packages"))
self.d_pb_expand.setText(_translate("MainWindow", "Expand All"))
self.d_pb_collapse.setText(_translate("MainWindow", "Collapse All"))
+ self.label.setText(_translate("MainWindow", "Deps Found:"))
self.tw_1.setTabText(self.tw_1.indexOf(self.tab_depgraph), _translate("MainWindow", "Dep Graph"))
self.e_rb_new_use.setToolTip(_translate("MainWindow", "<html><head/><body><p>Adds the --newuse (-N) option to the emerge command</p></body></html>"))
self.e_rb_new_use.setText(_translate("MainWindow", "New Use"))
self.Name=''
self.Versions=[]
-class s_Category:
- def __init__(self):
- self.UID=1
- self.PUID=0
- self.Name=''
- self.Packages=[]
-
-class s_Package:
- def __init__(self):
- self.UID=0
- self.PUID=0
- self.Name=''
- self.Description=''
- self.Homepage=''
- self.Installed=[]
- self.Available=[]
-
-class s_Installed:
- def __init__(self):
- self.UID=0
- self.PUID=0
- self.Version=''
- self.Use=''
- self.Homepage='Installed ->'
-
-class s_Available:
- def __init__(self):
- self.UID=0
- self.PUID=0
- self.Version=''
- self.Use=''
- self.Homepage='Available ->'
-
-class s_Result:
- def __init__(self):
- self.UID=0
- self.PUID=0
- self.Category=''
- self.Name=''
- self.Description=''
- self.Homepage=''
- self.Version=''
- self.Use=''
-
class MainWindow(QMainWindow, Ui_MainWindow):
def __init__(self, parent=None):
super(MainWindow, self).__init__(parent)
's_rb_use_enabled':[self.s_rb_use_enabled,'--installed-with-use'],
}
self.s_cats=0
- self.s_find={
- 'Category':[re.compile('^\[[0-9I]\] [A-z0-9]|^\* [A-z]'),self.s_getCat,0],
- 'Name':[re.compile('^\[[0-9I]\] [A-z0-9]|^\* [A-z0-9]'),self.s_getName,1],
- 'Description':[re.compile('Description:'),self.s_getDesc,2],
- 'Homepage':[re.compile('Homepage:'),self.s_getHome,3],
- 'Installed':[re.compile('Installed versions:'),self.s_getInstVers,4],
- 'Installed_use':re.compile('\)\([A-z3\-]'),
- 'Available':[re.compile('Available versions:'),self.s_getAvailVers,6],
- 'Available_use':re.compile(' \[[A-z0-9="+_ \(\)-]*\]'),
- 'avail_ver':re.compile(' *(\*\*|[0-9]|\(~\)|\[[Mm]\])'),
- 'inst_ver':re.compile('([0-9]|c|a)\('),
- }
- self.resize(952, 492)
-#global class functions
def redraw_window(self):
self.update()
QApplication.processEvents()
use='%s %s'%(use,usept)
return use
-#section depgraph tab section
+#section depgraph tab
def on_d_rb_select_toggled(self,p0):
self.d_cb_category.setEnabled(p0)
self.d_cb_package.setEnabled(p0)
self.d_le_package.setEnabled(not p0)
def on_d_le_depth_returnPressed(self):
- self.d_on_pb_calculate_released()
+ self.on_d_pb_calculate_released()
def on_d_le_depth_textChanged(self, p0):
if p0=='':return
def on_d_tv_results_expanded(self, index):
pass
- def on_d_pbar_valueChanged(self, value):
- pass
-
def on_d_pb_expand_released(self):
self.d_tv_results.expandAll()
-
def on_d_cb_category_currentTextChanged(self, p0):
if self.d_catsupop:return
self.d_pkgs=[]
pkg.Name=pkg_name.strip()
cat.Packages.append(pkg)
self.d_cb_category.clear()
- self.d_cb_category.addItem('Select version')
+ self.d_cb_category.addItem('Select Category')
for cat in cats:
self.d_cb_category.addItem(cat.Name)
self.d_cats=cats
self.d_catsupop=False
-
def on_d_cb_version_currentTextChanged(self, p0):
pass
def d_gen_results(self,pkg):
self.d_pbar.setValue(0)
+ self.d_lcd_deps.display(0)
+ self.d_pbar.setMaximum(1)
+ self.d_tv_results.setEnabled(False)
self.d_pbar.setFormat('Running equery g %s...'%pkg)
+ model = QStandardItemModel()
+ model.setHorizontalHeaderLabels(['Package Name'])
+ self.d_tv_results.setModel(model)
self.update()
QApplication.processEvents()
try:
uid=0
pdict={}
items={}
- model = QStandardItemModel()
- model.setHorizontalHeaderLabels(['Package Name'])
results=[]
while True:
output = process.stdout.readline()
if output == '' and process.poll() is not None:
break
results.append(output)
+ if self.d_ckb_installed.isChecked():
+ results=self.d_filter_inst(results)
self.d_pbar.setMaximum(len(results)-2)
+ self.d_lcd_deps.display(len(results)-3)
self.d_pbar.setFormat('Processing dependancy tree...')
self.update()
for output in results:
uid+=1
else:
items[uid]=pkg
- parent=items[pdict[depth-1]]
+ try:
+ parent=items[pdict[depth-1]]
+ except KeyError:
+ parent=model.invisibleRootItem()
pdict[depth]=uid
parent.appendRow([QStandardItem(pkg)])
items[uid]=parent.child(parent.rowCount()-1)
uid+=1
+ self.d_pbar.setFormat('Done')
self.d_tv_results.setModel(model)
+ self.d_tv_results.setEnabled(True)
+
+ def d_filter_inst(self,results):
+ self.d_pbar.setMaximum(len(results)-2)
+ self.d_lcd_deps.display(len(results)-3)
+ self.d_pbar.setFormat('Filtering installed packages...')
+ cmd=['eix','--installed','--only-names']
+ pkgre=re.compile('-[0-9].*')
+ process=Popen(cmd,encoding='utf-8',stdout=PIPE)
+ filters=[]
+ while True:
+ output = process.stdout.readline().strip()
+ if output == '' and process.poll() is not None:
+ break
+ filters.append(output)
+ fresults=[]
+ x=False
+ count=0
+ for output in results:
+ count+=1
+ self.d_pbar.setValue(count)
+ if output.find('[')<0:continue
+ if not x:
+ fresults.append(output)
+ x=True
+ continue
+ teststr=pkgre.sub('',output[7:].strip())
+ if teststr in filters:
+ continue
+ fresults.append(output)
+ self.d_lcd_deps.display(len(fresults)-1)
+ return fresults
#endsection
-#search tab section ##
+#section search tab
def on_s_pb_expand_pkg_released(self):
model=self.s_tv_results.model()
if not model:return
child.wait()
def on_s_pb_search_released(self):
- options=['eix','-l','-n']
+ options=['eix']
for rb in self.s_rb_option:
if self.s_rb_option[rb][0].isChecked():
options.append(self.s_rb_option[rb][1])
for cb in self.s_cb_option:
if self.s_cb_option[cb][0].isChecked():
options.append(self.s_cb_option[cb][1])
- terms=re.sub(' ','|',self.s_le_search.text())
- options.append(terms)
- self.s_le_command.setText(' '.join(options))
+ term=self.s_le_search.text()
+ options.append(term)
+ cmnd=' '.join(options)
+ self.s_pbar.setFormat('Running: %s'%cmnd)
+ self.s_le_command.setText(cmnd)
+ self.s_le_command.setEnabled(True)
self.s_doSearch(options)
def on_s_pb_expand_all_released(self):
def on_s_pb_collapse_released(self):
self.s_tv_results.collapseAll()
- self.s_le_search.setText=('gecko')
def on_s_le_search_returnPressed(self):
self.on_s_pb_search_released()
continue
def s_doSearch(self,options):
+ AVERS='Avail¬¬<overlayver>¬¬{isminuskeyword}-K{}{isminusunstable}-{}{isminusasterisk}-*{}{isprofilemasked}[P]{}{ismasked}[m]{}{isunstable}~{}{ismissingkeyword}**{}¬¬<version>¬¬<use>{!last}\n{}'
+ IVERS='Instd¬¬<overlayver>¬¬{isminuskeyword}-K{}{isminusunstable}-{}{isminusasterisk}-*{}{isprofilemasked}[P]{}{ismasked}[m]{}{isunstable}~{}{ismissingkeyword}**{}¬¬<version>¬¬<use*>{!last}\n{}'
+ format='Categ¬¬<category>\nPacka¬¬<name>¬¬<description>¬¬<homepage>\n<availableversions:AVERS>\n<installedversions:IVERS>\n'
+ ENV={'AVERS':AVERS,'IVERS':IVERS,'HOME':'$HOME'}
+ options.append('--format')
+ options.append(format)
self.s_pbar.setValue(0)
- results=[]
- result=[]
- in_result=False
- starter=re.compile('^\[[0-9I]\] [A-z0-9]|^\* [A-z0-9]')
- overlay=re.compile('^\[[0-9]\] "')
- process=Popen(options,encoding='utf-8',stdout=PIPE)
- self.s_pbar.setFormat('Running command: %s'%' '.join(options))
- self.s_pbar.setTextVisible(True)
self.redraw_window()
- counter=nudp=0
- while True:
- output=re.sub('\t',' ',process.stdout.readline())
- if output=='' and process.poll() is not None:
- break
- if starter.match(output):
- in_result=True
- counter+=1
- self.s_lcd_results.display(counter)
- if counter>nudp:
- self.redraw_window()
- nudp=counter+int(counter/10)
- elif output=='\n':
- in_result=False
- elif overlay.match(output) and not in_result:
- list=output.split(' ')
- result=['* Overlays/%s: %s'%(list[1][1:-1],list[0]),'Description: %s'%list[2]]
- in_result=False
- if output and in_result:
- while output.find(' ')>=0:
- output=re.sub(' ',' ',output)
- result.append(output.strip())
- elif result and not in_result:
- results.append(result)
- result=[]
- self.s_lcd_results.display(counter)
- self.s_pbar.setMaximum(len(results))
+ process=Popen(options,encoding='utf-8',stdout=PIPE,env=ENV)
+ data,excd=process.communicate()
+ print(excd,len(data))
+ if excd is not None or len(data)<17:
+ self.s_pbar.setFormat('Search Failed!!')
+ return
+ if data.split('\n')[0]=='No matches found':
+ self.s_pbar.setFormat('No matches found!!')
+ return
+ self.s_pbar.setValue(0)
self.s_pbar.setFormat('Processing Data: Pass 1/2...')
- self.redraw_window()
- model=self.s_createResultsModel(self)
- uid=1
- prog=1
+ self.redraw_window()
+ results=data.split('\n')
+ self.s_pbar.setMaximum(len(results))
+ try:
+ self.s_lcd_results.display(results[len(results)-2].split(' ')[1])
+ except IndexError:
+ self.s_lcd_results.display(1)
+ dataset=[]
cats=[]
+ uid=count=puid=ppuid=1
for result in results:
- cats,uid=self.s_formatResult(cats,uid,result)
- self.s_pbar.setValue(prog)
- prog+=1
- ex_cats=self.s_sortResults(cats)
- self.s_addResults(model,ex_cats)
+ if result[0:7]=='Categ¬¬':
+ cat_name=result.split('¬¬')[1]
+ if cat_name not in cats:
+ dataset.append({'UID':uid,'PUID':0,'Cat':cat_name,'Nam':'','Des':'','Hom':''})
+ cats.append(cat_name)
+ puid=uid
+ uid+=1
+ for result in results:
+ if result[0:7]=='Categ¬¬':
+ cat_name=result.split('¬¬')[1]
+ puid=cats.index(cat_name)+1
+ elif result[0:7]=='Packa¬¬':
+ data=result.split('¬¬')
+ if data[1]=='secret-service':data[3]='https://www.secretservice.gov'
+ dataset.append({'UID':uid,'PUID':puid,'Cat':cats[puid-1],'Nam':data[1],'Des':data[2],'Hom':data[3]})
+ ppuid=uid
+ uid+=1
+ elif result[0:7]=='Avail¬¬':
+ data=result.split('¬¬')
+ dataset.append({'UID':uid,'PUID':ppuid,'Cat':'','Nam':'Available ->','Des':''.join(data[1:4]),'Hom':data[4]})
+ uid+=1
+ elif result[0:7]=='Instd¬¬':
+ data=result.split('¬¬')
+ dataset.append({'UID':uid,'PUID':ppuid,'Cat':'','Nam':'Installed ->','Des':''.join(data[1:4]),'Hom':data[4]})
+ uid+=1
+ elif re.match('^\[[0-9]*?\] "',result):
+ if 'Overlays' not in cats:
+ dataset.append({'UID':uid,'PUID':0,'Cat':'Overlays','Nam':'','Des':'','Hom':''})
+ puid=uid
+ uid+=1
+ cats.append('Overlays')
+ data=result.split(' ')
+ dataset.append({'UID':uid,'PUID':puid,'Cat':'','Nam':' '.join(data[0:2]),'Des':data[2],'Hom':''})
+ self.s_pbar.setValue(count)
+ count+=1
self.s_cats=len(cats)
+ model=self.s_addResults(dataset)
self.s_tv_results.setModel(model)
+ for a in range(0,4):
+ self.s_tv_results.setColumnWidth(a,(int(a/2)+1)*150)
self.s_pbar.setFormat('Done')
- def s_createResultsModel(self,parent):
- headers=['Category','Name','Description','Homepage' ]
+ def s_createResultsModel(self):
model=QStandardItemModel()
- model.setHorizontalHeaderLabels(headers)
+ model.setHorizontalHeaderLabels(['Category','Name','Description','Homepage' ])
return model
-
- def s_formatResult(self,cats,uid,result):
- cat=None
- in_avail=False
- in_inst=False
- for field in result:
- if self.s_find['Category'][0].search(field):
- cat_name=self.s_find['Category'][1](field)
- for pcat in cats:
- if pcat.Name==cat_name:
- cat=pcat
- break
- if not cat:
- cat=s_Category()
- cat.Name=cat_name
- cat.UID=uid
- cats.append(cat)
- uid+=1
- pkg=s_Package()
- pkg.Name=self.s_find['Name'][1](field)
- pkg.UID=uid
- uid+=1
- pkg.PUID=cat.UID
- cat.Packages.append(pkg)
- continue
- if self.s_find['Description'][0].search(field):
- in_avail=in_inst=False
- pkg.Description=self.s_find['Description'][1](field)
- continue
- if self.s_find['Homepage'][0].search(field):
- in_avail=in_inst=False
- pkg.Homepage=self.s_find['Homepage'][1](field)
- continue
- if self.s_find['Installed'][0].search(field) or in_inst:
- in_avail=False
- in_inst=True
- installed,use=self.s_find['Installed'][1](field)
- inst=s_Installed()
- inst.Version=installed
- inst.Use=use
- inst.PUID=pkg.UID
- inst.UID=uid
- uid+=1
- pkg.Installed.append(inst)
- continue
- if self.s_find['Available'][0].search(field):
- in_avail=True
- continue
- if in_avail:
- version,use=self.s_find['Available'][1](field)
- if version:
- avail=s_Available()
- avail.Version=version
- avail.PUID=pkg.UID
- avail.UID=uid
- avail.Use=use
- uid+=1
- pkg.Available.append(avail)
- return cats,uid
-
- def s_getName(self,str):
- return str.split('/')[1].strip()
-
- def s_getCat(self,str):
- return str.split(' ')[1].split('/')[0].strip()
-
- def s_getAvailVers(self,str):
- if str.strip()[0]=='(':return None,None
- poppers=('[P]')
- use,ind=self.s_getAuse(str)
- ver=''
- str=str[:ind].strip()
- fields=str.split(' ')
- if fields[0].find('~')>=0:
- ver='~'
- fields.pop(0)
- if fields[0].find('*')>=0:
- ver='**'
- fields.pop(0)
- if fields[0] in poppers:
- fields.pop(0)
- ver='%s%s'%(ver,fields[0])
- return ver,use
-
- def s_getAuse(self,str):
- t=self.s_find['Available_use'].search(str)
- use=''
- ind=None
- if t:use,ind=str[t.start()+2:t.end()-1],t.start()+1
- if use:use=self.fold_use('Available use flags: %s'%use,120)
- return use,ind
-
- def s_getInstVers(self,str):
- str=self.s_sanitise(str)
- ver=None
- use,ind=self.s_getIuse(str)
- str=str[:ind].strip()
- m=self.s_find['inst_ver'].search(str)
- if m:
- ver=str[:m.start()+1]
- ver=self.s_clean(ver)
- return ver,use
-
- def s_getIuse(self,str):
- m=self.s_find['Installed_use'].search(str)
- iuse=''
- ind=None
- if m:iuse,ind=str[m.end()-1:str.rfind(')')],m.end()
- if iuse:iuse=self.fold_use('Installed use flags: %s'%iuse,120)
- return iuse,ind
-
- def s_getHome(self,str):
- t=self.s_find['Homepage'][0].match(str)
- home=str[t.end()+1:].strip()
- return home
-
- def s_getDesc(self,str):
- t=self.s_find['Description'][0].match(str)
- desc=str[t.end()+1:].strip()
- return desc
-
- def s_sanitise(self,str):
- strippers={ '\^[a-z]{1,3}':'','\*l':'','\(~\)':'~','\[.\]':'','Installed versions: *':''}
- for stripper in strippers:
- str=re.sub(stripper,strippers[stripper],str)
- return str
-
- def s_clean(self,str):
- strippers={ '\^[a-z]{1,3}':'','\*l':'','\(~\)':'~','\(([0-9]{2}:){2}[0-9]{2} ([0-9]{2}/){2}[0-9]{2}\)':''}
- for stripper in strippers:
- str=re.sub(stripper,strippers[stripper],str)
- return str
-
- def s_sortResults(self,results):
- sorted=[]
- for cat in results:
- result=s_Result()
- result.UID=cat.UID
- result.Category=cat.Name
- sorted.append(result)
- for pkg in cat.Packages:
- result=s_Result()
- result.Name=pkg.Name
- result.UID=pkg.UID
- result.PUID=pkg.PUID
- result.Description=pkg.Description
- result.Homepage=pkg.Homepage
- sorted.append(result)
- for inst in pkg.Installed:
- result=s_Result()
- result.UID=inst.UID
- result.PUID=inst.PUID
- result.Name=inst.Homepage
- result.Description=inst.Version
- result.Homepage=inst.Use
- sorted.append(result)
- for avail in pkg.Available:
- result=s_Result()
- result.UID=avail.UID
- result.PUID=avail.PUID
- result.Name=avail.Homepage
- result.Description=avail.Version
- result.Homepage=avail.Use
- sorted.append(result)
- return sorted
-
- def s_addResults(self,model,results):
+
+ def s_addResults(self,results):
+ model=self.s_createResultsModel()
prog=1
self.s_pbar.setMaximum(len(results))
self.s_pbar.setFormat('Processing Data: Pass 2/2...')
items={}
for result in results:
- if result.PUID==0:
+ if result['PUID']==0:
parent=model.invisibleRootItem()
else:
- parent=items[result.PUID]
- parent.appendRow([ QStandardItem(result.Category),
- QStandardItem(result.Name),
- QStandardItem(result.Description),
- QStandardItem(result.Homepage),
- ])
- items[result.UID] = parent.child(parent.rowCount()-1)
+ parent=items[result['PUID']]
+ parent.appendRow([QStandardItem(result['Cat']),
+ QStandardItem(result['Nam']),
+ QStandardItem(result['Des']),
+ QStandardItem(result['Hom'])])
+ items[result['UID']] = parent.child(parent.rowCount()-1)
self.s_pbar.setValue(prog)
prog+=1
return model
#endsection
-#emerge tab section ##
+#section emerge tab
def on_e_rb_new_use_toggled(self, checked):
pass
<rect>
<x>0</x>
<y>0</y>
- <width>714</width>
- <height>450</height>
+ <width>685</width>
+ <height>452</height>
</rect>
</property>
<property name="windowTitle">
<string><html><head/><body><p>Expand all categories to show packages</p></body></html></string>
</property>
<property name="text">
- <string>Expand Pkgs</string>
+ <string>Exp Categories</string>
</property>
</widget>
</item>
<enum>QAbstractItemView::SelectItems</enum>
</property>
<property name="sortingEnabled">
- <bool>true</bool>
+ <bool>false</bool>
</property>
<property name="wordWrap">
<bool>false</bool>
</property>
+ <attribute name="headerCascadingSectionResizes">
+ <bool>false</bool>
+ </attribute>
<attribute name="headerShowSortIndicator" stdset="0">
+ <bool>false</bool>
+ </attribute>
+ <attribute name="headerStretchLastSection">
<bool>true</bool>
</attribute>
</widget>
<attribute name="title">
<string>Dep Graph</string>
</attribute>
- <layout class="QGridLayout" name="gridLayout_3">
+ <layout class="QGridLayout" name="gridLayout_4">
<item row="0" column="0">
<widget class="QRadioButton" name="d_rb_select">
<property name="text">
</property>
</widget>
</item>
- <item row="0" column="1" colspan="2">
+ <item row="0" column="1">
<widget class="QComboBox" name="d_cb_category">
<property name="toolTip">
<string><html><head/><body><p>Select a package category from the list</p></body></html></string>
</item>
</widget>
</item>
- <item row="0" column="3">
+ <item row="0" column="2">
<widget class="QComboBox" name="d_cb_package">
<property name="toolTip">
<string><html><head/><body><p>Select a package from the list</p></body></html></string>
</item>
</widget>
</item>
- <item row="0" column="4">
+ <item row="0" column="3">
<widget class="QComboBox" name="d_cb_version">
<property name="toolTip">
<string><html><head/><body><p>Select a package version from the list</p></body></html></string>
</item>
</widget>
</item>
- <item row="0" column="5">
- <widget class="QLabel" name="d_label_depth">
- <property name="maximumSize">
- <size>
- <width>60</width>
- <height>16777215</height>
- </size>
- </property>
- <property name="font">
- <font>
- <weight>75</weight>
- <bold>true</bold>
- </font>
- </property>
- <property name="toolTip">
- <string>Max depgrah depth (0=no max)</string>
- </property>
- <property name="layoutDirection">
- <enum>Qt::LeftToRight</enum>
- </property>
- <property name="text">
- <string>Depth:</string>
- </property>
- <property name="alignment">
- <set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
- </property>
- </widget>
- </item>
- <item row="0" column="6">
- <widget class="QLineEdit" name="d_le_depth">
- <property name="sizePolicy">
- <sizepolicy hsizetype="Preferred" vsizetype="Fixed">
- <horstretch>0</horstretch>
- <verstretch>0</verstretch>
- </sizepolicy>
- </property>
- <property name="maximumSize">
- <size>
- <width>80</width>
- <height>16777215</height>
- </size>
- </property>
- <property name="sizeIncrement">
- <size>
- <width>5</width>
- <height>0</height>
- </size>
- </property>
- <property name="baseSize">
- <size>
- <width>30</width>
- <height>0</height>
- </size>
- </property>
- <property name="toolTip">
- <string><html><head/><body><p>Set the depth to which the dependencies are calculated (0 = full depth)</p></body></html></string>
- </property>
- <property name="inputMask">
- <string/>
- </property>
- <property name="text">
- <string>1</string>
- </property>
- </widget>
+ <item row="0" column="4" rowspan="2">
+ <layout class="QGridLayout" name="gridLayout_3">
+ <item row="0" column="0">
+ <widget class="QLabel" name="d_label_depth">
+ <property name="maximumSize">
+ <size>
+ <width>60</width>
+ <height>16777215</height>
+ </size>
+ </property>
+ <property name="font">
+ <font>
+ <weight>75</weight>
+ <bold>true</bold>
+ </font>
+ </property>
+ <property name="toolTip">
+ <string>Max depgrah depth (0=no max)</string>
+ </property>
+ <property name="layoutDirection">
+ <enum>Qt::LeftToRight</enum>
+ </property>
+ <property name="text">
+ <string>Depth:</string>
+ </property>
+ <property name="alignment">
+ <set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
+ </property>
+ </widget>
+ </item>
+ <item row="0" column="1">
+ <widget class="QLineEdit" name="d_le_depth">
+ <property name="sizePolicy">
+ <sizepolicy hsizetype="Preferred" vsizetype="Fixed">
+ <horstretch>0</horstretch>
+ <verstretch>0</verstretch>
+ </sizepolicy>
+ </property>
+ <property name="maximumSize">
+ <size>
+ <width>80</width>
+ <height>16777215</height>
+ </size>
+ </property>
+ <property name="sizeIncrement">
+ <size>
+ <width>5</width>
+ <height>0</height>
+ </size>
+ </property>
+ <property name="baseSize">
+ <size>
+ <width>30</width>
+ <height>0</height>
+ </size>
+ </property>
+ <property name="toolTip">
+ <string><html><head/><body><p>Set the depth to which the dependencies are calculated (0 = full depth)</p></body></html></string>
+ </property>
+ <property name="inputMask">
+ <string/>
+ </property>
+ <property name="text">
+ <string>1</string>
+ </property>
+ </widget>
+ </item>
+ <item row="1" column="0" colspan="2">
+ <widget class="QCheckBox" name="d_ckb_installed">
+ <property name="toolTip">
+ <string><html><head/><body><p>Experimental feature:</p><p>May result in spurious parent/child relationships in depgraph</p><p>The packages listed are still the correct dependencies.</p></body></html></string>
+ </property>
+ <property name="text">
+ <string>Exclude Installed</string>
+ </property>
+ </widget>
+ </item>
+ </layout>
</item>
- <item row="0" column="7">
+ <item row="0" column="5" rowspan="2">
<spacer name="horizontalSpacer_2">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
- <width>50</width>
- <height>20</height>
+ <width>0</width>
+ <height>48</height>
</size>
</property>
</spacer>
</item>
- <item row="0" column="8" colspan="2">
+ <item row="0" column="6">
<widget class="QPushButton" name="d_pb_calculate">
<property name="toolTip">
<string><html><head/><body><p>Click to do stuff</p></body></html></string>
</property>
</widget>
</item>
- <item row="1" column="1" colspan="4">
+ <item row="1" column="1" colspan="3">
<widget class="QLineEdit" name="d_le_package">
<property name="enabled">
<bool>false</bool>
</property>
+ <property name="text">
+ <string/>
+ </property>
<property name="placeholderText">
- <string>=category/package-version</string>
+ <string/>
</property>
</widget>
</item>
- <item row="1" column="5" colspan="4">
- <widget class="QCheckBox" name="d_ckb_installed">
- <property name="toolTip">
- <string><html><head/><body><p>Experimental feature:</p><p>May result in spurious parent/child relationships in depgraph</p><p>The packages listed are still the correct dependencies.</p></body></html></string>
+ <item row="1" column="6">
+ <spacer name="verticalSpacer">
+ <property name="orientation">
+ <enum>Qt::Vertical</enum>
</property>
- <property name="text">
- <string>Do Not Include Installed Packages</string>
+ <property name="sizeType">
+ <enum>QSizePolicy::Fixed</enum>
</property>
- </widget>
+ <property name="sizeHint" stdset="0">
+ <size>
+ <width>20</width>
+ <height>18</height>
+ </size>
+ </property>
+ </spacer>
</item>
- <item row="2" column="0" colspan="10">
+ <item row="2" column="0" colspan="7">
<widget class="QTreeView" name="d_tv_results">
<property name="sizePolicy">
<sizepolicy hsizetype="MinimumExpanding" vsizetype="Expanding">
</property>
</widget>
</item>
- <item row="3" column="0" colspan="10">
+ <item row="3" column="0" colspan="7">
<widget class="QProgressBar" name="d_pbar">
<property name="value">
<number>0</number>
</property>
</widget>
</item>
- <item row="4" column="0">
- <widget class="QPushButton" name="d_pb_expand">
- <property name="text">
- <string>Expand All</string>
- </property>
- </widget>
- </item>
- <item row="4" column="1">
- <widget class="QPushButton" name="d_pb_collapse">
- <property name="text">
- <string>Collapse All</string>
- </property>
- </widget>
- </item>
- <item row="4" column="2" colspan="8">
- <spacer name="horizontalSpacer">
- <property name="orientation">
- <enum>Qt::Horizontal</enum>
- </property>
- <property name="sizeHint" stdset="0">
- <size>
- <width>372</width>
- <height>27</height>
- </size>
- </property>
- </spacer>
+ <item row="4" column="0" colspan="7">
+ <layout class="QGridLayout" name="gridLayout_7">
+ <item row="0" column="0">
+ <widget class="QPushButton" name="d_pb_expand">
+ <property name="text">
+ <string>Expand All</string>
+ </property>
+ </widget>
+ </item>
+ <item row="0" column="1">
+ <widget class="QPushButton" name="d_pb_collapse">
+ <property name="text">
+ <string>Collapse All</string>
+ </property>
+ </widget>
+ </item>
+ <item row="0" column="2">
+ <spacer name="horizontalSpacer">
+ <property name="orientation">
+ <enum>Qt::Horizontal</enum>
+ </property>
+ <property name="sizeHint" stdset="0">
+ <size>
+ <width>3000</width>
+ <height>27</height>
+ </size>
+ </property>
+ </spacer>
+ </item>
+ <item row="0" column="3">
+ <widget class="QLabel" name="label">
+ <property name="sizePolicy">
+ <sizepolicy hsizetype="Minimum" vsizetype="Preferred">
+ <horstretch>0</horstretch>
+ <verstretch>0</verstretch>
+ </sizepolicy>
+ </property>
+ <property name="maximumSize">
+ <size>
+ <width>100</width>
+ <height>16777215</height>
+ </size>
+ </property>
+ <property name="text">
+ <string>Deps Found:</string>
+ </property>
+ </widget>
+ </item>
+ <item row="0" column="4">
+ <widget class="QLCDNumber" name="d_lcd_deps">
+ <property name="segmentStyle">
+ <enum>QLCDNumber::Flat</enum>
+ </property>
+ </widget>
+ </item>
+ </layout>
</item>
</layout>
</widget>
<string>Deep</string>
</property>
<property name="checked">
- <bool>true</bool>
+ <bool>false</bool>
</property>
</widget>
</item>
<property name="text">
<string>@World</string>
</property>
- <property name="checked">
+ <property name="checkable">
<bool>true</bool>
</property>
+ <property name="checked">
+ <bool>false</bool>
+ </property>
<attribute name="buttonGroup">
<string notr="true">atom_buttongroup</string>
</attribute>
<property name="text">
<string>Atom Below</string>
</property>
+ <property name="checked">
+ <bool>true</bool>
+ </property>
<attribute name="buttonGroup">
<string notr="true">atom_buttongroup</string>
</attribute>