reindex is added alongside vaccum + firefox-trunk (Nightly) support added
This commit is contained in:
parent
c1f0bad041
commit
1a6d2030ac
5 changed files with 627 additions and 560 deletions
|
@ -15,7 +15,17 @@ __libVer__ = "0.1"
|
||||||
def mozDefragFirefox(): # Firefox defrag
|
def mozDefragFirefox(): # Firefox defrag
|
||||||
|
|
||||||
cmd2exec = "for f in ~/.mozilla/firefox/*/*.sqlite;"
|
cmd2exec = "for f in ~/.mozilla/firefox/*/*.sqlite;"
|
||||||
cmd2exec += "do sqlite3 $f 'VACUUM;';"
|
cmd2exec += "do sqlite3 $f 'VACUUM; REINDEX;';"
|
||||||
|
cmd2exec += "done"
|
||||||
|
cmdOutput = str(subprocess.check_output(cmd2exec,
|
||||||
|
shell=True).decode("utf-8"))
|
||||||
|
return cmdOutput
|
||||||
|
|
||||||
|
|
||||||
|
def mozDefragFirefoxTrunk(): # Firefox trunk defrag
|
||||||
|
|
||||||
|
cmd2exec = "for f in ~/.mozilla/firefox-trunk/*/*.sqlite;"
|
||||||
|
cmd2exec += "do sqlite3 $f 'VACUUM; REINDEX;';"
|
||||||
cmd2exec += "done"
|
cmd2exec += "done"
|
||||||
cmdOutput = str(subprocess.check_output(cmd2exec,
|
cmdOutput = str(subprocess.check_output(cmd2exec,
|
||||||
shell=True).decode("utf-8"))
|
shell=True).decode("utf-8"))
|
||||||
|
@ -25,7 +35,7 @@ def mozDefragFirefox(): # Firefox defrag
|
||||||
def mozDefragThunderbird(): # Thunderbird defrag
|
def mozDefragThunderbird(): # Thunderbird defrag
|
||||||
|
|
||||||
cmd2exec = "for f in ~/.thunderbird/*/*.sqlite;"
|
cmd2exec = "for f in ~/.thunderbird/*/*.sqlite;"
|
||||||
cmd2exec += "do sqlite3 $f 'VACUUM;';"
|
cmd2exec += "do sqlite3 $f 'VACUUM; REINDEX;';"
|
||||||
cmd2exec += "done"
|
cmd2exec += "done"
|
||||||
cmdOutput = str(subprocess.check_output(cmd2exec,
|
cmdOutput = str(subprocess.check_output(cmd2exec,
|
||||||
shell=True).decode("utf-8"))
|
shell=True).decode("utf-8"))
|
||||||
|
@ -43,6 +53,17 @@ def mozFirefoxIsInstalled(): # check if Firefox is installed
|
||||||
return 1 if (cmdOutput > 0) else 0
|
return 1 if (cmdOutput > 0) else 0
|
||||||
|
|
||||||
|
|
||||||
|
def mozFirefoxTrunkIsInstalled(): # check if Firefox trunk is installed
|
||||||
|
|
||||||
|
cmd2exec = "if which firefox-trunk >/dev/null;"
|
||||||
|
cmd2exec += "then echo 1;"
|
||||||
|
cmd2exec += "else echo 0;"
|
||||||
|
cmd2exec += "fi"
|
||||||
|
cmdOutput = int(subprocess.check_output(cmd2exec,
|
||||||
|
shell=True).decode("utf-8"))
|
||||||
|
return 1 if (cmdOutput > 0) else 0
|
||||||
|
|
||||||
|
|
||||||
def mozThunderbirdIsInstalled(): # check if Thunderbird is installed
|
def mozThunderbirdIsInstalled(): # check if Thunderbird is installed
|
||||||
|
|
||||||
cmd2exec = "if which thunderbird >/dev/null;"
|
cmd2exec = "if which thunderbird >/dev/null;"
|
||||||
|
@ -62,6 +83,14 @@ def mozFirefoxIsRunning(): # check if Firefox is running
|
||||||
return 1 if (cmdOutput > 0) else 0
|
return 1 if (cmdOutput > 0) else 0
|
||||||
|
|
||||||
|
|
||||||
|
def mozFirefoxTrunkIsRunning(): # check if Firefox trunk is running
|
||||||
|
|
||||||
|
cmd2exec = "ps auxw | grep -i firefox-trunk | grep -v grep | wc -l"
|
||||||
|
cmdOutput = int(subprocess.check_output(cmd2exec,
|
||||||
|
shell=True).decode("utf-8"))
|
||||||
|
return 1 if (cmdOutput > 0) else 0
|
||||||
|
|
||||||
|
|
||||||
def mozThunderbirdIsRunning(): # check if Thunderbird is running
|
def mozThunderbirdIsRunning(): # check if Thunderbird is running
|
||||||
|
|
||||||
cmd2exec = "ps auxw | grep -i thunderbird | grep -v grep | wc -l"
|
cmd2exec = "ps auxw | grep -i thunderbird | grep -v grep | wc -l"
|
||||||
|
|
11
mozDefrag.py
11
mozDefrag.py
|
@ -58,6 +58,12 @@ class Ui_mozDefragMainWindow(QtWidgets.QMainWindow, # --- Main ---------------
|
||||||
self.logTextEdit.append("> Firefox defrag done")
|
self.logTextEdit.append("> Firefox defrag done")
|
||||||
else:
|
else:
|
||||||
self.logTextEdit.append("> Close Firefox and try again")
|
self.logTextEdit.append("> Close Firefox and try again")
|
||||||
|
if self.checkBoxFirefoxTrunk.isChecked():
|
||||||
|
if not mozFirefoxTrunkIsRunning():
|
||||||
|
mozDefragFirefoxTrunk()
|
||||||
|
self.logTextEdit.append("> Firefox Nightly defrag done")
|
||||||
|
else:
|
||||||
|
self.logTextEdit.append("> Close Firefox Nightly and try again")
|
||||||
if self.checkBoxThunderbird.isChecked():
|
if self.checkBoxThunderbird.isChecked():
|
||||||
if not mozThunderbirdIsRunning():
|
if not mozThunderbirdIsRunning():
|
||||||
mozDefragThunderbird()
|
mozDefragThunderbird()
|
||||||
|
@ -78,6 +84,11 @@ class Ui_mozDefragMainWindow(QtWidgets.QMainWindow, # --- Main ---------------
|
||||||
self.checkBoxFirefox.setChecked(True)
|
self.checkBoxFirefox.setChecked(True)
|
||||||
else:
|
else:
|
||||||
self.checkBoxFirefox.setDisabled(True)
|
self.checkBoxFirefox.setDisabled(True)
|
||||||
|
if mozFirefoxTrunkIsInstalled():
|
||||||
|
self.checkBoxFirefoxTrunk.setEnabled(True)
|
||||||
|
self.checkBoxFirefoxTrunk.setChecked(True)
|
||||||
|
else:
|
||||||
|
self.checkBoxFirefoxTrunk.setDisabled(True)
|
||||||
if mozThunderbirdIsInstalled():
|
if mozThunderbirdIsInstalled():
|
||||||
self.checkBoxThunderbird.setEnabled(True)
|
self.checkBoxThunderbird.setEnabled(True)
|
||||||
self.checkBoxThunderbird.setChecked(True)
|
self.checkBoxThunderbird.setChecked(True)
|
||||||
|
|
|
@ -12,7 +12,7 @@ class Ui_MainWindow(object):
|
||||||
def setupUi(self, MainWindow):
|
def setupUi(self, MainWindow):
|
||||||
MainWindow.setObjectName("MainWindow")
|
MainWindow.setObjectName("MainWindow")
|
||||||
MainWindow.setEnabled(True)
|
MainWindow.setEnabled(True)
|
||||||
MainWindow.resize(395, 376)
|
MainWindow.resize(395, 383)
|
||||||
MainWindow.setAutoFillBackground(False)
|
MainWindow.setAutoFillBackground(False)
|
||||||
MainWindow.setLocale(QtCore.QLocale(QtCore.QLocale.English, QtCore.QLocale.Belgium))
|
MainWindow.setLocale(QtCore.QLocale(QtCore.QLocale.English, QtCore.QLocale.Belgium))
|
||||||
self.centralwidget = QtWidgets.QWidget(MainWindow)
|
self.centralwidget = QtWidgets.QWidget(MainWindow)
|
||||||
|
@ -23,28 +23,38 @@ class Ui_MainWindow(object):
|
||||||
self.logo_header.setPixmap(QtGui.QPixmap(":/pictures/pic/logo_header.jpg"))
|
self.logo_header.setPixmap(QtGui.QPixmap(":/pictures/pic/logo_header.jpg"))
|
||||||
self.logo_header.setObjectName("logo_header")
|
self.logo_header.setObjectName("logo_header")
|
||||||
self.aboutButton = QtWidgets.QPushButton(self.centralwidget)
|
self.aboutButton = QtWidgets.QPushButton(self.centralwidget)
|
||||||
self.aboutButton.setGeometry(QtCore.QRect(10, 330, 112, 31))
|
self.aboutButton.setGeometry(QtCore.QRect(10, 340, 112, 31))
|
||||||
self.aboutButton.setObjectName("aboutButton")
|
self.aboutButton.setObjectName("aboutButton")
|
||||||
self.defragAllButton = QtWidgets.QPushButton(self.centralwidget)
|
self.defragAllButton = QtWidgets.QPushButton(self.centralwidget)
|
||||||
self.defragAllButton.setGeometry(QtCore.QRect(270, 330, 112, 31))
|
self.defragAllButton.setGeometry(QtCore.QRect(270, 340, 112, 31))
|
||||||
self.defragAllButton.setDefault(False)
|
self.defragAllButton.setDefault(False)
|
||||||
self.defragAllButton.setObjectName("defragAllButton")
|
self.defragAllButton.setObjectName("defragAllButton")
|
||||||
self.logTextEdit = QtWidgets.QTextEdit(self.centralwidget)
|
|
||||||
self.logTextEdit.setGeometry(QtCore.QRect(10, 210, 371, 111))
|
|
||||||
self.logTextEdit.setReadOnly(True)
|
|
||||||
self.logTextEdit.setObjectName("logTextEdit")
|
|
||||||
self.layoutWidget = QtWidgets.QWidget(self.centralwidget)
|
self.layoutWidget = QtWidgets.QWidget(self.centralwidget)
|
||||||
self.layoutWidget.setGeometry(QtCore.QRect(20, 130, 141, 71))
|
self.layoutWidget.setGeometry(QtCore.QRect(20, 130, 141, 80))
|
||||||
self.layoutWidget.setObjectName("layoutWidget")
|
self.layoutWidget.setObjectName("layoutWidget")
|
||||||
self.verticalLayout = QtWidgets.QVBoxLayout(self.layoutWidget)
|
self.verticalLayout = QtWidgets.QVBoxLayout(self.layoutWidget)
|
||||||
self.verticalLayout.setObjectName("verticalLayout")
|
self.verticalLayout.setObjectName("verticalLayout")
|
||||||
self.checkBoxThunderbird = QtWidgets.QCheckBox(self.layoutWidget)
|
self.checkBoxThunderbird = QtWidgets.QCheckBox(self.layoutWidget)
|
||||||
self.checkBoxThunderbird.setObjectName("checkBoxThunderbird")
|
self.checkBoxThunderbird.setObjectName("checkBoxThunderbird")
|
||||||
self.verticalLayout.addWidget(self.checkBoxThunderbird)
|
self.verticalLayout.addWidget(self.checkBoxThunderbird)
|
||||||
|
self.checkBoxFirefoxTrunk = QtWidgets.QCheckBox(self.layoutWidget)
|
||||||
|
self.checkBoxFirefoxTrunk.setEnabled(True)
|
||||||
|
self.checkBoxFirefoxTrunk.setObjectName("checkBoxFirefoxTrunk")
|
||||||
|
self.verticalLayout.addWidget(self.checkBoxFirefoxTrunk)
|
||||||
self.checkBoxFirefox = QtWidgets.QCheckBox(self.layoutWidget)
|
self.checkBoxFirefox = QtWidgets.QCheckBox(self.layoutWidget)
|
||||||
self.checkBoxFirefox.setEnabled(True)
|
self.checkBoxFirefox.setEnabled(True)
|
||||||
self.checkBoxFirefox.setObjectName("checkBoxFirefox")
|
self.checkBoxFirefox.setObjectName("checkBoxFirefox")
|
||||||
self.verticalLayout.addWidget(self.checkBoxFirefox)
|
self.verticalLayout.addWidget(self.checkBoxFirefox)
|
||||||
|
self.logTextEdit = QtWidgets.QTextEdit(self.centralwidget)
|
||||||
|
self.logTextEdit.setGeometry(QtCore.QRect(10, 220, 371, 111))
|
||||||
|
self.logTextEdit.setReadOnly(True)
|
||||||
|
self.logTextEdit.setObjectName("logTextEdit")
|
||||||
|
self.logo_header.raise_()
|
||||||
|
self.aboutButton.raise_()
|
||||||
|
self.defragAllButton.raise_()
|
||||||
|
self.logTextEdit.raise_()
|
||||||
|
self.layoutWidget.raise_()
|
||||||
|
self.logTextEdit.raise_()
|
||||||
MainWindow.setCentralWidget(self.centralwidget)
|
MainWindow.setCentralWidget(self.centralwidget)
|
||||||
|
|
||||||
self.retranslateUi(MainWindow)
|
self.retranslateUi(MainWindow)
|
||||||
|
@ -56,6 +66,7 @@ class Ui_MainWindow(object):
|
||||||
self.aboutButton.setText(_translate("MainWindow", "About"))
|
self.aboutButton.setText(_translate("MainWindow", "About"))
|
||||||
self.defragAllButton.setText(_translate("MainWindow", "Defrag"))
|
self.defragAllButton.setText(_translate("MainWindow", "Defrag"))
|
||||||
self.checkBoxThunderbird.setText(_translate("MainWindow", "Thunderbird"))
|
self.checkBoxThunderbird.setText(_translate("MainWindow", "Thunderbird"))
|
||||||
|
self.checkBoxFirefoxTrunk.setText(_translate("MainWindow", "Firefox Nightly"))
|
||||||
self.checkBoxFirefox.setText(_translate("MainWindow", "Firefox"))
|
self.checkBoxFirefox.setText(_translate("MainWindow", "Firefox"))
|
||||||
|
|
||||||
import res_pics_rc
|
import res_pics_rc
|
||||||
|
|
|
@ -10,7 +10,7 @@
|
||||||
<x>0</x>
|
<x>0</x>
|
||||||
<y>0</y>
|
<y>0</y>
|
||||||
<width>395</width>
|
<width>395</width>
|
||||||
<height>376</height>
|
<height>383</height>
|
||||||
</rect>
|
</rect>
|
||||||
</property>
|
</property>
|
||||||
<property name="windowTitle">
|
<property name="windowTitle">
|
||||||
|
@ -43,7 +43,7 @@
|
||||||
<property name="geometry">
|
<property name="geometry">
|
||||||
<rect>
|
<rect>
|
||||||
<x>10</x>
|
<x>10</x>
|
||||||
<y>330</y>
|
<y>340</y>
|
||||||
<width>112</width>
|
<width>112</width>
|
||||||
<height>31</height>
|
<height>31</height>
|
||||||
</rect>
|
</rect>
|
||||||
|
@ -56,7 +56,7 @@
|
||||||
<property name="geometry">
|
<property name="geometry">
|
||||||
<rect>
|
<rect>
|
||||||
<x>270</x>
|
<x>270</x>
|
||||||
<y>330</y>
|
<y>340</y>
|
||||||
<width>112</width>
|
<width>112</width>
|
||||||
<height>31</height>
|
<height>31</height>
|
||||||
</rect>
|
</rect>
|
||||||
|
@ -68,26 +68,13 @@
|
||||||
<bool>false</bool>
|
<bool>false</bool>
|
||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
<widget class="QTextEdit" name="logTextEdit">
|
|
||||||
<property name="geometry">
|
|
||||||
<rect>
|
|
||||||
<x>10</x>
|
|
||||||
<y>210</y>
|
|
||||||
<width>371</width>
|
|
||||||
<height>111</height>
|
|
||||||
</rect>
|
|
||||||
</property>
|
|
||||||
<property name="readOnly">
|
|
||||||
<bool>true</bool>
|
|
||||||
</property>
|
|
||||||
</widget>
|
|
||||||
<widget class="QWidget" name="layoutWidget">
|
<widget class="QWidget" name="layoutWidget">
|
||||||
<property name="geometry">
|
<property name="geometry">
|
||||||
<rect>
|
<rect>
|
||||||
<x>20</x>
|
<x>20</x>
|
||||||
<y>130</y>
|
<y>130</y>
|
||||||
<width>141</width>
|
<width>141</width>
|
||||||
<height>71</height>
|
<height>80</height>
|
||||||
</rect>
|
</rect>
|
||||||
</property>
|
</property>
|
||||||
<layout class="QVBoxLayout" name="verticalLayout">
|
<layout class="QVBoxLayout" name="verticalLayout">
|
||||||
|
@ -98,6 +85,16 @@
|
||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
|
<item>
|
||||||
|
<widget class="QCheckBox" name="checkBoxFirefoxTrunk">
|
||||||
|
<property name="enabled">
|
||||||
|
<bool>true</bool>
|
||||||
|
</property>
|
||||||
|
<property name="text">
|
||||||
|
<string>Firefox Nightly</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
<item>
|
<item>
|
||||||
<widget class="QCheckBox" name="checkBoxFirefox">
|
<widget class="QCheckBox" name="checkBoxFirefox">
|
||||||
<property name="enabled">
|
<property name="enabled">
|
||||||
|
@ -110,6 +107,25 @@
|
||||||
</item>
|
</item>
|
||||||
</layout>
|
</layout>
|
||||||
</widget>
|
</widget>
|
||||||
|
<widget class="QTextEdit" name="logTextEdit">
|
||||||
|
<property name="geometry">
|
||||||
|
<rect>
|
||||||
|
<x>10</x>
|
||||||
|
<y>220</y>
|
||||||
|
<width>371</width>
|
||||||
|
<height>111</height>
|
||||||
|
</rect>
|
||||||
|
</property>
|
||||||
|
<property name="readOnly">
|
||||||
|
<bool>true</bool>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
<zorder>logo_header</zorder>
|
||||||
|
<zorder>aboutButton</zorder>
|
||||||
|
<zorder>defragAllButton</zorder>
|
||||||
|
<zorder>logTextEdit</zorder>
|
||||||
|
<zorder>layoutWidget</zorder>
|
||||||
|
<zorder>logTextEdit</zorder>
|
||||||
</widget>
|
</widget>
|
||||||
</widget>
|
</widget>
|
||||||
<resources>
|
<resources>
|
||||||
|
|
1066
res_pics_rc.py
1066
res_pics_rc.py
File diff suppressed because it is too large
Load diff
Loading…
Reference in a new issue