paulb@332 | 1 | import QtConfigurator.Forms |
paulb@338 | 2 | import XSLForms.Prepare |
paulb@338 | 3 | import factory |
paulb@332 | 4 | import qtui |
paulb@332 | 5 | import os |
paulb@332 | 6 | |
paulb@332 | 7 | class Configurator(QtConfigurator.Forms.Configurator): |
paulb@332 | 8 | |
paulb@332 | 9 | resource_dir = os.path.join(os.path.split(__file__)[0], "Resources") |
paulb@332 | 10 | ui_filename = os.path.join(resource_dir, "config.ui") |
paulb@332 | 11 | ui_hard_disks_filename = os.path.join(resource_dir, "config_hard_disks.ui") |
paulb@338 | 12 | ui_memory_units_filename = os.path.join(resource_dir, "config_memory_units.ui") |
paulb@338 | 13 | ui_storage_units_filename = os.path.join(resource_dir, "config_storage_units.ui") |
paulb@332 | 14 | |
paulb@332 | 15 | def __init__(self, *args, **kw): |
paulb@332 | 16 | QtConfigurator.Forms.Configurator.__init__(self, *args, **kw) |
paulb@338 | 17 | self.factory = factory.Factory(self.ui_filename) |
paulb@338 | 18 | XSLForms.Prepare.ensure_qt_fragment(self.ui_filename, self.ui_hard_disks_filename, "hard_disks") |
paulb@338 | 19 | XSLForms.Prepare.ensure_qt_fragment(self.ui_filename, self.ui_memory_units_filename, "memory_units") |
paulb@338 | 20 | XSLForms.Prepare.ensure_qt_fragment(self.ui_filename, self.ui_storage_units_filename, "storage_units") |
paulb@332 | 21 | |
paulb@332 | 22 | def baseSystemChanged(self): |
paulb@332 | 23 | print self.base_system.currentItem() |
paulb@332 | 24 | |
paulb@332 | 25 | def addHardDisk(self): |
paulb@332 | 26 | hard_disks = qtui.QWidgetFactory.create(self.ui_hard_disks_filename) |
paulb@332 | 27 | tab_pages = hard_disks.child("tab pages") |
paulb@332 | 28 | tab = tab_pages.child("tab") |
paulb@332 | 29 | self.hard_disks.addTab(tab, hard_disks.tabLabel(tab)) |
paulb@338 | 30 | self.factory.connect(tab, self) |
paulb@332 | 31 | |
paulb@332 | 32 | def addMemoryUnit(self): |
paulb@338 | 33 | memory_units = qtui.QWidgetFactory.create(self.ui_memory_units_filename) |
paulb@338 | 34 | tab_pages = memory_units.child("tab pages") |
paulb@338 | 35 | tab = tab_pages.child("tab") |
paulb@338 | 36 | self.memory_units.addTab(tab, memory_units.tabLabel(tab)) |
paulb@338 | 37 | self.factory.connect(tab, self) |
paulb@332 | 38 | |
paulb@332 | 39 | def addStorageUnit(self): |
paulb@338 | 40 | storage_units = qtui.QWidgetFactory.create(self.ui_storage_units_filename) |
paulb@338 | 41 | tab_pages = storage_units.child("tab pages") |
paulb@338 | 42 | tab = tab_pages.child("tab") |
paulb@338 | 43 | self.storage_units.addTab(tab, storage_units.tabLabel(tab)) |
paulb@338 | 44 | self.factory.connect(tab, self) |
paulb@332 | 45 | |
paulb@332 | 46 | def removeHardDisk(self): |
paulb@332 | 47 | page = self.hard_disks.currentPage() |
paulb@332 | 48 | self.hard_disks.removePage(page) |
paulb@338 | 49 | page.deleteLater() |
paulb@332 | 50 | |
paulb@332 | 51 | def removeMemoryUnit(self): |
paulb@332 | 52 | page = self.memory_units.currentPage() |
paulb@332 | 53 | self.memory_units.removePage(page) |
paulb@338 | 54 | page.deleteLater() |
paulb@332 | 55 | |
paulb@332 | 56 | def removeStorageUnit(self): |
paulb@332 | 57 | page = self.storage_units.currentPage() |
paulb@332 | 58 | self.storage_units.removePage(page) |
paulb@338 | 59 | page.deleteLater() |
paulb@332 | 60 | |
paulb@332 | 61 | def updateConfig(self): |
paulb@332 | 62 | print "configuration.updateConfig(): Not implemented yet" |
paulb@332 | 63 | |
paulb@332 | 64 | def exportConfig(self): |
paulb@332 | 65 | print "configuration.exportConfig(): Not implemented yet" |
paulb@332 | 66 | |
paulb@332 | 67 | # vim: tabstop=4 expandtab shiftwidth=4 |