Commit 6155285a87527bc05c753eeee9741e142e156dab

Authored by Silvan Calarco
0 parents
Exists in master

First commit

Showing 3 changed files with 411 additions and 0 deletions Side-by-side Diff

... ... @@ -0,0 +1,2 @@
  1 +mambabase_ui.py: mambabase.ui
  2 + pyuic4 mambabase.ui > mambabase_ui.py
... ... @@ -0,0 +1,100 @@
  1 +#!/usr/bin/env python
  2 +
  3 +from PyQt4 import QtCore
  4 +from PyQt4 import QtGui
  5 +from PyQt4.QtCore import pyqtProperty
  6 +from gi.repository import PackageKitGlib as packagekit
  7 +
  8 +from mambabase_ui import *
  9 +import subprocess
  10 +
  11 +PackageGroups = [ \
  12 +{ 'name':'inst_base', 'group': 'BASE', 'description': 'System base packages (recommended)'}, \
  13 +{ 'name':'inst_office', 'group': 'OFFICE', 'description': 'Office packages (OpenOffice, Groupware, PDA Syncronization, ...)'}, \
  14 +{ 'name':'inst_players', 'group': 'MULTIMEDIA_PLAYERS', 'description': 'Audio and Video players (amarok, xmms, vlc, kaffeine, miro, ...)'}, \
  15 +{ 'name':'inst_multimedia_editing', 'group': 'MULTIMEDIA_EDITING', 'description': 'Multimedia editing and production (kino, audacity, rosegarden, mixxx, ...)'}, \
  16 +{ 'name':'inst_internet', 'group': 'INTERNET', 'description': 'Internet communication and p2p (kopete, pidgin, ekiga, aMule, ...)'}, \
  17 +{ 'name':'inst_graphics', 'group': 'GRAPHICS', 'description': 'Graphics software (gimp, digikam, blender, sodipodi, ...)'}, \
  18 +{ 'name':'inst_games', 'group': 'GAMES', 'description': 'Games (turacer, pingus, ksudoku, ...)'}, \
  19 +{ 'name':'inst_virtualization', 'group': 'VIRTUALIZATION', 'description': 'Emulation and virtuali&zation (VirtualBox, kvm, QtEmu, wine, ...)'}, \
  20 +{ 'name':'inst_server', 'group': 'SERVER', 'description': 'Base server packages (apache, postfix, vsftpd, php, mysql, ...)'}, \
  21 +{ 'name':'inst_devel', 'group': 'DEVEL', 'description': 'Base development packages (gcc, glibc-devel, kernel sources, ...)'}, \
  22 +]
  23 +
  24 +ProprietaryPackages = [ \
  25 +{ 'name':'inst_nvidia', 'pkg': 'xorg-drv-video-nvidia', 'description': 'NVIDIA proprietary video driver from openmamba.org'}, \
  26 +{ 'name':'inst_nvidia_legacy', 'pkg': 'xorg-drv-video-nvidia_304', 'description': 'NVIDIA proprietary video driver (legacy) from openmamba.org'}, \
  27 +{ 'name':'inst_fglrx', 'pkg': 'xorg-drv-video-fglrx', 'description': 'AMD/ATI proprietary video driver from openmamba.org'}, \
  28 +{ 'name':'inst_fglrx_legacy', 'pkg': 'xorg-drv-video-fglrx-legacy', 'description': 'AMD/ATI proprietary video driver (legacy) from openmamba.org'}, \
  29 +{ 'name':'inst_broadcom_sta', 'pkg': 'broadcom-sta', 'description': 'Broadcom-sta proprietary wireless driver from openmamba.org'}, \
  30 +{ 'name':'inst_b43', 'pkg': 'b43-firmware', 'description': 'Broadcom B43 proprietary firmware from openwrt.org'}, \
  31 +{ 'name':'inst_flash', 'pkg': 'flashplugin', 'description': 'Flash plugin from adobe.com'}, \
  32 +{ 'name':'inst_msttcf', 'pkg': 'msttcorefonts', 'description': 'MS TrueType core fonts from sourceforge'}, \
  33 +{ 'name':'inst_codecs', 'pkg': 'win32codecs', 'description': 'Win32 codecs from mplayerhq.hu'}, \
  34 +{ 'name':'inst_java', 'pkg': 'sun-java7', 'description': 'Oracle Java 7 from oracle.com'}, \
  35 +{ 'name':'inst_skype', 'pkg': 'skype', 'description': 'Skype from skype.com'}, \
  36 +{ 'name':'inst_spotify', 'pkg': 'spotify', 'description': 'Spotify from spotify.com'}, \
  37 +{ 'name':'inst_virtualbox', 'pkg': 'virtualbox-extension-pack', 'description': 'Virtualbox extension pack from virtualbox.org'}, \
  38 +]
  39 +
  40 +def progress_cb(status, typ, data=None):
  41 + if status.get_property('package'):
  42 + print "Pachet ", status.get_property('package'), status.get_property('package-id')
  43 + if status.get_property('package'):
  44 + print status.get_property('package').get_name()
  45 +# print typ, status.get_property('package')
  46 +
  47 +class MyWizard(QtGui.QWizard):
  48 + def __init__(self, parent=None):
  49 + QtGui.QWizard.__init__(self, parent)
  50 +
  51 +def resolve_group(group):
  52 + p = subprocess.check_output("/bin/bash -c \"source /usr/share/openmamba/pkggroups.db;echo \$"+group+"_PKGS\"",\
  53 + shell=True, stderr=subprocess.PIPE)
  54 + return p
  55 +
  56 +if __name__ == "__main__":
  57 + import sys
  58 + app = QtGui.QApplication(sys.argv)
  59 + Wizard = MyWizard()
  60 + ui = Ui_Wizard()
  61 + ui.setupUi(Wizard)
  62 +
  63 + Wizard.show()
  64 +
  65 + QtGui.QApplication.setOverrideCursor(QtGui.QCursor(QtCore.Qt.WaitCursor))
  66 + Wizard.button(QtGui.QWizard.NextButton).setEnabled(0)
  67 + pkclient = packagekit.Client()
  68 + for p in PackageGroups:
  69 + app.processEvents()
  70 + item_0 = QtGui.QTreeWidgetItem(ui.treeWidget)
  71 + item_0.setText(0, p['description'])
  72 + item_0.setCheckState(0, QtCore.Qt.Unchecked)
  73 + gpkgs = resolve_group(p['group'])
  74 + for d in gpkgs.split(" "):
  75 + print d
  76 + item_1 = QtGui.QTreeWidgetItem(item_0)
  77 + item_1.setText(0, d)
  78 + result = pkclient.resolve(packagekit.FilterEnum.INSTALLED, d, None, progress_cb, None)
  79 + pkgs = result.get_package_array()
  80 + if len(pkgs) > 0:
  81 + item_1.setCheckState(0, QtCore.Qt.Checked)
  82 + else:
  83 + item_1.setCheckState(0, QtCore.Qt.Unchecked)
  84 +
  85 + for p in ProprietaryPackages:
  86 + app.processEvents()
  87 + item_0 = QtGui.QTreeWidgetItem(ui.treeWidget_2)
  88 + item_0.setText(0, p['description'])
  89 + result = pkclient.resolve(packagekit.FilterEnum.INSTALLED, [p['pkg'],], None, progress_cb, None)
  90 + pkgs = result.get_package_array()
  91 + if len(pkgs) > 0:
  92 + item_0.setCheckState(0, QtCore.Qt.Checked)
  93 + item_0.setDisabled(1)
  94 + else:
  95 + item_0.setCheckState(0, QtCore.Qt.Unchecked)
  96 + QtGui.QApplication.restoreOverrideCursor()
  97 + Wizard.button(QtGui.QWizard.NextButton).setEnabled(1)
  98 +
  99 + sys.exit(app.exec_())
  100 +
... ... @@ -0,0 +1,309 @@
  1 +<?xml version="1.0" encoding="UTF-8"?>
  2 +<ui version="4.0">
  3 + <class>Wizard</class>
  4 + <widget class="QWizard" name="Wizard">
  5 + <property name="geometry">
  6 + <rect>
  7 + <x>0</x>
  8 + <y>0</y>
  9 + <width>750</width>
  10 + <height>500</height>
  11 + </rect>
  12 + </property>
  13 + <property name="sizePolicy">
  14 + <sizepolicy hsizetype="Maximum" vsizetype="Maximum">
  15 + <horstretch>0</horstretch>
  16 + <verstretch>0</verstretch>
  17 + </sizepolicy>
  18 + </property>
  19 + <property name="minimumSize">
  20 + <size>
  21 + <width>750</width>
  22 + <height>500</height>
  23 + </size>
  24 + </property>
  25 + <property name="font">
  26 + <font>
  27 + <pointsize>10</pointsize>
  28 + </font>
  29 + </property>
  30 + <property name="windowTitle">
  31 + <string>openmamba base installations</string>
  32 + </property>
  33 + <property name="windowIcon">
  34 + <iconset>
  35 + <normaloff>../../../../../home/silvan/openmamba/openmamba3/openmamba-256x256.png</normaloff>../../../../../home/silvan/openmamba/openmamba3/openmamba-256x256.png</iconset>
  36 + </property>
  37 + <property name="autoFillBackground">
  38 + <bool>false</bool>
  39 + </property>
  40 + <property name="sizeGripEnabled">
  41 + <bool>false</bool>
  42 + </property>
  43 + <property name="wizardStyle">
  44 + <enum>QWizard::ModernStyle</enum>
  45 + </property>
  46 + <property name="options">
  47 + <set>QWizard::NoBackButtonOnStartPage</set>
  48 + </property>
  49 + <widget class="QWizardPage" name="wizardPage1">
  50 + <property name="title">
  51 + <string>Welcome!</string>
  52 + </property>
  53 + <property name="subTitle">
  54 + <string>Customize your openmamba installation</string>
  55 + </property>
  56 + <attribute name="pageId">
  57 + <string notr="true">welcome</string>
  58 + </attribute>
  59 + <layout class="QVBoxLayout" name="verticalLayout_8">
  60 + <item>
  61 + <widget class="QProgressBar" name="progressBar_2">
  62 + <property name="value">
  63 + <number>24</number>
  64 + </property>
  65 + </widget>
  66 + </item>
  67 + <item>
  68 + <widget class="QLabel" name="label_3">
  69 + <property name="font">
  70 + <font>
  71 + <pointsize>10</pointsize>
  72 + </font>
  73 + </property>
  74 + <property name="text">
  75 + <string>Press Next to continue.</string>
  76 + </property>
  77 + </widget>
  78 + </item>
  79 + </layout>
  80 + </widget>
  81 + <widget class="QWizardPage" name="wizardPage2">
  82 + <property name="title">
  83 + <string>openmamba base components</string>
  84 + </property>
  85 + <property name="subTitle">
  86 + <string>Select the groups of packages you want to install</string>
  87 + </property>
  88 + <layout class="QVBoxLayout" name="verticalLayout_2">
  89 + <item>
  90 + <layout class="QVBoxLayout" name="verticalLayout">
  91 + <item>
  92 + <widget class="QLabel" name="label">
  93 + <property name="text">
  94 + <string>Please, select from the boxes below the components that you want to install or update from network.</string>
  95 + </property>
  96 + </widget>
  97 + </item>
  98 + <item>
  99 + <layout class="QHBoxLayout" name="horizontalLayout">
  100 + <item>
  101 + <widget class="QTreeWidget" name="treeWidget">
  102 + <property name="sizePolicy">
  103 + <sizepolicy hsizetype="Expanding" vsizetype="Expanding">
  104 + <horstretch>0</horstretch>
  105 + <verstretch>0</verstretch>
  106 + </sizepolicy>
  107 + </property>
  108 + <property name="alternatingRowColors">
  109 + <bool>false</bool>
  110 + </property>
  111 + <property name="selectionMode">
  112 + <enum>QAbstractItemView::MultiSelection</enum>
  113 + </property>
  114 + <property name="headerHidden">
  115 + <bool>false</bool>
  116 + </property>
  117 + <column>
  118 + <property name="text">
  119 + <string>Group</string>
  120 + </property>
  121 + </column>
  122 + </widget>
  123 + </item>
  124 + </layout>
  125 + </item>
  126 + </layout>
  127 + </item>
  128 + </layout>
  129 + </widget>
  130 + <widget class="QWizardPage" name="wizardPage3">
  131 + <property name="title">
  132 + <string>Non free/proprietary components</string>
  133 + </property>
  134 + <property name="subTitle">
  135 + <string>Select the proprietary components you want to install</string>
  136 + </property>
  137 + <layout class="QVBoxLayout" name="verticalLayout_4">
  138 + <item>
  139 + <layout class="QVBoxLayout" name="verticalLayout_3">
  140 + <item>
  141 + <widget class="QLabel" name="label_5">
  142 + <property name="text">
  143 + <string>The following components are recommended for optimal desktop use but do not have an Open Source license.
  144 +WARNING: you'll have to accept a license agreement for most selected packages.</string>
  145 + </property>
  146 + <property name="wordWrap">
  147 + <bool>true</bool>
  148 + </property>
  149 + </widget>
  150 + </item>
  151 + <item>
  152 + <widget class="QTreeWidget" name="treeWidget_2">
  153 + <column>
  154 + <property name="text">
  155 + <string>Proprietary software installations</string>
  156 + </property>
  157 + </column>
  158 + </widget>
  159 + </item>
  160 + </layout>
  161 + </item>
  162 + </layout>
  163 + </widget>
  164 + <widget class="QWizardPage" name="wizardPage4">
  165 + <property name="title">
  166 + <string>Installation in progress</string>
  167 + </property>
  168 + <property name="subTitle">
  169 + <string>Please wait for the installation to be completed...</string>
  170 + </property>
  171 + <layout class="QVBoxLayout" name="verticalLayout_6">
  172 + <item>
  173 + <layout class="QVBoxLayout" name="verticalLayout_5">
  174 + <item>
  175 + <spacer name="verticalSpacer_2">
  176 + <property name="orientation">
  177 + <enum>Qt::Vertical</enum>
  178 + </property>
  179 + <property name="sizeType">
  180 + <enum>QSizePolicy::Fixed</enum>
  181 + </property>
  182 + <property name="sizeHint" stdset="0">
  183 + <size>
  184 + <width>20</width>
  185 + <height>40</height>
  186 + </size>
  187 + </property>
  188 + </spacer>
  189 + </item>
  190 + <item>
  191 + <widget class="QProgressBar" name="progressBar">
  192 + <property name="value">
  193 + <number>24</number>
  194 + </property>
  195 + </widget>
  196 + </item>
  197 + <item>
  198 + <widget class="QLabel" name="label_2">
  199 + <property name="font">
  200 + <font>
  201 + <pointsize>14</pointsize>
  202 + </font>
  203 + </property>
  204 + <property name="text">
  205 + <string>Starting installation of selected components...</string>
  206 + </property>
  207 + </widget>
  208 + </item>
  209 + <item>
  210 + <spacer name="verticalSpacer">
  211 + <property name="orientation">
  212 + <enum>Qt::Vertical</enum>
  213 + </property>
  214 + <property name="sizeType">
  215 + <enum>QSizePolicy::Fixed</enum>
  216 + </property>
  217 + <property name="sizeHint" stdset="0">
  218 + <size>
  219 + <width>20</width>
  220 + <height>40</height>
  221 + </size>
  222 + </property>
  223 + </spacer>
  224 + </item>
  225 + <item>
  226 + <widget class="QGroupBox" name="groupBox">
  227 + <property name="sizePolicy">
  228 + <sizepolicy hsizetype="Expanding" vsizetype="Expanding">
  229 + <horstretch>0</horstretch>
  230 + <verstretch>0</verstretch>
  231 + </sizepolicy>
  232 + </property>
  233 + <property name="title">
  234 + <string>Details</string>
  235 + </property>
  236 + <layout class="QGridLayout" name="gridLayout">
  237 + <item row="0" column="0">
  238 + <widget class="QPlainTextEdit" name="plainTextEdit">
  239 + <property name="maximumSize">
  240 + <size>
  241 + <width>681</width>
  242 + <height>16777215</height>
  243 + </size>
  244 + </property>
  245 + <property name="readOnly">
  246 + <bool>true</bool>
  247 + </property>
  248 + </widget>
  249 + </item>
  250 + </layout>
  251 + </widget>
  252 + </item>
  253 + </layout>
  254 + </item>
  255 + </layout>
  256 + </widget>
  257 + <widget class="QWizardPage" name="wizardPage5">
  258 + <property name="title">
  259 + <string>Installation completed!</string>
  260 + </property>
  261 + <property name="subTitle">
  262 + <string>End of the installation.</string>
  263 + </property>
  264 + <layout class="QVBoxLayout" name="verticalLayout_11">
  265 + <item>
  266 + <layout class="QVBoxLayout" name="verticalLayout_10">
  267 + <item>
  268 + <widget class="QLabel" name="label_4">
  269 + <property name="font">
  270 + <font>
  271 + <pointsize>10</pointsize>
  272 + </font>
  273 + </property>
  274 + <property name="text">
  275 + <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>
  276 + </property>
  277 + <property name="wordWrap">
  278 + <bool>true</bool>
  279 + </property>
  280 + </widget>
  281 + </item>
  282 + <item>
  283 + <widget class="QGroupBox" name="groupBox_2">
  284 + <property name="title">
  285 + <string>Installation log</string>
  286 + </property>
  287 + <layout class="QVBoxLayout" name="verticalLayout_9">
  288 + <item>
  289 + <widget class="QPlainTextEdit" name="plainTextEdit_2">
  290 + <property name="readOnly">
  291 + <bool>true</bool>
  292 + </property>
  293 + </widget>
  294 + </item>
  295 + </layout>
  296 + </widget>
  297 + </item>
  298 + </layout>
  299 + </item>
  300 + </layout>
  301 + </widget>
  302 + </widget>
  303 + <resources/>
  304 + <connections/>
  305 + <slots>
  306 + <slot>slotPage()</slot>
  307 + <slot>slotPage1()</slot>
  308 + </slots>
  309 +</ui>