From 6b8a2279d155dae0d982a353d24d1623f4332209 Mon Sep 17 00:00:00 2001 From: Agnieszka Kostrzewa Date: Tue, 24 Jan 2012 01:18:32 +0100 Subject: [PATCH] Added multiselectwidget for future use in multiple windows --- Makefile | 2 +- multiselectwidget.ui | 97 ++++++++++ qubesmanager/multiselectwidget.py | 39 ++++ settingsdlg.ui | 290 ++++++++++++++++++++++++++++++ 4 files changed, 427 insertions(+), 1 deletion(-) create mode 100644 multiselectwidget.ui create mode 100644 qubesmanager/multiselectwidget.py create mode 100644 settingsdlg.ui diff --git a/Makefile b/Makefile index 4273819..ac2f310 100644 --- a/Makefile +++ b/Makefile @@ -6,5 +6,5 @@ res: pyuic4 -o qubesmanager/ui_newappvmdlg.py newappvmdlg.ui pyuic4 -o qubesmanager/ui_editfwrulesdlg.py editfwrulesdlg.ui pyuic4 -o qubesmanager/ui_newfwruledlg.py newfwruledlg.ui - + pyuic4 -o qubesmanager/ui_multiselectwidget.py multiselectwidget.ui clean: diff --git a/multiselectwidget.ui b/multiselectwidget.ui new file mode 100644 index 0000000..4109c9f --- /dev/null +++ b/multiselectwidget.ui @@ -0,0 +1,97 @@ + + + MultiSelectWidget + + + + 0 + 0 + 602 + 300 + + + + Form + + + + + + Qt::Horizontal + + + + 10 + 20 + + + + + + + + + + + + + Qt::Vertical + + + + 20 + 40 + + + + + + + + > + + + + + + + < + + + + + + + Qt::Vertical + + + + 20 + 40 + + + + + + + + + + + + + Qt::Horizontal + + + + 10 + 20 + + + + + + + + + diff --git a/qubesmanager/multiselectwidget.py b/qubesmanager/multiselectwidget.py new file mode 100644 index 0000000..f5850df --- /dev/null +++ b/qubesmanager/multiselectwidget.py @@ -0,0 +1,39 @@ +import sys +from PyQt4.QtCore import * +from PyQt4.QtGui import * +from ui_multiselectwidget import * + +class MultiSelectWidget(Ui_MultiSelectWidget, QWidget): + + def __init__(self, parent=None): + super(MultiSelectWidget, self).__init__() + self.setupUi(self); + self.add_selected_button.clicked.connect(self.add_selected) + self.remove_selected_button.clicked.connect(self.remove_selected) + + def switch_selected(self, src, dst): + selected = src.selectedItems() + + for s in selected: + row = src.indexFromItem(s).row() + item = src.takeItem(row) + dst.addItem(item) + + + def add_selected(self): + print "Add selected triggered!" + self.switch_selected(self.available_list, self.selected_list) + + + def remove_selected(self): + print "Remove selected triggered!" + self.switch_selected(self.selected_list, self.available_list) + + + + +if __name__ == "__main__": + app = QtGui.QApplication(sys.argv) + ui = MultiSelectWidget() + ui.show() + sys.exit(app.exec_()) diff --git a/settingsdlg.ui b/settingsdlg.ui new file mode 100644 index 0000000..ec81baa --- /dev/null +++ b/settingsdlg.ui @@ -0,0 +1,290 @@ + + + Dialog + + + + 0 + 0 + 672 + 351 + + + + Settings + + + + + + + + + + + 3 + + + + + + + Basic + + + + + + Name & label: + + + + + + + myappvm + + + + + + + true + + + + + + + Use this template: + + + + + + + + + + Allow networking + + + true + + + + + + + Qt::Vertical + + + + 20 + 157 + + + + + + + + + Advanced + + + + + + Disk storage + + + + + + false + + + Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter + + + 10000 + + + 2 + + + + + + + false + + + Allow to grow + + + + + + + GB + + + + + + + Private storage max. size + + + + + + + false + + + Include in backups + + + true + + + + + + + + + + Memory/CPU + + + + + + false + + + Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter + + + 10000 + + + 100 + + + 400 + + + + + + + MB + + + + + + + false + + + Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter + + + 1 + + + + + + + VCPUs + + + + + + + + + + Qt::Vertical + + + + 20 + 124 + + + + + + + + + Devices + + + + + + Applications + + + + + + + + Qt::Horizontal + + + QDialogButtonBox::Cancel|QDialogButtonBox::Ok + + + + + + + + + + + buttonBox + accepted() + Dialog + accept() + + + 248 + 254 + + + 157 + 274 + + + + + buttonBox + rejected() + Dialog + reject() + + + 316 + 260 + + + 286 + 274 + + + + +