Commit 6155285a authored by Silvan Calarco's avatar Silvan Calarco

First commit

parents
mambabase_ui.py: mambabase.ui
pyuic4 mambabase.ui > mambabase_ui.py
#!/usr/bin/env python
from PyQt4 import QtCore
from PyQt4 import QtGui
from PyQt4.QtCore import pyqtProperty
from gi.repository import PackageKitGlib as packagekit
from mambabase_ui import *
import subprocess
PackageGroups = [ \
{ 'name':'inst_base', 'group': 'BASE', 'description': 'System base packages (recommended)'}, \
{ 'name':'inst_office', 'group': 'OFFICE', 'description': 'Office packages (OpenOffice, Groupware, PDA Syncronization, ...)'}, \
{ 'name':'inst_players', 'group': 'MULTIMEDIA_PLAYERS', 'description': 'Audio and Video players (amarok, xmms, vlc, kaffeine, miro, ...)'}, \
{ 'name':'inst_multimedia_editing', 'group': 'MULTIMEDIA_EDITING', 'description': 'Multimedia editing and production (kino, audacity, rosegarden, mixxx, ...)'}, \
{ 'name':'inst_internet', 'group': 'INTERNET', 'description': 'Internet communication and p2p (kopete, pidgin, ekiga, aMule, ...)'}, \
{ 'name':'inst_graphics', 'group': 'GRAPHICS', 'description': 'Graphics software (gimp, digikam, blender, sodipodi, ...)'}, \
{ 'name':'inst_games', 'group': 'GAMES', 'description': 'Games (turacer, pingus, ksudoku, ...)'}, \
{ 'name':'inst_virtualization', 'group': 'VIRTUALIZATION', 'description': 'Emulation and virtuali&zation (VirtualBox, kvm, QtEmu, wine, ...)'}, \
{ 'name':'inst_server', 'group': 'SERVER', 'description': 'Base server packages (apache, postfix, vsftpd, php, mysql, ...)'}, \
{ 'name':'inst_devel', 'group': 'DEVEL', 'description': 'Base development packages (gcc, glibc-devel, kernel sources, ...)'}, \
]
ProprietaryPackages = [ \
{ 'name':'inst_nvidia', 'pkg': 'xorg-drv-video-nvidia', 'description': 'NVIDIA proprietary video driver from openmamba.org'}, \
{ 'name':'inst_nvidia_legacy', 'pkg': 'xorg-drv-video-nvidia_304', 'description': 'NVIDIA proprietary video driver (legacy) from openmamba.org'}, \
{ 'name':'inst_fglrx', 'pkg': 'xorg-drv-video-fglrx', 'description': 'AMD/ATI proprietary video driver from openmamba.org'}, \
{ 'name':'inst_fglrx_legacy', 'pkg': 'xorg-drv-video-fglrx-legacy', 'description': 'AMD/ATI proprietary video driver (legacy) from openmamba.org'}, \
{ 'name':'inst_broadcom_sta', 'pkg': 'broadcom-sta', 'description': 'Broadcom-sta proprietary wireless driver from openmamba.org'}, \
{ 'name':'inst_b43', 'pkg': 'b43-firmware', 'description': 'Broadcom B43 proprietary firmware from openwrt.org'}, \
{ 'name':'inst_flash', 'pkg': 'flashplugin', 'description': 'Flash plugin from adobe.com'}, \
{ 'name':'inst_msttcf', 'pkg': 'msttcorefonts', 'description': 'MS TrueType core fonts from sourceforge'}, \
{ 'name':'inst_codecs', 'pkg': 'win32codecs', 'description': 'Win32 codecs from mplayerhq.hu'}, \
{ 'name':'inst_java', 'pkg': 'sun-java7', 'description': 'Oracle Java 7 from oracle.com'}, \
{ 'name':'inst_skype', 'pkg': 'skype', 'description': 'Skype from skype.com'}, \
{ 'name':'inst_spotify', 'pkg': 'spotify', 'description': 'Spotify from spotify.com'}, \
{ 'name':'inst_virtualbox', 'pkg': 'virtualbox-extension-pack', 'description': 'Virtualbox extension pack from virtualbox.org'}, \
]
def progress_cb(status, typ, data=None):
if status.get_property('package'):
print "Pachet ", status.get_property('package'), status.get_property('package-id')
if status.get_property('package'):
print status.get_property('package').get_name()
# print typ, status.get_property('package')
class MyWizard(QtGui.QWizard):
def __init__(self, parent=None):
QtGui.QWizard.__init__(self, parent)
def resolve_group(group):
p = subprocess.check_output("/bin/bash -c \"source /usr/share/openmamba/pkggroups.db;echo \$"+group+"_PKGS\"",\
shell=True, stderr=subprocess.PIPE)
return p
if __name__ == "__main__":
import sys
app = QtGui.QApplication(sys.argv)
Wizard = MyWizard()
ui = Ui_Wizard()
ui.setupUi(Wizard)
Wizard.show()
QtGui.QApplication.setOverrideCursor(QtGui.QCursor(QtCore.Qt.WaitCursor))
Wizard.button(QtGui.QWizard.NextButton).setEnabled(0)
pkclient = packagekit.Client()
for p in PackageGroups:
app.processEvents()
item_0 = QtGui.QTreeWidgetItem(ui.treeWidget)
item_0.setText(0, p['description'])
item_0.setCheckState(0, QtCore.Qt.Unchecked)
gpkgs = resolve_group(p['group'])
for d in gpkgs.split(" "):
print d
item_1 = QtGui.QTreeWidgetItem(item_0)
item_1.setText(0, d)
result = pkclient.resolve(packagekit.FilterEnum.INSTALLED, d, None, progress_cb, None)
pkgs = result.get_package_array()
if len(pkgs) > 0:
item_1.setCheckState(0, QtCore.Qt.Checked)
else:
item_1.setCheckState(0, QtCore.Qt.Unchecked)
for p in ProprietaryPackages:
app.processEvents()
item_0 = QtGui.QTreeWidgetItem(ui.treeWidget_2)
item_0.setText(0, p['description'])
result = pkclient.resolve(packagekit.FilterEnum.INSTALLED, [p['pkg'],], None, progress_cb, None)
pkgs = result.get_package_array()
if len(pkgs) > 0:
item_0.setCheckState(0, QtCore.Qt.Checked)
item_0.setDisabled(1)
else:
item_0.setCheckState(0, QtCore.Qt.Unchecked)
QtGui.QApplication.restoreOverrideCursor()
Wizard.button(QtGui.QWizard.NextButton).setEnabled(1)
sys.exit(app.exec_())
<?xml version="1.0" encoding="UTF-8"?>
<ui version="4.0">
<class>Wizard</class>
<widget class="QWizard" name="Wizard">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>750</width>
<height>500</height>
</rect>
</property>
<property name="sizePolicy">
<sizepolicy hsizetype="Maximum" vsizetype="Maximum">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="minimumSize">
<size>
<width>750</width>
<height>500</height>
</size>
</property>
<property name="font">
<font>
<pointsize>10</pointsize>
</font>
</property>
<property name="windowTitle">
<string>openmamba base installations</string>
</property>
<property name="windowIcon">
<iconset>
<normaloff>../../../../../home/silvan/openmamba/openmamba3/openmamba-256x256.png</normaloff>../../../../../home/silvan/openmamba/openmamba3/openmamba-256x256.png</iconset>
</property>
<property name="autoFillBackground">
<bool>false</bool>
</property>
<property name="sizeGripEnabled">
<bool>false</bool>
</property>
<property name="wizardStyle">
<enum>QWizard::ModernStyle</enum>
</property>
<property name="options">
<set>QWizard::NoBackButtonOnStartPage</set>
</property>
<widget class="QWizardPage" name="wizardPage1">
<property name="title">
<string>Welcome!</string>
</property>
<property name="subTitle">
<string>Customize your openmamba installation</string>
</property>
<attribute name="pageId">
<string notr="true">welcome</string>
</attribute>
<layout class="QVBoxLayout" name="verticalLayout_8">
<item>
<widget class="QProgressBar" name="progressBar_2">
<property name="value">
<number>24</number>
</property>
</widget>
</item>
<item>
<widget class="QLabel" name="label_3">
<property name="font">
<font>
<pointsize>10</pointsize>
</font>
</property>
<property name="text">
<string>Press Next to continue.</string>
</property>
</widget>
</item>
</layout>
</widget>
<widget class="QWizardPage" name="wizardPage2">
<property name="title">
<string>openmamba base components</string>
</property>
<property name="subTitle">
<string>Select the groups of packages you want to install</string>
</property>
<layout class="QVBoxLayout" name="verticalLayout_2">
<item>
<layout class="QVBoxLayout" name="verticalLayout">
<item>
<widget class="QLabel" name="label">
<property name="text">
<string>Please, select from the boxes below the components that you want to install or update from network.</string>
</property>
</widget>
</item>
<item>
<layout class="QHBoxLayout" name="horizontalLayout">
<item>
<widget class="QTreeWidget" name="treeWidget">
<property name="sizePolicy">
<sizepolicy hsizetype="Expanding" vsizetype="Expanding">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="alternatingRowColors">
<bool>false</bool>
</property>
<property name="selectionMode">
<enum>QAbstractItemView::MultiSelection</enum>
</property>
<property name="headerHidden">
<bool>false</bool>
</property>
<column>
<property name="text">
<string>Group</string>
</property>
</column>
</widget>
</item>
</layout>
</item>
</layout>
</item>
</layout>
</widget>
<widget class="QWizardPage" name="wizardPage3">
<property name="title">
<string>Non free/proprietary components</string>
</property>
<property name="subTitle">
<string>Select the proprietary components you want to install</string>
</property>
<layout class="QVBoxLayout" name="verticalLayout_4">
<item>
<layout class="QVBoxLayout" name="verticalLayout_3">
<item>
<widget class="QLabel" name="label_5">
<property name="text">
<string>The following components are recommended for optimal desktop use but do not have an Open Source license.
WARNING: you'll have to accept a license agreement for most selected packages.</string>
</property>
<property name="wordWrap">
<bool>true</bool>
</property>
</widget>
</item>
<item>
<widget class="QTreeWidget" name="treeWidget_2">
<column>
<property name="text">
<string>Proprietary software installations</string>
</property>
</column>
</widget>
</item>
</layout>
</item>
</layout>
</widget>
<widget class="QWizardPage" name="wizardPage4">
<property name="title">
<string>Installation in progress</string>
</property>
<property name="subTitle">
<string>Please wait for the installation to be completed...</string>
</property>
<layout class="QVBoxLayout" name="verticalLayout_6">
<item>
<layout class="QVBoxLayout" name="verticalLayout_5">
<item>
<spacer name="verticalSpacer_2">
<property name="orientation">
<enum>Qt::Vertical</enum>
</property>
<property name="sizeType">
<enum>QSizePolicy::Fixed</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>20</width>
<height>40</height>
</size>
</property>
</spacer>
</item>
<item>
<widget class="QProgressBar" name="progressBar">
<property name="value">
<number>24</number>
</property>
</widget>
</item>
<item>
<widget class="QLabel" name="label_2">
<property name="font">
<font>
<pointsize>14</pointsize>
</font>
</property>
<property name="text">
<string>Starting installation of selected components...</string>
</property>
</widget>
</item>
<item>
<spacer name="verticalSpacer">
<property name="orientation">
<enum>Qt::Vertical</enum>
</property>
<property name="sizeType">
<enum>QSizePolicy::Fixed</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>20</width>
<height>40</height>
</size>
</property>
</spacer>
</item>
<item>
<widget class="QGroupBox" name="groupBox">
<property name="sizePolicy">
<sizepolicy hsizetype="Expanding" vsizetype="Expanding">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="title">
<string>Details</string>
</property>
<layout class="QGridLayout" name="gridLayout">
<item row="0" column="0">
<widget class="QPlainTextEdit" name="plainTextEdit">
<property name="maximumSize">
<size>
<width>681</width>
<height>16777215</height>
</size>
</property>
<property name="readOnly">
<bool>true</bool>
</property>
</widget>
</item>
</layout>
</widget>
</item>
</layout>
</item>
</layout>
</widget>
<widget class="QWizardPage" name="wizardPage5">
<property name="title">
<string>Installation completed!</string>
</property>
<property name="subTitle">
<string>End of the installation.</string>
</property>
<layout class="QVBoxLayout" name="verticalLayout_11">
<item>
<layout class="QVBoxLayout" name="verticalLayout_10">
<item>
<widget class="QLabel" name="label_4">
<property name="font">
<font>
<pointsize>10</pointsize>
</font>
</property>
<property name="text">
<string>&lt;html&gt;&lt;head/&gt;&lt;body&gt;&lt;p&gt;If you ran into ploblems, please check the installation log below for warnings or errors and send the report to the openmamba community at &lt;a href=&quot;http://www.openmamba.org&quot;&gt;&lt;span style=&quot; text-decoration: underline; color:#0057ae;&quot;&gt;openmamba.org&lt;/span&gt;&lt;/a&gt;.&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string>
</property>
<property name="wordWrap">
<bool>true</bool>
</property>
</widget>
</item>
<item>
<widget class="QGroupBox" name="groupBox_2">
<property name="title">
<string>Installation log</string>
</property>
<layout class="QVBoxLayout" name="verticalLayout_9">
<item>
<widget class="QPlainTextEdit" name="plainTextEdit_2">
<property name="readOnly">
<bool>true</bool>
</property>
</widget>
</item>
</layout>
</widget>
</item>
</layout>
</item>
</layout>
</widget>
</widget>
<resources/>
<connections/>
<slots>
<slot>slotPage()</slot>
<slot>slotPage1()</slot>
</slots>
</ui>
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment