def __init__(self, parent=None):

        self._window = QtGui.QDialog(None)
        self._window.setWindowIcon(QtGui.QIcon(getPixmap("smart")))
        self._window.setWindowTitle(_("Mirrors"))
        self._window.setModal(True)

        self._window.setMinimumSize(600, 400)

        layout = QtGui.QVBoxLayout(self._window)
        #layout.setResizeMode(QtGui.QLayout.FreeResize)

        vbox = QtGui.QWidget(self._window)
        QtGui.QVBoxLayout(vbox)
        vbox.layout().setMargin(10)
        vbox.layout().setSpacing(10)
        vbox.show()

        layout.addWidget(vbox)

        self._treeview = QtGui.QTreeWidget(vbox)
        self._treeview.setHeaderHidden(True)
        self._treeview.show()
        vbox.layout().addWidget(self._treeview)

        #self._treeview.addColumn(_("Mirror"))
        self._treeview.setHeaderLabels([_("Mirror")])
        QtCore.QObject.connect(self._treeview, QtCore.SIGNAL("itemChanged(QTreeWidgetItem *, int)"), self.itemChanged)
        QtCore.QObject.connect(self._treeview, QtCore.SIGNAL("itemSelectionChanged()"), self.selectionChanged)

        bbox = QtGui.QWidget(vbox)
        QtGui.QHBoxLayout(bbox)
        bbox.layout().setSpacing(10)
        bbox.layout().addStretch(1)
        bbox.show()
        vbox.layout().addWidget(bbox)

        button = QtGui.QPushButton(_("New"), bbox)
        button.setEnabled(True)
        button.setIcon(QtGui.QIcon(getPixmap("crystal-add")))
        button.show()
        QtCore.QObject.connect(button, QtCore.SIGNAL("clicked()"), self.newMirror)
        self._newmirror = button
        bbox.layout().addWidget(button)

        button = QtGui.QPushButton(_("Delete"), bbox)
        button.setEnabled(False)
        button.setIcon(QtGui.QIcon(getPixmap("crystal-delete")))
        button.show()
        QtCore.QObject.connect(button, QtCore.SIGNAL("clicked()"), self.delMirror)
        self._delmirror = button
        bbox.layout().addWidget(button)

        button = QtGui.QPushButton(_("Close"), bbox)
        QtCore.QObject.connect(button, QtCore.SIGNAL("clicked()"), self._window, QtCore.SLOT("accept()"))
        bbox.layout().addWidget(button)
        
        button.setDefault(True)
    def __init__(self, parent=None):

        self._window = QtGui.QDialog(parent)
        self._window.setWindowIcon(QtGui.QIcon(getPixmap("smart")))
        self._window.setWindowTitle(_("New Channel"))
        self._window.setModal(True)

        layout = QtGui.QVBoxLayout(self._window) 
        
        #vbox = QtGui.QVBox(self._window)
        vbox = QtGui.QWidget(self._window)
        layout.addWidget(vbox)
        layout = QtGui.QVBoxLayout(vbox) 
        layout.setMargin(10)
        layout.setSpacing(10)
        vbox.show()
        self._vbox = vbox

        #table = QtGui.QGrid(2, vbox)
        table = QtGui.QWidget(vbox)
        layout.addWidget(table)
        QtGui.QGridLayout(table)
        table.layout().setSpacing(10)
        table.show()
        self._table = table
        
        label = QtGui.QLabel(_("Type:"), table)
        table.layout().addWidget(label)

        self._typevbox = QtGui.QGroupBox(table)
        QtGui.QVBoxLayout(self._typevbox)
        #self._typevbox.setFrameStyle(QtGui.QFrame.NoFrame)
        self._typevbox.show()
        table.layout().addWidget(self._typevbox)

        sep = QtGui.QFrame(vbox)
        sep.setFrameShape(QtGui.QFrame.HLine)
        sep.setFrameShadow(QtGui.QFrame.Sunken)
        sep.show()
        layout.addWidget(sep)

        #bbox = QtGui.QHBox(vbox)
        bbox = QtGui.QWidget(vbox)
        layout.addWidget(bbox)
        layout = QtGui.QHBoxLayout(bbox)
        bbox.layout().setSpacing(10)
        bbox.layout().addStretch(1)
        bbox.show()

        button = QtGui.QPushButton(_("Cancel"), bbox)
        QtCore.QObject.connect(button, QtCore.SIGNAL("clicked()"), self._window, QtCore.SLOT("reject()"))
        layout.addWidget(button)

        button = QtGui.QPushButton(_("OK"), bbox)
        QtCore.QObject.connect(button, QtCore.SIGNAL("clicked()"), self._window, QtCore.SLOT("accept()"))
        layout.addWidget(button)

        self._ok = button
        self._ok.setEnabled(False)
Exemple #3
0
 def inserttool(toolbar, tool):
     if tool:
         action = self._actions[tool]
         pixmap = getPixmap(TOOLBARICONS[tool])
         action.setIcon(QtGui.QIcon(pixmap))
         toolbar.addAction(action)
     else:
         toolbar.addSeparator()
Exemple #4
0
 def inserttool(toolbar, tool):
     if tool:
         action = self._actions[tool]
         pixmap = getPixmap(TOOLBARICONS[tool])
         action.setIcon(QtGui.QIcon(pixmap))
         toolbar.addAction(action)
     else:
         toolbar.addSeparator()
Exemple #5
0
    def __init__(self, parent=None):
        QtGui.QDialog.__init__(self, parent)

        self.setWindowIcon(QtGui.QIcon(getPixmap("smart")))
        self.setWindowTitle(_("Log"))
        self.setMinimumSize(400, 300)
        #self.setModal(True)

        layout = QtGui.QVBoxLayout(self)
        #layout.setResizeMode(QtGui.QLayout.FreeResize)

        self._vbox = QtGui.QWidget(self)
        QtGui.QVBoxLayout(self._vbox)
        self._vbox.layout().setMargin(10)
        self._vbox.layout().setSpacing(10)
        self._vbox.show()

        layout.addWidget(self._vbox)

        self._scrollview = BackgroundScrollView(self._vbox)
        self._scrollview.setWidgetResizable(True)
        self._scrollview.setVerticalScrollBarPolicy(QtCore.Qt.ScrollBarAlwaysOn)
        self._scrollview.setFrameStyle(QtGui.QFrame.StyledPanel | QtGui.QFrame.Sunken)
        self._scrollview.show()
        self._vbox.layout().addWidget(self._scrollview)

        self._textview = QtGui.QLabel(self._scrollview.viewport())
        self._textview.setAlignment(QtCore.Qt.AlignTop)
        self._textview.setTextFormat(QtCore.Qt.LogText)
        self._textview.setAutoFillBackground(True)
        self._textview.setBackgroundRole(QtGui.QPalette.Base)
        self._textview.show()
        self._textview.adjustSize()
        
        #self._textview.setEraseColor(self._scrollview.eraseColor())
        self._scrollview.setWidget(self._textview)

        self._buttonbox = QtGui.QWidget(self._vbox)
        QtGui.QHBoxLayout(self._buttonbox)
        self._buttonbox.layout().setSpacing(10)
        self._buttonbox.layout().addStretch(1)
        self._buttonbox.show()
        self._vbox.layout().addWidget(self._buttonbox)

        self._clearbutton = QtGui.QPushButton(_("Clear"), self._buttonbox)
        self._clearbutton.show()
        QtCore.QObject.connect(self._clearbutton, QtCore.SIGNAL("clicked()"), self.clearText)
        self._buttonbox.layout().addWidget(self._clearbutton)

        self._closebutton = QtGui.QPushButton(_("Close"), self._buttonbox)
        self._closebutton.show()
        QtCore.QObject.connect(self._closebutton, QtCore.SIGNAL("clicked()"), self, QtCore.SLOT("hide()"))
        self._buttonbox.layout().addWidget(self._closebutton)

        self._closebutton.setDefault(True)
Exemple #6
0
    def __init__(self, parent=None):

        self._fields = {}
        self._fieldn = 0

        self._window = QtGui.QDialog(parent)
        self._window.setWindowIcon(QtGui.QIcon(getPixmap("smart")))
        self._window.setWindowTitle(_("Edit Channel"))
        self._window.setModal(True)

        layout = QtGui.QVBoxLayout(self._window)
        #layout.setResizeMode(QtGui.QLayout.FreeResize)

        vbox = QtGui.QWidget(self._window)
        layout.addWidget(vbox)
        layout = QtGui.QVBoxLayout(vbox)
        layout.setMargin(10)
        layout.setSpacing(10)
        vbox.show()

        #layout.addWidget(vbox)
        self._vbox = vbox

        #self._table = QtGui.QGrid(2, vbox)
        self._table = QtGui.QWidget(vbox)
        QtGui.QGridLayout(self._table)
        self._table.layout().setSpacing(10)
        self._table.show()
        layout.addWidget(self._table)

        sep = QtGui.QFrame(vbox)
        sep.setFrameShape(QtGui.QFrame.HLine)
        sep.setFrameShadow(QtGui.QFrame.Sunken)
        sep.show()
        layout.addWidget(sep)

        #bbox = QtGui.QHBox(vbox)
        bbox = QtGui.QWidget(vbox)
        layout.addWidget(bbox)
        layout = QtGui.QHBoxLayout(bbox)
        bbox.layout().setSpacing(10)
        bbox.layout().addStretch(1)
        bbox.show()

        button = QtGui.QPushButton(_("Cancel"), bbox)
        QtCore.QObject.connect(button, QtCore.SIGNAL("clicked()"),
                               self._window, QtCore.SLOT("reject()"))
        layout.addWidget(button)

        button = QtGui.QPushButton(_("OK"), bbox)
        QtCore.QObject.connect(button, QtCore.SIGNAL("clicked()"),
                               self._window, QtCore.SLOT("accept()"))
        layout.addWidget(button)

        button.setDefault(True)
Exemple #7
0
    def __init__(self):
        self._window = QtGui.QDialog()
        self._window.setWindowIcon(QtGui.QIcon(getPixmap("smart")))
        self._window.setWindowTitle(_("Status"))
        self._window.setModal(True)
        self._vbox = QtGui.QWidget(self._window)
        self._vbox.setMargin(20)

        self._label = QtGui.QLabel(self._vbox)
        self._label.show()

        self._lastshown = 0
Exemple #8
0
    def __init__(self, parent=None):

        self._window = QtGui.QDialog(parent)
        self._window.setWindowIcon(QtGui.QIcon(getPixmap("smart")))
        self._window.setWindowTitle(_("New Target"))
        self._window.setModal(True)

        #self._window.setMinimumSize(600, 400)

        vbox = QtGui.QWidget(self._window)
        QtGui.QVBoxLayout(vbox)
        vbox.layout().setMargin(10)
        vbox.layout().setSpacing(10)
        vbox.show()

        table = QtGui.QWidget(vbox)  # 2
        QtGui.QGridLayout(table)
        table.layout().setSpacing(10)
        table.show()

        label = QtGui.QLabel(_("Target:"), table)

        self._target = QtGui.QLineEdit(table)
        self._target.setMaxLength(40)
        self._target.show()

        blank = QtGui.QWidget(table)

        label = QtGui.QLabel(
            _("Examples: \"pkgname\", \"pkgname = 1.0\" or "
              "\"pkgname <= 1.0\""), table)

        sep = QtGui.QFrame(vbox)
        sep.setFrameShape(QtGui.QFrame.HLine)
        sep.setFrameShadow(QtGui.QFrame.Sunken)
        sep.show()

        bbox = QtGui.QWidget(vbox)
        QtGui.QHBoxLayout(bbox)
        bbox.layout().setSpacing(10)
        bbox.layout().addStretch(1)
        bbox.show()

        button = QtGui.QPushButton(bbox.tr("OK"), bbox)
        QtCore.QObject.connect(button, QtCore.SIGNAL("clicked()"),
                               self._window, QtCore.SLOT("accept()"))

        button = QtGui.QPushButton(bbox.tr("Cancel"), bbox)
        QtCore.QObject.connect(button, QtCore.SIGNAL("clicked()"),
                               self._window, QtCore.SLOT("reject()"))

        vbox.adjustSize()
        self._window.adjustSize()
    def __init__(self, parent=None):

        self._fields = {}
        self._fieldn = 0

        self._window = QtGui.QDialog(parent)
        self._window.setWindowIcon(QtGui.QIcon(getPixmap("smart")))
        self._window.setWindowTitle(_("Edit Channel"))
        self._window.setModal(True)

        layout = QtGui.QVBoxLayout(self._window)
        #layout.setResizeMode(QtGui.QLayout.FreeResize)

        vbox = QtGui.QWidget(self._window)
        layout.addWidget(vbox)
        layout = QtGui.QVBoxLayout(vbox) 
        layout.setMargin(10)
        layout.setSpacing(10)
        vbox.show()

        #layout.addWidget(vbox)
        self._vbox = vbox

        #self._table = QtGui.QGrid(2, vbox)
        self._table = QtGui.QWidget(vbox)
        QtGui.QGridLayout(self._table)
        self._table.layout().setSpacing(10)
        self._table.show()
        layout.addWidget(self._table)

        sep = QtGui.QFrame(vbox)
        sep.setFrameShape(QtGui.QFrame.HLine)
        sep.setFrameShadow(QtGui.QFrame.Sunken)
        sep.show()
        layout.addWidget(sep)

        #bbox = QtGui.QHBox(vbox)
        bbox = QtGui.QWidget(vbox)
        layout.addWidget(bbox)
        layout = QtGui.QHBoxLayout(bbox)
        bbox.layout().setSpacing(10)
        bbox.layout().addStretch(1)
        bbox.show()

        button = QtGui.QPushButton(_("Cancel"), bbox)
        QtCore.QObject.connect(button, QtCore.SIGNAL("clicked()"), self._window, QtCore.SLOT("reject()"))
        layout.addWidget(button)

        button = QtGui.QPushButton(_("OK"), bbox)
        QtCore.QObject.connect(button, QtCore.SIGNAL("clicked()"), self._window, QtCore.SLOT("accept()"))
        layout.addWidget(button)

        button.setDefault(True)
Exemple #10
0
    def __init__(self, parent=None):

        self._window = QtGui.QDialog(parent)
        self._window.setWindowIcon(QtGui.QIcon(getPixmap("smart")))
        self._window.setWindowTitle(_("Select Channels"))
        self._window.setModal(True)

        self._window.setMinimumSize(600, 400)

        layout = QtGui.QVBoxLayout(self._window)
        #layout.setResizeMode(QtGui.QLayout.FreeResize)

        #vbox = QtGui.QVBox(self._window)
        vbox = QtGui.QWidget(self._window)
        layout.addWidget(vbox)
        layout = QtGui.QVBoxLayout(vbox)
        layout.setMargin(10)
        layout.setSpacing(10)
        vbox.show()

        self._treeview = QtGui.QTableWidget(vbox)
        self._treeview.setSizePolicy(QtGui.QSizePolicy.Expanding,
                                     QtGui.QSizePolicy.Expanding)
        #self._treeview.setAllColumnsShowFocus(True)
        self._treeview.show()
        layout.addWidget(self._treeview)

        #self._treeview.addColumn("")
        #self._treeview.addColumn(_("Alias"))
        #self._treeview.addColumn(_("Type"))
        #self._treeview.addColumn(_("Name"))
        self._treeview.setHorizontalHeaderLabels(
            ["", _("Alias"), _("Type"), _("Name")])

        bbox = QtGui.QWidget(vbox)
        layout.addWidget(bbox)
        layout = QtGui.QHBoxLayout(bbox)
        bbox.layout().setSpacing(10)
        bbox.layout().addStretch(1)
        bbox.show()

        button = QtGui.QPushButton(_("Cancel"), bbox)
        QtCore.QObject.connect(button, QtCore.SIGNAL("clicked()"),
                               self._window, QtCore.SLOT("reject()"))
        layout.addWidget(button)

        button = QtGui.QPushButton(_("OK"), bbox)
        QtCore.QObject.connect(button, QtCore.SIGNAL("clicked()"),
                               self._window, QtCore.SLOT("accept()"))
        layout.addWidget(button)

        button.setDefault(True)
Exemple #11
0
 def run(self, command=None, argv=None):
     self.setCatchExceptions(True)
     self.loadState()
     self._window.setWindowIcon(QtGui.QIcon(getPixmap("smart")))
     self._window.show()
     self._ctrl.reloadChannels()
     self._changeset = ChangeSet(self._ctrl.getCache())
     self._pi.setChangeSet(self._changeset)
     self._progress.hide()
     self.refreshPackages()
     app.exec_()
     self.saveState()
     self.setCatchExceptions(False)
Exemple #12
0
 def run(self, command=None, argv=None):
     self.setCatchExceptions(True)
     self.loadState()
     self._window.setWindowIcon(QtGui.QIcon(getPixmap("smart")))
     self._window.show()
     self._ctrl.reloadChannels()
     self._changeset = ChangeSet(self._ctrl.getCache())
     self._pi.setChangeSet(self._changeset)
     self._progress.hide()
     self.refreshPackages()
     app.exec_()
     self.saveState()
     self.setCatchExceptions(False)
Exemple #13
0
    def __init__(self, parent=None):

        self._window = QtGui.QDialog(parent)
        self._window.setWindowIcon(QtGui.QIcon(getPixmap("smart")))
        self._window.setWindowTitle(_("New Target"))
        self._window.setModal(True)

        #self._window.setMinimumSize(600, 400)

        vbox = QtGui.QWidget(self._window)
        QtGui.QVBoxLayout(vbox)
        vbox.layout().setMargin(10)
        vbox.layout().setSpacing(10)
        vbox.show()

        table = QtGui.QWidget(vbox) # 2
        QtGui.QGridLayout(table)
        table.layout().setSpacing(10)
        table.show()
        
        label = QtGui.QLabel(_("Target:"), table)

        self._target = QtGui.QLineEdit(table)
        self._target.setMaxLength(40)
        self._target.show()

        blank = QtGui.QWidget(table)

        label = QtGui.QLabel(_("Examples: \"pkgname\", \"pkgname = 1.0\" or "
                            "\"pkgname <= 1.0\""), table)

        sep = QtGui.QFrame(vbox)
        sep.setFrameShape(QtGui.QFrame.HLine)
        sep.setFrameShadow(QtGui.QFrame.Sunken)
        sep.show()

        bbox = QtGui.QWidget(vbox)
        QtGui.QHBoxLayout(bbox)
        bbox.layout().setSpacing(10)
        bbox.layout().addStretch(1)
        bbox.show()

        button = QtGui.QPushButton(bbox.tr("OK"), bbox)
        QtCore.QObject.connect(button, QtCore.SIGNAL("clicked()"), self._window, QtCore.SLOT("accept()"))

        button = QtGui.QPushButton(bbox.tr("Cancel"), bbox)
        QtCore.QObject.connect(button, QtCore.SIGNAL("clicked()"), self._window, QtCore.SLOT("reject()"))

        vbox.adjustSize()
        self._window.adjustSize()
Exemple #14
0
    def __init__(self, parent=None):
        QtGui.QWidget.__init__(self, parent)

        self.show()
        self._expandpackage = False

        self._changeset = {}
        self._vbox = QtGui.QVBoxLayout(self)
        
        self._treeview = QtGui.QTreeWidget(self)
        QtCore.QObject.connect(self._treeview, QtCore.SIGNAL("itemClicked(QTreeWidgetItem *, int)"), self._clicked)
        QtCore.QObject.connect(self._treeview, QtCore.SIGNAL("itemDoubleClicked(QTreeWidgetItem *, int)"), self._doubleClicked)
        QtCore.QObject.connect(self._treeview, QtCore.SIGNAL("itemPressed(QTreeWidgetItem *, int)"), self._pressed)
        QtCore.QObject.connect(self._treeview, QtCore.SIGNAL("itemSelectionChanged()"), self._selectionChanged)
        self._treeview.setAllColumnsShowFocus(True)
        self._treeview.setRootIsDecorated(True)
        self._treeview.show()
        self._vbox.addWidget(self._treeview)
        
        #self._treeview.setSelectionMode(QtGui.QTreeView.Extended)
        
        #self._treeview.addColumn("") # pixmap
        #self._treeview.addColumn(_("Package"))
        #self._treeview.addColumn(_("Version"))
        self._treeview.setHeaderLabels(["", _("Package"), _("Version")])

        self._ipixbuf = getPixmap("package-installed")
        self._ilpixbuf = getPixmap("package-installed-locked")
        self._apixbuf = getPixmap("package-available")
        self._alpixbuf = getPixmap("package-available-locked")
        self._npixbuf = getPixmap("package-new")
        self._nlpixbuf = getPixmap("package-new-locked")
        self._fpixbuf = getPixmap("folder")
        self._Ipixbuf = getPixmap("package-install")
        self._Rpixbuf = getPixmap("package-remove")
        self._rpixbuf = getPixmap("package-reinstall")
    def __init__(self, parent=None):

        self._window = QtGui.QDialog(parent)
        self._window.setWindowIcon(QtGui.QIcon(getPixmap("smart")))
        self._window.setWindowTitle(_("Select Channels"))
        self._window.setModal(True)

        self._window.setMinimumSize(600, 400)

        layout = QtGui.QVBoxLayout(self._window) 
        #layout.setResizeMode(QtGui.QLayout.FreeResize)
        
        #vbox = QtGui.QVBox(self._window)
        vbox = QtGui.QWidget(self._window)
        layout.addWidget(vbox)
        layout = QtGui.QVBoxLayout(vbox)
        layout.setMargin(10)
        layout.setSpacing(10)
        vbox.show()

        self._treeview = QtGui.QTableWidget(vbox)
        self._treeview.setSizePolicy(QtGui.QSizePolicy.Expanding,QtGui.QSizePolicy.Expanding)
        #self._treeview.setAllColumnsShowFocus(True)
        self._treeview.show()
        layout.addWidget(self._treeview)

        #self._treeview.addColumn("")
        #self._treeview.addColumn(_("Alias"))
        #self._treeview.addColumn(_("Type"))
        #self._treeview.addColumn(_("Name"))
        self._treeview.setHorizontalHeaderLabels(["", _("Alias"), _("Type"), _("Name")])

        bbox = QtGui.QWidget(vbox)
        layout.addWidget(bbox)
        layout = QtGui.QHBoxLayout(bbox)
        bbox.layout().setSpacing(10)
        bbox.layout().addStretch(1)
        bbox.show()

        button = QtGui.QPushButton(_("Cancel"), bbox)
        QtCore.QObject.connect(button, QtCore.SIGNAL("clicked()"), self._window, QtCore.SLOT("reject()"))
        layout.addWidget(button)

        button = QtGui.QPushButton(_("OK"), bbox)
        QtCore.QObject.connect(button, QtCore.SIGNAL("clicked()"), self._window, QtCore.SLOT("accept()"))
        layout.addWidget(button)

        button.setDefault(True)
Exemple #16
0
    def __init__(self, parent=None):
        QtGui.QDialog.__init__(self, parent)

        self.setWindowIcon(QtGui.QIcon(getPixmap("smart")))
        self.setWindowTitle(_("Change Summary"))
        self.setModal(True)
        self.setMinimumSize(600, 400)
        centerWindow(self)

        self._vbox = QtGui.QVBoxLayout(self)
        self._vbox.setMargin(10)
        self._vbox.setSpacing(10)

        self._label = QtGui.QLabel(self)
        self._vbox.addWidget(self._label)

        self._pv = QtPackageView(self)
        self._pv.getTreeView().header().hide()
        self._pv.setExpandPackage(True)
        self._pv.show()
        self._vbox.addWidget(self._pv)

        self._sizelabel = QtGui.QLabel("", self)
        self._vbox.addWidget(self._sizelabel)

        self._confirmbbox = QtGui.QWidget(self)
        layout = QtGui.QHBoxLayout(self._confirmbbox)
        layout.setSpacing(10)
        layout.addStretch(1)
        self._vbox.addWidget(self._confirmbbox)

        self._cancelbutton = QtGui.QPushButton(_("Cancel"), self._confirmbbox)
        QtCore.QObject.connect(self._cancelbutton, QtCore.SIGNAL("clicked()"),
                               self, QtCore.SLOT("reject()"))
        self._okbutton = QtGui.QPushButton(_("OK"), self._confirmbbox)
        QtCore.QObject.connect(self._okbutton, QtCore.SIGNAL("clicked()"),
                               self, QtCore.SLOT("accept()"))

        self._closebbox = QtGui.QWidget(self)
        layout = QtGui.QHBoxLayout(self._closebbox)
        layout.setSpacing(10)
        layout.addStretch(1)
        self._vbox.addWidget(self._closebbox)

        self._closebutton = QtGui.QPushButton(_("Close"), self._closebbox)
        QtCore.QObject.connect(self._closebutton, QtCore.SIGNAL("clicked()"),
                               self, QtCore.SLOT("close()"))
Exemple #17
0
    def __init__(self, parent=None):

        self._window = QtGui.QDialog(parent)
        self._window.setWindowIcon(QtGui.QIcon(getPixmap("smart")))
        self._window.setWindowTitle(_("New Channel"))
        self._window.setModal(True)

        vbox = QtGui.QVBox(self._window)
        vbox.setMargin(10)
        vbox.setSpacing(10)
        vbox.show()

        table = QtGui.QWidget(vbox)
        QtGui.QGridLayout(table)
        table.layout().setSpacing(10)
        table.show()

        label = QtGui.QLabel(_("Media path:"), table)

        self._mpvbox = QtGui.QWidget(table)
        QtGui.QVBoxLayout(self._mpvbox)
        self._mpvbox.layout().setSpacing(10)
        self._mpvbox.show()

        sep = QtGui.QFrame(vbox)
        sep.setFrameShape(QtGui.QFrame.HLine)
        sep.setFrameShadow(QtGui.QFrame.Sunken)
        sep.show()

        bbox = QtGui.QWidget(vbox)
        QtGui.QHBoxLayout(bbox)
        bbox.layout().setSpacing(10)
        bbox.layout().addStretch(1)
        bbox.show()

        button = QtGui.QPushButton(_("OK"), bbox)
        QtCore.QObject.connect(button, QtCore.SIGNAL("clicked()"),
                               self._window, QtCore.SLOT("accept()"))
        bbox.layout().addWidget(button)

        button = QtGui.QPushButton(_("Cancel"), bbox)
        QtCore.QObject.connect(button, QtCore.SIGNAL("clicked()"),
                               self._window, QtCore.SLOT("reject()"))
        bbox.layout().addWidget(button)
Exemple #18
0
    def __init__(self, parent=None):
        QtGui.QDialog.__init__(self, parent)

        self.setWindowIcon(QtGui.QIcon(getPixmap("smart")))
        self.setWindowTitle(_("Change Summary"))
        self.setModal(True)
        self.setMinimumSize(600, 400)
        centerWindow(self)
        
        self._vbox = QtGui.QVBoxLayout(self)
        self._vbox.setMargin(10)
        self._vbox.setSpacing(10)

        self._label = QtGui.QLabel(self)
        self._vbox.addWidget(self._label)

        self._pv = QtPackageView(self)
        self._pv.getTreeView().header().hide()
        self._pv.setExpandPackage(True)
        self._pv.show()
        self._vbox.addWidget(self._pv)

        self._sizelabel = QtGui.QLabel("", self)
        self._vbox.addWidget(self._sizelabel)

        self._confirmbbox = QtGui.QWidget(self)
        layout = QtGui.QHBoxLayout(self._confirmbbox)
        layout.setSpacing(10)
        layout.addStretch(1)
        self._vbox.addWidget(self._confirmbbox)

        self._cancelbutton = QtGui.QPushButton(_("Cancel"), self._confirmbbox)
        QtCore.QObject.connect( self._cancelbutton, QtCore.SIGNAL("clicked()"), self, QtCore.SLOT("reject()"))
        self._okbutton = QtGui.QPushButton(_("OK"), self._confirmbbox)
        QtCore.QObject.connect( self._okbutton, QtCore.SIGNAL("clicked()"), self, QtCore.SLOT("accept()"))

        self._closebbox = QtGui.QWidget(self)
        layout = QtGui.QHBoxLayout(self._closebbox)
        layout.setSpacing(10)
        layout.addStretch(1)
        self._vbox.addWidget(self._closebbox)

        self._closebutton = QtGui.QPushButton(_("Close"), self._closebbox)
        QtCore.QObject.connect( self._closebutton, QtCore.SIGNAL("clicked()"), self, QtCore.SLOT("close()"))
    def __init__(self, parent=None):

        self._window = QtGui.QDialog(parent)
        self._window.setWindowIcon(QtGui.QIcon(getPixmap("smart")))
        self._window.setWindowTitle(_("New Channel"))
        self._window.setModal(True)

        vbox = QtGui.QVBox(self._window)
        vbox.setMargin(10)
        vbox.setSpacing(10)
        vbox.show()

        table = QtGui.QWidget(vbox)
        QtGui.QGridLayout(table) 
        table.layout().setSpacing(10)
        table.show()
        
        label = QtGui.QLabel(_("Media path:"), table)

        self._mpvbox = QtGui.QWidget(table)
        QtGui.QVBoxLayout(self._mpvbox) 
        self._mpvbox.layout().setSpacing(10)
        self._mpvbox.show()

        sep = QtGui.QFrame(vbox)
        sep.setFrameShape(QtGui.QFrame.HLine)
        sep.setFrameShadow(QtGui.QFrame.Sunken)
        sep.show()

        bbox = QtGui.QWidget(vbox)
        QtGui.QHBoxLayout(bbox) 
        bbox.layout().setSpacing(10)
        bbox.layout().addStretch(1)
        bbox.show()

        button = QtGui.QPushButton(_("OK"), bbox)
        QtCore.QObject.connect(button, QtCore.SIGNAL("clicked()"), self._window, QtCore.SLOT("accept()"))
        bbox.layout().addWidget(button)

        button = QtGui.QPushButton(_("Cancel"), bbox)
        QtCore.QObject.connect(button, QtCore.SIGNAL("clicked()"), self._window, QtCore.SLOT("reject()"))
        bbox.layout().addWidget(button)
    def __init__(self, parent=None):

        self._window = QtGui.QDialog(parent)
        self._window.setWindowIcon(QtGui.QIcon(getPixmap("smart")))
        self._window.setWindowTitle(_("Package Priority"))
        self._window.setModal(True)
        
        #self._window.setMinimumSize(600, 400)

        vbox = QtGui.QWidget(self._window)
        QtGui.QVBoxLayout(vbox)
        vbox.layout().setMargin(10)
        vbox.layout().setSpacing(10)
        vbox.show()

        self._vbox = vbox

        self._table = QtGui.QWidget(vbox)
        QtGui.QGridLayout(self._table)
        self._table.layout().setSpacing(10)
        self._table.show()
        vbox.layout().addWidget(self._table)

        bbox = QtGui.QWidget(vbox)
        QtGui.QHBoxLayout(bbox)
        bbox.layout().setSpacing(10)
        bbox.layout().addStretch(1)
        bbox.show()
        vbox.layout().addWidget(bbox)

        button = QtGui.QPushButton(_("Close"), bbox)
        QtCore.QObject.connect(button, QtCore.SIGNAL("clicked()"), self._window, QtCore.SLOT("hide()"))
        bbox.layout().addWidget(button)

        self._vbox.adjustSize()
        self._window.adjustSize()
Exemple #21
0
    def __init__(self, parent=None):

        self._window = QtGui.QDialog(None)
        self._window.setWindowIcon(QtGui.QIcon(getPixmap("smart")))
        self._window.setWindowTitle(_("Flags"))
        self._window.setModal(True)

        self._window.setMinimumSize(600, 400)

        layout = QtGui.QVBoxLayout(self._window)
        #layout.setResizeMode(QtGui.QLayout.FreeResize)

        topvbox = QtGui.QWidget(self._window)
        QtGui.QVBoxLayout(topvbox)
        topvbox.layout().setMargin(10)
        topvbox.layout().setSpacing(10)
        topvbox.show()

        layout.addWidget(topvbox)

        tophbox = QtGui.QWidget(topvbox)
        QtGui.QHBoxLayout(tophbox)
        tophbox.layout().setSpacing(20)
        tophbox.show()
        topvbox.layout().addWidget(tophbox)

        # Left side
        vbox = QtGui.QGroupBox(tophbox)
        QtGui.QVBoxLayout(vbox)
        vbox.layout().setSpacing(10)
        vbox.show()
        tophbox.layout().addWidget(vbox)

        self._flagsview = QtGui.QTableWidget(vbox)
        self._flagsview.show()
        vbox.layout().addWidget(self._flagsview)

        QtCore.QObject.connect(self._flagsview,
                               QtCore.SIGNAL("selectionChanged()"),
                               self.flagSelectionChanged)

        #self._flagsview.addColumn(_("Flags"))
        self._flagsview.setHorizontalHeaderLabels([_("Flags")])
        self._flagsview.horizontalHeader().show()

        #bbox = QtGui.QHBox(vbox)
        bbox = QtGui.QWidget(vbox)
        QtGui.QHBoxLayout(bbox)
        bbox.layout().setMargin(5)
        bbox.layout().setSpacing(10)
        bbox.show()
        vbox.layout().addWidget(bbox)

        button = QtGui.QPushButton(_("New"), bbox)
        button.setEnabled(True)
        button.setIcon(QtGui.QIcon(getPixmap("crystal-add")))
        button.show()
        QtCore.QObject.connect(button, QtCore.SIGNAL("clicked()"),
                               self.newFlag)
        self._newflag = button
        bbox.layout().addWidget(button)

        button = QtGui.QPushButton(_("Delete"), bbox)
        button.setEnabled(False)
        button.setIcon(QtGui.QIcon(getPixmap("crystal-delete")))
        button.show()
        QtCore.QObject.connect(button, QtCore.SIGNAL("clicked()"),
                               self.delFlag)
        self._delflag = button
        bbox.layout().addWidget(button)

        # Right side
        vbox = QtGui.QGroupBox(tophbox)
        QtGui.QVBoxLayout(vbox)
        vbox.layout().setSpacing(10)
        vbox.show()
        tophbox.layout().addWidget(vbox)

        self._targetsview = QtGui.QTableWidget(vbox)
        self._targetsview.show()
        vbox.layout().addWidget(self._targetsview)

        QtCore.QObject.connect(self._targetsview,
                               QtCore.SIGNAL("selectionChanged()"),
                               self.targetSelectionChanged)

        #self._targetsview.addColumn(_("Targets"))
        self._targetsview.setHorizontalHeaderLabels([_("Targets")])
        self._targetsview.horizontalHeader().show()

        bbox = QtGui.QWidget(vbox)
        QtGui.QHBoxLayout(bbox)
        bbox.layout().setMargin(5)
        bbox.layout().setSpacing(10)
        bbox.show()
        vbox.layout().addWidget(bbox)

        button = QtGui.QPushButton(_("New"), bbox)
        button.setEnabled(False)
        button.setIcon(QtGui.QIcon(getPixmap("crystal-add")))
        button.show()
        QtCore.QObject.connect(button, QtCore.SIGNAL("clicked()"),
                               self.newTarget)
        self._newtarget = button
        bbox.layout().addWidget(button)

        button = QtGui.QPushButton(_("Delete"), bbox)
        button.setEnabled(False)
        button.setIcon(QtGui.QIcon(getPixmap("crystal-delete")))
        button.show()
        QtCore.QObject.connect(button, QtCore.SIGNAL("clicked()"),
                               self.delTarget)
        self._deltarget = button
        bbox.layout().addWidget(button)

        # Bottom
        sep = QtGui.QFrame(topvbox)
        sep.setFrameShape(QtGui.QFrame.HLine)
        sep.setFrameShadow(QtGui.QFrame.Sunken)
        sep.show()
        topvbox.layout().addWidget(sep)

        bbox = QtGui.QWidget(topvbox)
        QtGui.QHBoxLayout(bbox)
        bbox.layout().setSpacing(10)
        bbox.layout().addStretch(1)
        bbox.show()
        topvbox.layout().addWidget(bbox)

        button = QtGui.QPushButton(_("Close"), bbox)
        button.show()
        QtCore.QObject.connect(button, QtCore.SIGNAL("clicked()"),
                               self._window, QtCore.SLOT("accept()"))
        bbox.layout().addWidget(button)

        button.setDefault(True)
    def __init__(self, parent=None):

        self._window = QtGui.QDialog(parent)
        self._window.setWindowIcon(QtGui.QIcon(getPixmap("smart")))
        self._window.setWindowTitle(_("New Mirror"))
        self._window.setModal(True)

        #self._window.setMinimumSize(600, 400)

        vbox = QtGui.QWidget(self._window)
        QtGui.QVBoxLayout(vbox)
        vbox.layout().setMargin(10)
        vbox.layout().setSpacing(10)
        vbox.show()

        table = QtGui.QWidget(vbox)
        QtGui.QGridLayout(table)
        table.layout().setSpacing(10)
        table.show()
        vbox.layout().addWidget(table)
        
        label = QtGui.QLabel(_("Origin URL:"), table)
        label.show()
        table.layout().addWidget(label)

        self._origin = QtGui.QLineEdit(table)
        self._origin.setMaxLength(40)
        self._origin.show()
        table.layout().addWidget(self._origin)

        label = QtGui.QLabel(_("Mirror URL:"), table)
        label.show()
        table.layout().addWidget(label)

        self._mirror = QtGui.QLineEdit(table)
        self._mirror.setMaxLength(40)
        self._mirror.show()
        table.layout().addWidget(self._mirror)

        sep = QtGui.QFrame(vbox)
        sep.setFrameStyle(QtGui.QFrame.HLine)
        sep.show()
        vbox.layout().addWidget(sep)

        bbox = QtGui.QWidget(self._window)
        QtGui.QHBoxLayout(bbox)
        bbox.layout().setSpacing(10)
        bbox.layout().addStretch(1)
        bbox.show()
        vbox.layout().addWidget(bbox)

        button = QtGui.QPushButton(_("OK"), bbox)
        QtCore.QObject.connect(button, QtCore.SIGNAL("clicked()"), self._window, QtCore.SLOT("accept()"))
        bbox.layout().addWidget(button)

        button = QtGui.QPushButton(_("Cancel"), bbox)
        QtCore.QObject.connect(button, QtCore.SIGNAL("clicked()"), self._window, QtCore.SLOT("reject()"))
        bbox.layout().addWidget(button)
        
        vbox.adjustSize()
        self._window.adjustSize()
Exemple #23
0
    def __init__(self, parent=None):

        self._window = QtGui.QDialog(parent)
        self._window.setWindowIcon(QtGui.QIcon(getPixmap("smart")))
        self._window.setWindowTitle(_("New Channel"))
        self._window.setModal(True)

        layout = QtGui.QVBoxLayout(self._window)

        #vbox = QtGui.QVBox(self._window)
        vbox = QtGui.QWidget(self._window)
        layout.addWidget(vbox)
        layout = QtGui.QVBoxLayout(vbox)
        layout.setMargin(10)
        layout.setSpacing(10)
        vbox.show()
        self._vbox = vbox

        #table = QtGui.QGrid(2, vbox)
        table = QtGui.QWidget(vbox)
        layout.addWidget(table)
        QtGui.QGridLayout(table)
        table.layout().setSpacing(10)
        table.show()
        self._table = table

        label = QtGui.QLabel(_("Type:"), table)
        table.layout().addWidget(label)

        self._typevbox = QtGui.QGroupBox(table)
        QtGui.QVBoxLayout(self._typevbox)
        #self._typevbox.setFrameStyle(QtGui.QFrame.NoFrame)
        self._typevbox.show()
        table.layout().addWidget(self._typevbox)

        sep = QtGui.QFrame(vbox)
        sep.setFrameShape(QtGui.QFrame.HLine)
        sep.setFrameShadow(QtGui.QFrame.Sunken)
        sep.show()
        layout.addWidget(sep)

        #bbox = QtGui.QHBox(vbox)
        bbox = QtGui.QWidget(vbox)
        layout.addWidget(bbox)
        layout = QtGui.QHBoxLayout(bbox)
        bbox.layout().setSpacing(10)
        bbox.layout().addStretch(1)
        bbox.show()

        button = QtGui.QPushButton(_("Cancel"), bbox)
        QtCore.QObject.connect(button, QtCore.SIGNAL("clicked()"),
                               self._window, QtCore.SLOT("reject()"))
        layout.addWidget(button)

        button = QtGui.QPushButton(_("OK"), bbox)
        QtCore.QObject.connect(button, QtCore.SIGNAL("clicked()"),
                               self._window, QtCore.SLOT("accept()"))
        layout.addWidget(button)

        self._ok = button
        self._ok.setEnabled(False)
    def __init__(self, parent=None):

        self._window = QtGui.QDialog(parent)
        self._window.setWindowIcon(QtGui.QIcon(getPixmap("smart")))
        self._window.setWindowTitle(_("New Channel"))
        self._window.setModal(True)

        vbox = QtGui.QWidget(self._window)
        layout = QtGui.QVBoxLayout(vbox) 
        vbox.layout().setMargin(10)
        vbox.layout().setSpacing(10)
        vbox.show()

        table = QtGui.QWidget(vbox)
        QtGui.QGridLayout(table) 
        table.layout().setSpacing(10)
        table.show()
        layout.addWidget(table)
        
        label = QtGui.QLabel(_("Method:"), table)
        table.layout().addWidget(label)
 
        methodvbox = QtGui.QGroupBox(table)
        QtGui.QVBoxLayout(methodvbox) 
        methodvbox.show()
        table.layout().addWidget(methodvbox)
 
        sep = QtGui.QFrame(vbox)
        sep.setFrameShape(QtGui.QFrame.HLine)
        sep.setFrameShadow(QtGui.QFrame.Sunken)
        sep.show()
        vbox.layout().addWidget(sep)

        bbox = QtGui.QWidget(vbox)
        layout = QtGui.QHBoxLayout(bbox)
        bbox.layout().setSpacing(10)
        bbox.layout().addStretch(1)
        bbox.show()
        vbox.layout().addWidget(bbox)

        button = QtGui.QPushButton(_("Cancel"), bbox)
        QtCore.QObject.connect(button, QtCore.SIGNAL("clicked()"), self._window, QtCore.SLOT("reject()"))
        layout.addWidget(button)

        button = QtGui.QPushButton(_("OK"), bbox)
        QtCore.QObject.connect(button, QtCore.SIGNAL("clicked()"), self._window, QtCore.SLOT("accept()"))
        layout.addWidget(button)

        self._ok = button
        self._ok.setEnabled(False)
        
        self._method = None
        #group = QtGui.QButtonGroup(methodvbox)
        for method, descr in [("manual",
                               _("Provide channel information")),
                              ("descriptionpath",
                               _("Read channel description from local path")),
                              ("descriptionurl",
                               _("Read channel description from URL")),
                              ("detectmedia",
                               _("Detect channel in media (CDROM, DVD, etc)")),
                              ("detectpath",
                               _("Detect channel in local path"))]:
            if not self._method:
                self._method = method
            radio = QtGui.QRadioButton(method, methodvbox)
            radio.setText(descr)
            methodvbox.layout().addWidget(radio)
            #group.addButton(radio)
            QtCore.QObject.connect(radio, QtCore.SIGNAL("clicked()"), self.ok)
            act = RadioAction(radio, method, descr)
            act.connect(self, "_method", method)
            radio.show()
        
        methodvbox.adjustSize()
        vbox.adjustSize()
        self._window.adjustSize()
Exemple #25
0
    def __init__(self, parent=None):

        self._window = QtGui.QDialog(parent)
        self._window.setWindowIcon(QtGui.QIcon(getPixmap("smart")))
        self._window.setWindowTitle(_("New Channel"))
        self._window.setModal(True)

        vbox = QtGui.QWidget(self._window)
        layout = QtGui.QVBoxLayout(vbox)
        vbox.layout().setMargin(10)
        vbox.layout().setSpacing(10)
        vbox.show()

        table = QtGui.QWidget(vbox)
        QtGui.QGridLayout(table)
        table.layout().setSpacing(10)
        table.show()
        layout.addWidget(table)

        label = QtGui.QLabel(_("Method:"), table)
        table.layout().addWidget(label)

        methodvbox = QtGui.QGroupBox(table)
        QtGui.QVBoxLayout(methodvbox)
        methodvbox.show()
        table.layout().addWidget(methodvbox)

        sep = QtGui.QFrame(vbox)
        sep.setFrameShape(QtGui.QFrame.HLine)
        sep.setFrameShadow(QtGui.QFrame.Sunken)
        sep.show()
        vbox.layout().addWidget(sep)

        bbox = QtGui.QWidget(vbox)
        layout = QtGui.QHBoxLayout(bbox)
        bbox.layout().setSpacing(10)
        bbox.layout().addStretch(1)
        bbox.show()
        vbox.layout().addWidget(bbox)

        button = QtGui.QPushButton(_("Cancel"), bbox)
        QtCore.QObject.connect(button, QtCore.SIGNAL("clicked()"),
                               self._window, QtCore.SLOT("reject()"))
        layout.addWidget(button)

        button = QtGui.QPushButton(_("OK"), bbox)
        QtCore.QObject.connect(button, QtCore.SIGNAL("clicked()"),
                               self._window, QtCore.SLOT("accept()"))
        layout.addWidget(button)

        self._ok = button
        self._ok.setEnabled(False)

        self._method = None
        #group = QtGui.QButtonGroup(methodvbox)
        for method, descr in [
            ("manual", _("Provide channel information")),
            ("descriptionpath", _("Read channel description from local path")),
            ("descriptionurl", _("Read channel description from URL")),
            ("detectmedia", _("Detect channel in media (CDROM, DVD, etc)")),
            ("detectpath", _("Detect channel in local path"))
        ]:
            if not self._method:
                self._method = method
            radio = QtGui.QRadioButton(method, methodvbox)
            radio.setText(descr)
            methodvbox.layout().addWidget(radio)
            #group.addButton(radio)
            QtCore.QObject.connect(radio, QtCore.SIGNAL("clicked()"), self.ok)
            act = RadioAction(radio, method, descr)
            act.connect(self, "_method", method)
            radio.show()

        methodvbox.adjustSize()
        vbox.adjustSize()
        self._window.adjustSize()
    def __init__(self, parent=None):

        self._changed = False

        self._window = QtGui.QDialog(None)
        self._window.setWindowIcon(QtGui.QIcon(getPixmap("smart")))
        self._window.setWindowTitle(_("Channels"))
        self._window.setModal(True)

        self._window.setMinimumSize(580, 350)

        vbox = QtGui.QWidget(self._window)
        layout = QtGui.QVBoxLayout(vbox) 
        #layout.setResizeMode(QtGui.QLayout.FreeResize)

        #vbox = QtGui.QVBox(self._window)
        layout.setMargin(10)
        layout.setSpacing(10)
        vbox.show()

        self._vbox = vbox

        self._treeview = QtGui.QTreeWidget(vbox)
        self._treeview.setSizePolicy(QtGui.QSizePolicy.Expanding,QtGui.QSizePolicy.Expanding)
        self._treeview.setMinimumSize(570, 320)
        #QTreeView.expandAll(self._treeview)
        #self._treeview.setAllColumnsShowFocus(True)
        #self._treeview.setSelectionMode(QtGui.QListView.Single)
        self._treeview.show()
        layout.addWidget(self._treeview)

        QtCore.QObject.connect(self._treeview, QtCore.SIGNAL("itemSelectionChanged ()"), self.selectionChanged)
        QtCore.QObject.connect(self._treeview, QtCore.SIGNAL("itemDoubleClicked (QTableWidgetItem *)"), self.doubleClicked)

        #self._treeview.addColumn("")
        #self._treeview.addColumn(_("Pri"))
        #self._treeview.addColumn(_("Alias"))
        #self._treeview.addColumn(_("Type"))
        #self._treeview.addColumn(_("Name"))
        self._treeview.setHeaderLabels(["", _("Pri"), _("Alias"), _("Type"), _("Name")])
        
        #bbox = QtGui.QHBox(vbox)
        bbox = QtGui.QWidget(vbox)
        layout.addWidget(bbox)
        layout = QtGui.QHBoxLayout(bbox)
        bbox.layout().setSpacing(10)
        bbox.layout().addStretch(1)
        bbox.show()

        button = QtGui.QPushButton(_("New"), bbox)
        button.setIcon(QtGui.QIcon(getPixmap("crystal-add")))
        button.show()
        QtCore.QObject.connect(button, QtCore.SIGNAL("clicked()"), self.newChannel)
        self._newchannel = button
        layout.addWidget(button)

        button = QtGui.QPushButton(_("Delete"), bbox)
        button.setEnabled(False)
        button.setIcon(QtGui.QIcon(getPixmap("crystal-delete")))
        button.show()
        QtCore.QObject.connect(button, QtCore.SIGNAL("clicked()"), self.delChannel)
        self._delchannel = button
        layout.addWidget(button)

        button = QtGui.QPushButton(_("Edit"), bbox)
        button.setEnabled(False)
        button.setIcon(QtGui.QIcon(getPixmap("crystal-edit")))
        button.show()
        QtCore.QObject.connect(button, QtCore.SIGNAL("clicked()"), self.editChannel)
        self._editchannel = button
        layout.addWidget(button)

        button = QtGui.QPushButton(_("Close"), bbox)
        QtCore.QObject.connect(button, QtCore.SIGNAL("clicked()"), self._window, QtCore.SLOT("accept()"))
        layout.addWidget(button)

        button.setDefault(True)
        vbox.adjustSize()
Exemple #27
0
    def __init__(self, parent=None):

        self._changed = False

        self._window = QtGui.QDialog(None)
        self._window.setWindowIcon(QtGui.QIcon(getPixmap("smart")))
        self._window.setWindowTitle(_("Channels"))
        self._window.setModal(True)

        self._window.setMinimumSize(600, 400)

        vbox = QtGui.QWidget(self._window)
        layout = QtGui.QVBoxLayout(vbox)
        #layout.setResizeMode(QtGui.QLayout.FreeResize)

        #vbox = QtGui.QVBox(self._window)
        layout.setMargin(10)
        layout.setSpacing(10)
        vbox.show()

        self._vbox = vbox

        self._treeview = QtGui.QTreeWidget(vbox)
        self._treeview.setSizePolicy(QtGui.QSizePolicy.Expanding,
                                     QtGui.QSizePolicy.Expanding)
        #self._treeview.setAllColumnsShowFocus(True)
        #self._treeview.setSelectionMode(QtGui.QListView.Single)
        self._treeview.show()
        layout.addWidget(self._treeview)

        QtCore.QObject.connect(self._treeview,
                               QtCore.SIGNAL("itemSelectionChanged ()"),
                               self.selectionChanged)
        QtCore.QObject.connect(
            self._treeview,
            QtCore.SIGNAL("itemDoubleClicked (QTableWidgetItem *)"),
            self.doubleClicked)

        #self._treeview.addColumn("")
        #self._treeview.addColumn(_("Pri"))
        #self._treeview.addColumn(_("Alias"))
        #self._treeview.addColumn(_("Type"))
        #self._treeview.addColumn(_("Name"))
        self._treeview.setHeaderLabels(
            ["", _("Pri"), _("Alias"),
             _("Type"), _("Name")])

        #bbox = QtGui.QHBox(vbox)
        bbox = QtGui.QWidget(vbox)
        layout.addWidget(bbox)
        layout = QtGui.QHBoxLayout(bbox)
        bbox.layout().setSpacing(10)
        bbox.layout().addStretch(1)
        bbox.show()

        button = QtGui.QPushButton(_("New"), bbox)
        button.setIcon(QtGui.QIcon(getPixmap("crystal-add")))
        button.show()
        QtCore.QObject.connect(button, QtCore.SIGNAL("clicked()"),
                               self.newChannel)
        self._newchannel = button
        layout.addWidget(button)

        button = QtGui.QPushButton(_("Delete"), bbox)
        button.setEnabled(False)
        button.setIcon(QtGui.QIcon(getPixmap("crystal-delete")))
        button.show()
        QtCore.QObject.connect(button, QtCore.SIGNAL("clicked()"),
                               self.delChannel)
        self._delchannel = button
        layout.addWidget(button)

        button = QtGui.QPushButton(_("Edit"), bbox)
        button.setEnabled(False)
        button.setIcon(QtGui.QIcon(getPixmap("crystal-edit")))
        button.show()
        QtCore.QObject.connect(button, QtCore.SIGNAL("clicked()"),
                               self.editChannel)
        self._editchannel = button
        layout.addWidget(button)

        button = QtGui.QPushButton(_("Close"), bbox)
        QtCore.QObject.connect(button, QtCore.SIGNAL("clicked()"),
                               self._window, QtCore.SLOT("accept()"))
        layout.addWidget(button)

        button.setDefault(True)
        vbox.adjustSize()
    def __init__(self, hassub, parent=None):
        Progress.__init__(self)
        QtGui.QDialog.__init__(self, parent)

        self._hassub = hassub
        self._shorturl = ShortURL(50)
        self._ticking = False
        self._stopticking = False
        self._fetcher = None

        self._beenshown = False
        self._mainthread = None

        if hassub:
            self.setMinimumSize(500, 400)
        else:
            self.setMinimumSize(300, 80)

        self.setWindowIcon(QtGui.QIcon(getPixmap("smart")))
        self.setWindowTitle(_("Operation Progress"))

        vbox = QtGui.QVBoxLayout(self)
        #vbox.setResizeMode(QtGui.QLayout.FreeResize)
        vbox.setMargin(10)
        vbox.setSpacing(10)

        self._topic = QtGui.QLabel(self)
        vbox.addWidget(self._topic)

        self._progressbar = QtGui.QProgressBar(self)
        #self._progressbar.setPercentageVisible(True)
        self._progressbar.show()
        vbox.addWidget(self._progressbar)

        if hassub:
            self._listview = QtGui.QTableWidget(self)
            #self._listview.setSorting(-1, False);
            self._listview.setSelectionMode(QtGui.QTableView.NoSelection )
            self._listview.show()
            vbox.addWidget(self._listview)

            #column = self._listview.addColumn(_("Progress"))
            #self._listview.setColumnWidthMode(column, QtGui.QTableView.Manual)
            #self._listview.setColumnWidth(column, 55)
            #column = self._listview.addColumn(_("Current"))
            #self._currentcolumn = column
            #column = self._listview.addColumn(_("Total"))
            #self._totalcolumn = column
            #column = self._listview.addColumn(_("Speed"))
            #self._speedcolumn = column
            #column = self._listview.addColumn(_("ETA"))
            #self._etacolumn = column
            #column = self._listview.addColumn(_("Description"))
            #self._listview.setColumnWidthMode(column, QtGui.QTableView.Manual)
            #self._listview.setColumnWidth(column, 165)
            #self._desccolumn = column
            self._listview.setHorizontalHeaderLabels([_("Progress"),
                _("Current"), _("Total"), _("Speed"), _("ETA"), _("Description")])

            self._subiters = {}
            self._subindex = 0

            self._bbox = QtGui.QWidget(self)
            QtGui.QHBoxLayout(self._bbox)
            self._bbox.layout().setSpacing(10)
            self._bbox.layout().addStretch(1)
            vbox.addWidget(self._bbox)
            
            button = QtGui.QPushButton(_("Cancel"), self._bbox)
            button.show()
            QtCore.QObject.connect(button, QtCore.SIGNAL("clicked()"), self._cancel)
            self._bbox.layout().addWidget(button)
    def __init__(self, parent=None):

        self._window = QtGui.QDialog(None)
        self._window.setWindowIcon(QtGui.QIcon(getPixmap("smart")))
        self._window.setWindowTitle(_("Priorities"))
        #self._window.setModal(True)

        self._window.setMinimumSize(600, 400)

        layout = QtGui.QVBoxLayout(self._window)
        #layout.setResizeMode(QtGui.QLayout.FreeResize)

        vbox = QtGui.QWidget(self._window)
        QtGui.QVBoxLayout(vbox)
        vbox.layout().setMargin(10)
        vbox.layout().setSpacing(10)
        vbox.show()

        layout.addWidget(vbox)

        self._treeview = QtGui.QTableWidget(vbox)
        #self._treeview.setAllColumnsShowFocus(True)
        self._treeview.show()
        vbox.layout().addWidget(self._treeview)

        QtCore.QObject.connect(self._treeview, QtCore.SIGNAL("itemChanged(QTableWidgetItem *, int)"), self.itemChanged)
        QtCore.QObject.connect(self._treeview, QtCore.SIGNAL("selectionChanged()"), self.selectionChanged)

        #self._treeview.addColumn(_("Package Name"))
        #self._treeview.addColumn(_("Channel Alias"))
        #self._treeview.addColumn(_("Priority"))

        bbox = QtGui.QWidget(vbox)
        QtGui.QHBoxLayout(bbox)
        bbox.layout().setSpacing(10)
        bbox.layout().addStretch(1)
        bbox.show()
        vbox.layout().addWidget(bbox)

        button = QtGui.QPushButton(_("New"), bbox)
        button.setEnabled(True)
        button.setIcon(QtGui.QIcon(getPixmap("crystal-add")))
        button.show()
        QtCore.QObject.connect(button, QtCore.SIGNAL("clicked()"), self.newPriority)
        self._newpriority = button
        bbox.layout().addWidget(button)

        button = QtGui.QPushButton(_("Delete"), bbox)
        button.setEnabled(False)
        button.setIcon(QtGui.QIcon(getPixmap("crystal-delete")))
        button.show()
        QtCore.QObject.connect(button, QtCore.SIGNAL("clicked()"), self.delPriority)
        self._delpriority = button
        bbox.layout().addWidget(button)

        button = QtGui.QPushButton(_("Close"), bbox)
        QtCore.QObject.connect(button, QtCore.SIGNAL("clicked()"), self._window, QtCore.SLOT("accept()"))
        bbox.layout().addWidget(button)
        
        button.setDefault(True)
        vbox.adjustSize()
Exemple #30
0
    def packagePopup(self, packageview, pkgs, pnt):
        
        menu = QtGui.QMenu(packageview)
        menu.move(pnt)
        
        hasinstalled = bool([pkg for pkg in pkgs if pkg.installed
                             and self._changeset.get(pkg) is not REMOVE])
        hasnoninstalled = bool([pkg for pkg in pkgs if not pkg.installed
                                and self._changeset.get(pkg) is not INSTALL])

        class PackagesAction(object):
        
            def __init__(self, pkgs):
                self._pkgs = pkgs
                self._callback = None
                self._userdata = None
            
            def connect(self, item, callback, userdata=None):
                self._callback = callback
                self._userdata = userdata
            
            def slot(self):
                self._callback(self._pkgs, self._userdata)

        installaction = PackagesAction(pkgs)

        iconset = QtGui.QIcon(getPixmap("package-install"))
        item = menu.addAction(iconset, _("Install"), installaction.slot)
        installaction.connect(item, self.actOnPackages, INSTALL)
        if not hasnoninstalled:
            item.setEnabled(False)

        reinstallaction = PackagesAction(pkgs)

        iconset = QtGui.QIcon(getPixmap("package-reinstall"))
        item = menu.addAction(iconset, _("Reinstall"), reinstallaction.slot)
        reinstallaction.connect(item, self.actOnPackages, REINSTALL)
        if not hasinstalled:
            item.setEnabled(False)

        removeaction = PackagesAction(pkgs)

        iconset = QtGui.QIcon(getPixmap("package-remove"))
        item = menu.addAction(iconset, _("Remove"), removeaction.slot)
        removeaction.connect(item, self.actOnPackages, REMOVE)
        if not hasinstalled:
            item.setEnabled(False)

        keepaction = PackagesAction(pkgs)

        if not hasinstalled:
            iconset = QtGui.QIcon(getPixmap("package-available"))
        else:
            iconset = QtGui.QIcon(getPixmap("package-installed"))
        item = menu.addAction(iconset, _("Keep"), keepaction.slot)
        keepaction.connect(item, self.actOnPackages, KEEP)
        if not [pkg for pkg in pkgs if pkg in self._changeset]:
            item.setEnabled(False)

        fixaction = PackagesAction(pkgs)

        iconset = QtGui.QIcon(getPixmap("package-broken"))
        item = menu.addAction(iconset, _("Fix problems"), fixaction.slot)
        fixaction.connect(item, self.actOnPackages, FIX)
        if not hasinstalled:
            item.setEnabled(False)

        inconsistent = False
        thislocked = None
        alllocked = None
        names = pkgconf.getFlagTargets("lock")
        if [pkg for pkg in pkgs if pkg in self._changeset]:
            inconsistent = True
        else:
            for pkg in pkgs:
                if (names and pkg.name in names and 
                    ("=", pkg.version) in names[pkg.name]):
                    newthislocked = True
                    newalllocked = len(names[pkg.name]) > 1
                else:
                    newthislocked = False
                    newalllocked = pkgconf.testFlag("lock", pkg)
                if (thislocked is not None and thislocked != newthislocked or
                    alllocked is not None and alllocked != newalllocked):
                    inconsistent = True
                    break
                thislocked = newthislocked
                alllocked = newalllocked

        lockaction = PackagesAction(pkgs)

        if thislocked:
            if not hasnoninstalled:
                iconset = QtGui.QIcon(getPixmap("package-installed"))
            else:
                iconset = QtGui.QIcon(getPixmap("package-available"))
            item = menu.addAction(iconset, _("Unlock this version"), lockaction.slot)
            lockaction.connect(item, self.lockPackages, False)
        else:
            if not hasnoninstalled:
                iconset = QtGui.QIcon(getPixmap("package-installed-locked"))
            else:
                iconset = QtGui.QIcon(getPixmap("package-available-locked"))
            item = menu.addAction(iconset, _("Lock this version"), lockaction.slot)
            lockaction.connect(item, self.lockPackages, True)
        if inconsistent:
            item.setEnabled(False)

        lockallaction = PackagesAction(pkgs)

        if alllocked:
            if not hasnoninstalled:
                iconset = QtGui.QIcon(getPixmap("package-installed"))
            else:
                iconset = QtGui.QIcon(getPixmap("package-available"))
            item = menu.addAction(iconset, _("Unlock all versions"), lockallaction.slot)
            lockallaction.connect(item, self.lockAllPackages, False)
        else:
            if not hasnoninstalled:
                iconset = QtGui.QIcon(getPixmap("package-installed-locked"))
            else:
                iconset = QtGui.QIcon(getPixmap("package-available-locked"))
            item = menu.addAction(iconset, _("Lock all versions"), lockallaction.slot)
            lockallaction.connect(item, self.lockAllPackages, True)
        if inconsistent:
            item.setEnabled(False)

        priorityaction = PackagesAction(pkgs)
        
        item = menu.addAction(_("Priority"), priorityaction.slot)
        priorityaction.connect(item, self.priorityPackages)
        if len(pkgs) != 1:
            item.setEnabled(False)

        menu.show()
        menu.exec_(packageview.mapToGlobal(pnt))
Exemple #31
0
    def __init__(self, parent=None):
        QtGui.QDialog.__init__(self, parent)

        self.setWindowIcon(QtGui.QIcon(getPixmap("smart")))
        self.setWindowTitle(_("Icon Legend"))

        layout = QtGui.QVBoxLayout(self)

        self._vbox = QtGui.QWidget(self)
        QtGui.QVBoxLayout(self._vbox)
        self._vbox.layout().setMargin(10)
        self._vbox.layout().setSpacing(10)

        layout.addWidget(self._vbox)

        label = QtGui.QLabel("<b>" + _("The following icons are used to indicate\nthe current status of a package:").replace("\n", "<br>") + "</b>", self._vbox)
        label.show()
        self._vbox.layout().addWidget(label)

        grid = QtGui.QWidget(self)
        QtGui.QGridLayout(grid)
        grid.layout().setSpacing(5)
        grid.layout().setMargin(5)
        grid.layout().setColumnStretch(1, 1)
        grid.show()
        self._vbox.layout().addWidget(grid)
  
        row = 0
        for icon, legend in [
        (getPixmap("package-install"),            _("Marked for installation")),
        (getPixmap("package-reinstall"),          _("Marked for re-installation")),
        (getPixmap("package-upgrade"),            _("Marked for upgrade")),
        (getPixmap("package-downgrade"),          _("Marked for downgrade")),
        (getPixmap("package-remove"),             _("Marked for removal")),
        (getPixmap("package-available"),          _("Not installed")),
        (getPixmap("package-new"),                _("Not installed (new)")),
        (getPixmap("package-available-locked"),   _("Not installed (locked)")),
        (getPixmap("package-installed"),          _("Installed")),
        (getPixmap("package-installed-outdated"), _("Installed (upgradable)")),
        (getPixmap("package-installed-locked"),   _("Installed (locked)")),
        (getPixmap("package-broken"),             _("Broken")),
        ]:
            image = QtGui.QLabel("", grid)
            image.setPixmap(icon)
            image.show()
            grid.layout().addWidget(image, row, 0, QtCore.Qt.AlignLeft)
            label = QtGui.QLabel(legend, grid)
            label.show()
            grid.layout().addWidget(label, row, 1, QtCore.Qt.AlignLeft)
            row = row + 1
        
        self._buttonbox = QtGui.QWidget(self._vbox)
        QtGui.QHBoxLayout(self._buttonbox)
        self._buttonbox.layout().setSpacing(10)
        self._buttonbox.layout().addStretch(1)
        self._buttonbox.show()
        self._vbox.layout().addWidget(self._buttonbox)

        self._closebutton = QtGui.QPushButton(_("Close"), self._buttonbox)
        self._closebutton.show()
        QtCore.QObject.connect(self._closebutton, QtCore.SIGNAL("clicked()"), self, QtCore.SLOT("hide()"))
        self._buttonbox.layout().addWidget(self._closebutton)
Exemple #32
0
    def __init__(self, hassub, parent=None):
        Progress.__init__(self)
        QtGui.QDialog.__init__(self, parent)

        self._hassub = hassub
        self._shorturl = ShortURL(50)
        self._ticking = False
        self._stopticking = False
        self._fetcher = None

        self._beenshown = False
        self._mainthread = None

        if hassub:
            self.setMinimumSize(500, 400)
        else:
            self.setMinimumSize(300, 80)

        self.setWindowIcon(QtGui.QIcon(getPixmap("smart")))
        self.setWindowTitle(_("Operation Progress"))

        vbox = QtGui.QVBoxLayout(self)
        #vbox.setResizeMode(QtGui.QLayout.FreeResize)
        vbox.setMargin(10)
        vbox.setSpacing(10)

        self._topic = QtGui.QLabel(self)
        vbox.addWidget(self._topic)

        self._progressbar = QtGui.QProgressBar(self)
        #self._progressbar.setPercentageVisible(True)
        self._progressbar.show()
        vbox.addWidget(self._progressbar)

        if hassub:
            self._listview = QtGui.QTableWidget(self)
            #self._listview.setSorting(-1, False);
            self._listview.setSelectionMode(QtGui.QTableView.NoSelection)
            self._listview.show()
            vbox.addWidget(self._listview)

            #column = self._listview.addColumn(_("Progress"))
            #self._listview.setColumnWidthMode(column, QtGui.QTableView.Manual)
            #self._listview.setColumnWidth(column, 55)
            #column = self._listview.addColumn(_("Current"))
            #self._currentcolumn = column
            #column = self._listview.addColumn(_("Total"))
            #self._totalcolumn = column
            #column = self._listview.addColumn(_("Speed"))
            #self._speedcolumn = column
            #column = self._listview.addColumn(_("ETA"))
            #self._etacolumn = column
            #column = self._listview.addColumn(_("Description"))
            #self._listview.setColumnWidthMode(column, QtGui.QTableView.Manual)
            #self._listview.setColumnWidth(column, 165)
            #self._desccolumn = column
            self._listview.setHorizontalHeaderLabels([
                _("Progress"),
                _("Current"),
                _("Total"),
                _("Speed"),
                _("ETA"),
                _("Description")
            ])

            self._subiters = {}
            self._subindex = 0

            self._bbox = QtGui.QWidget(self)
            QtGui.QHBoxLayout(self._bbox)
            self._bbox.layout().setSpacing(10)
            self._bbox.layout().addStretch(1)
            vbox.addWidget(self._bbox)

            button = QtGui.QPushButton(_("Cancel"), self._bbox)
            button.show()
            QtCore.QObject.connect(button, QtCore.SIGNAL("clicked()"),
                                   self._cancel)
            self._bbox.layout().addWidget(button)
Exemple #33
0
    def __init__(self, parent=None):

        self._window = QtGui.QDialog(parent)
        self._window.setWindowIcon(QtGui.QIcon(getPixmap("smart")))
        self._window.setWindowTitle(_("New Mirror"))
        self._window.setModal(True)

        #self._window.setMinimumSize(600, 400)

        vbox = QtGui.QWidget(self._window)
        QtGui.QVBoxLayout(vbox)
        vbox.layout().setMargin(10)
        vbox.layout().setSpacing(10)
        vbox.show()

        table = QtGui.QWidget(vbox)
        QtGui.QGridLayout(table)
        table.layout().setSpacing(10)
        table.show()
        vbox.layout().addWidget(table)

        label = QtGui.QLabel(_("Origin URL:"), table)
        label.show()
        table.layout().addWidget(label)

        self._origin = QtGui.QLineEdit(table)
        self._origin.setMaxLength(40)
        self._origin.show()
        table.layout().addWidget(self._origin)

        label = QtGui.QLabel(_("Mirror URL:"), table)
        label.show()
        table.layout().addWidget(label)

        self._mirror = QtGui.QLineEdit(table)
        self._mirror.setMaxLength(40)
        self._mirror.show()
        table.layout().addWidget(self._mirror)

        sep = QtGui.QFrame(vbox)
        sep.setFrameStyle(QtGui.QFrame.HLine)
        sep.show()
        vbox.layout().addWidget(sep)

        bbox = QtGui.QWidget(self._window)
        QtGui.QHBoxLayout(bbox)
        bbox.layout().setSpacing(10)
        bbox.layout().addStretch(1)
        bbox.show()
        vbox.layout().addWidget(bbox)

        button = QtGui.QPushButton(_("OK"), bbox)
        QtCore.QObject.connect(button, QtCore.SIGNAL("clicked()"),
                               self._window, QtCore.SLOT("accept()"))
        bbox.layout().addWidget(button)

        button = QtGui.QPushButton(_("Cancel"), bbox)
        QtCore.QObject.connect(button, QtCore.SIGNAL("clicked()"),
                               self._window, QtCore.SLOT("reject()"))
        bbox.layout().addWidget(button)

        vbox.adjustSize()
        self._window.adjustSize()
Exemple #34
0
    def __init__(self, ctrl, argv=None):
        QtInterface.__init__(self, ctrl, argv)

        self._changeset = None

        self._window = QtGui.QMainWindow()
        self._window.setWindowTitle("Smart Package Manager %s" % VERSION)
        centerWindow(self._window)
        self._window.setMinimumSize(640, 480)
        app.connect(app, QtCore.SIGNAL('lastWindowClosed()'), app, QtCore.SLOT('quit()'))

        self._undo = []
        self._redo = []

        globals = {"self": self, "QtGui": QtGui, "QtCore": QtCore}
        #group = QtGui.QActionGroup(self._window, "Actions")
        group = QtGui.QActionGroup(self._window)
        self._actions = compileActions(group, ACTIONS, globals)

        class ToggleAction(QtGui.QAction):
        
            def __init__(self, group, name, label):
                QtGui.QAction.__init__(self, name, group)
                #self.setToggleAction(True)
                self.setCheckable(True)
                self.setText(label.replace("&","&&"))
                self._name = name
            
            def connect(self, signal, callback, userdata):
                self._callback = callback
                self._userdata = userdata
                QtCore.QObject.connect(self, QtCore.SIGNAL(signal), self.slot)
            
            def slot(self):
                self._callback(self._userdata)
         
        self._filters = {}
        for name, label in [("hide-non-upgrades", _("Hide Non-upgrades")),
                            ("hide-installed", _("Hide Installed")),
                            ("hide-uninstalled", _("Hide Uninstalled")),
                            ("hide-unmarked", _("Hide Unmarked")),
                            ("hide-unlocked", _("Hide Unlocked")),
                            ("hide-requested", _("Hide Requested")),
                            ("hide-old", _("Hide Old"))]:
            act = ToggleAction(None, name, label)
            act.connect("activated()", self.toggleFilter, name)
            self._actions[name] = act

        treestyle = sysconf.get("package-tree")
        for name, label in [("groups", _("Groups")),
                            ("channels", _("Channels")),
                            ("channels-groups", _("Channels & Groups")),
                            ("none", _("None"))]:
            act = ToggleAction(group, "tree-style-"+name, label)
            if name == treestyle:
                act.setChecked(True)
            act.connect("activated()", self.setTreeStyle, name)
            self._actions["tree-style-"+name] = act

        self._menubar = self._window.menuBar()
        for MENU in MENUBAR:
             def insertmenu(menubar, menu):
                item = menu[0]
                action = self._actions[item]
                m = QtGui.QMenu(menubar)
                m.setTitle(action.text())
                menubar.addMenu(m)
                for item in menu[1]:
                    if isinstance(item, tuple):
                        insertmenu(m, item)
                    elif item:
                        action = self._actions[item]
                        #i = QtGui.QPopupMenu(m)
                        i = QtGui.QMenu(m)
                        #text = action.menuText()
                        i.setTitle(action.text())
                        #m.insertItem(text, i)
                        #action.addTo(m)
                        m.addAction(action)
                    else:
                        m.addSeparator()
             insertmenu(self._menubar, MENU)

        self._toolbar = QtGui.QToolBar(self._window)
        for TOOL in TOOLBAR:
            def inserttool(toolbar, tool):
                if tool:
                    action = self._actions[tool]
                    pixmap = getPixmap(TOOLBARICONS[tool])
                    action.setIcon(QtGui.QIcon(pixmap))
                    toolbar.addAction(action)
                else:
                    toolbar.addSeparator()
            inserttool(self._toolbar, TOOL)
            self._window.addToolBar( self._toolbar)

        #self._window.add_accel_group(self._ui.get_accel_group())

        self._actions["exec-changes"].setShortcut(QtGui.QKeySequence("Ctrl+C"))
        self._actions["find"].setShortcut(QtGui.QKeySequence("Ctrl+F"))
        self._actions["expand-all"].setShortcut(QtGui.QKeySequence("Ctrl+O"))
        self._actions["collapse-all"].setShortcut(QtGui.QKeySequence("Ctrl+W"))
        self._actions["summary-window"].setShortcut(QtGui.QKeySequence("Ctrl+S"))

        self._actions["exec-changes"].setEnabled(False)
        self._actions["clear-changes"].setEnabled(False)
        self._actions["undo"].setEnabled(False)
        self._actions["redo"].setEnabled(False)

        # Search bar

        self._searchbar = QtGui.QToolBar(self._window)
        self._searchbar.hide()
        self._window.addToolBar(self._searchbar)
       
        label = QtGui.QLabel(_("Search:"), self._searchbar)
        label.show()
        self._searchbar.addWidget(label)

        self._searchentry = QtGui.QLineEdit(self._searchbar)
        QtCore.QObject.connect(self._searchentry, QtCore.SIGNAL("returnPressed()"), self.refreshPackages)
        self._searchentry.show()
        self._searchbar.addWidget(self._searchentry)

        button = QtGui.QPushButton(self._searchbar)
        QtCore.QObject.connect(button, QtCore.SIGNAL("clicked()"), self.refreshPackages)
        pixmap = getPixmap("crystal-search")
        button.setIcon(QtGui.QIcon(pixmap))
        button.show()
        self._searchbar.addWidget(button)

        buttongroup = QtGui.QButtonGroup(self._searchbar)
        #buttongroup.hide()
        
        self._searchname = QtGui.QRadioButton(_("Automatic"), self._searchbar)
        self._searchname.setChecked(True)
        QtCore.QObject.connect(self._searchname, QtCore.SIGNAL("clicked()"), self.refreshPackages)
        buttongroup.addButton(self._searchname)
        self._searchbar.addWidget(self._searchname)
        self._searchname.show()
        self._searchdesc = QtGui.QRadioButton(_("Description"), self._searchbar)
        self._searchdesc.setChecked(False)
        QtCore.QObject.connect(self._searchdesc, QtCore.SIGNAL("clicked()"), self.refreshPackages)
        self._searchdesc.show()
        buttongroup.addButton(self._searchdesc)
        self._searchbar.addWidget(self._searchdesc)

        # Packages and information

        self._splitter = QtGui.QSplitter(QtCore.Qt.Vertical, self._window)
        self._window.setCentralWidget(self._splitter)
        
        self._pv = QtPackageView(self._splitter)
        self._pv.show()

        self._pi = QtPackageInfo(self._splitter)
        self._pi.show()
        QtCore.QObject.connect(self._pv, QtCore.SIGNAL("packageSelected"), self._pi.setPackage)
        QtCore.QObject.connect(self._pv, QtCore.SIGNAL("packageActivated"), self.actOnPackages)
        QtCore.QObject.connect(self._pv, QtCore.SIGNAL("packagePopup"), self.packagePopup)

        self._status = self._window.statusBar()
        self._status.show()

        self._legend = QtLegend(self._window)
Exemple #35
0
    def __init__(self, ctrl, argv=None):
        QtInterface.__init__(self, ctrl, argv)

        self._changeset = None

        self._window = QtGui.QMainWindow()
        self._window.setWindowTitle("Smart Package Manager %s" % VERSION)
        centerWindow(self._window)
        self._window.setMinimumSize(640, 480)
        app.connect(app, QtCore.SIGNAL('lastWindowClosed()'), app, QtCore.SLOT('quit()'))

        self._undo = []
        self._redo = []

        globals = {"self": self, "QtGui": QtGui, "QtCore": QtCore}
        #group = QtGui.QActionGroup(self._window, "Actions")
        group = QtGui.QActionGroup(self._window)
        self._actions = compileActions(group, ACTIONS, globals)

        class ToggleAction(QtGui.QAction):
        
            def __init__(self, group, name, label):
                QtGui.QAction.__init__(self, name, group)
                #self.setToggleAction(True)
                self.setCheckable(True)
                self.setText(label.replace("&","&&"))
                self._name = name
            
            def connect(self, signal, callback, userdata):
                self._callback = callback
                self._userdata = userdata
                QtCore.QObject.connect(self, QtCore.SIGNAL(signal), self.slot)
            
            def slot(self):
                self._callback(self._userdata)
         
        self._filters = {}
        for name, label in [("hide-non-upgrades", _("Hide Non-upgrades")),
                            ("hide-installed", _("Hide Installed")),
                            ("hide-uninstalled", _("Hide Uninstalled")),
                            ("hide-unmarked", _("Hide Unmarked")),
                            ("hide-unlocked", _("Hide Unlocked")),
                            ("hide-requested", _("Hide Requested")),
                            ("hide-old", _("Hide Old"))]:
            act = ToggleAction(None, name, label)
            act.connect("activated()", self.toggleFilter, name)
            self._actions[name] = act

        treestyle = sysconf.get("package-tree")
        for name, label in [("groups", _("Groups")),
                            ("channels", _("Channels")),
                            ("channels-groups", _("Channels & Groups")),
                            ("none", _("None"))]:
            act = ToggleAction(group, "tree-style-"+name, label)
            if name == treestyle:
                act.setChecked(True)
            act.connect("activated()", self.setTreeStyle, name)
            self._actions["tree-style-"+name] = act

        self._menubar = self._window.menuBar()
        for MENU in MENUBAR:
             def insertmenu(menubar, menu):
                item = menu[0]
                action = self._actions[item]
                m = QtGui.QMenu(menubar)
                m.setTitle(action.text())
                menubar.addMenu(m)
                for item in menu[1]:
                    if isinstance(item, tuple):
                        insertmenu(m, item)
                    elif item:
                        action = self._actions[item]
                        #i = QtGui.QPopupMenu(m)
                        i = QtGui.QMenu(m)
                        #text = action.menuText()
                        i.setTitle(action.text())
                        #m.insertItem(text, i)
                        #action.addTo(m)
                        m.addAction(action)
                    else:
                        m.addSeparator()
             insertmenu(self._menubar, MENU)

        self._toolbar = QtGui.QToolBar(self._window)
        for TOOL in TOOLBAR:
            def inserttool(toolbar, tool):
                if tool:
                    action = self._actions[tool]
                    pixmap = getPixmap(TOOLBARICONS[tool])
                    action.setIcon(QtGui.QIcon(pixmap))
                    toolbar.addAction(action)
                else:
                    toolbar.addSeparator()
            inserttool(self._toolbar, TOOL)
            self._window.addToolBar( self._toolbar)

        #self._window.add_accel_group(self._ui.get_accel_group())

        self._actions["exec-changes"].setShortcut(QtGui.QKeySequence("Ctrl+C"))
        self._actions["find"].setShortcut(QtGui.QKeySequence("Ctrl+F"))
        self._actions["expand-all"].setShortcut(QtGui.QKeySequence("Ctrl+O"))
        self._actions["collapse-all"].setShortcut(QtGui.QKeySequence("Ctrl+W"))
        self._actions["summary-window"].setShortcut(QtGui.QKeySequence("Ctrl+S"))

        self._actions["exec-changes"].setEnabled(False)
        self._actions["clear-changes"].setEnabled(False)
        self._actions["undo"].setEnabled(False)
        self._actions["redo"].setEnabled(False)

        # Search bar

        self._searchbar = QtGui.QToolBar(self._window)
        self._searchbar.hide()
        self._window.addToolBar(self._searchbar)
       
        label = QtGui.QLabel(_("Search:"), self._searchbar)
        label.show()
        self._searchbar.addWidget(label)

        self._searchentry = QtGui.QLineEdit(self._searchbar)
        QtCore.QObject.connect(self._searchentry, QtCore.SIGNAL("returnPressed()"), self.refreshPackages)
        self._searchentry.show()
        self._searchbar.addWidget(self._searchentry)

        button = QtGui.QPushButton(self._searchbar)
        QtCore.QObject.connect(button, QtCore.SIGNAL("clicked()"), self.refreshPackages)
        pixmap = getPixmap("crystal-search")
        button.setIcon(QtGui.QIcon(pixmap))
        button.show()
        self._searchbar.addWidget(button)

        buttongroup = QtGui.QButtonGroup(self._searchbar)
        #buttongroup.hide()
        
        self._searchname = QtGui.QRadioButton(_("Automatic"), self._searchbar)
        self._searchname.setChecked(True)
        QtCore.QObject.connect(self._searchname, QtCore.SIGNAL("clicked()"), self.refreshPackages)
        buttongroup.addButton(self._searchname)
        self._searchbar.addWidget(self._searchname)
        self._searchname.show()
        self._searchdesc = QtGui.QRadioButton(_("Description"), self._searchbar)
        self._searchdesc.setChecked(False)
        QtCore.QObject.connect(self._searchdesc, QtCore.SIGNAL("clicked()"), self.refreshPackages)
        self._searchdesc.show()
        buttongroup.addButton(self._searchdesc)
        self._searchbar.addWidget(self._searchdesc)

        # Packages and information

        self._splitter = QtGui.QSplitter(QtCore.Qt.Vertical, self._window)
        self._window.setCentralWidget(self._splitter)
        
        self._pv = QtPackageView(self._splitter)
        self._pv.show()

        self._pi = QtPackageInfo(self._splitter)
        self._pi.show()
        QtCore.QObject.connect(self._pv, QtCore.SIGNAL("packageSelected"), self._pi.setPackage)
        QtCore.QObject.connect(self._pv, QtCore.SIGNAL("packageActivated"), self.actOnPackages)
        QtCore.QObject.connect(self._pv, QtCore.SIGNAL("packagePopup"), self.packagePopup)

        self._status = self._window.statusBar()
        self._status.show()

        self._legend = QtLegend(self._window)
aboutData = KAboutData("ksmarttray", "", ki18n(NAME), VERSION, ki18n(""),
            KAboutData.License_GPL_V2, ki18n("2008 Canonical, Inc."), 
            ki18n(""), "", "*****@*****.**")
for author in AUTHORS:
    name, email = author.rsplit(" ", 1)
    aboutData.addAuthor(ki18n(name), ki18n(""), email.strip("<>"), "")

KCmdLineArgs.init (sys.argv, aboutData)
app = KApplication()

import smart
ctrl = smart.init()

mainWindow = KMainWindow()
smart_icon = QIcon(getPixmap("smart"))
mainWindow.setWindowIcon(smart_icon)
sysTray = QSystemTrayIcon(smart_icon, None)
smart_image = getPixmap("smart").toImage()
aboutData.setProgramLogo(QVariant(smart_image))

menu = QMenu(None)
menu.addAction(KIcon("view-refresh"), "Check for updates", smart_update)
menu.addAction(smart_icon, "Launch Smart", smart_gui)
menu.addSeparator()
menu.addAction(KIcon("help-about"), "About", show_about)
menu.addAction(KIcon("application-exit"), "Quit", exit_applet)
sysTray.setContextMenu(menu)

sysTray.show()
Exemple #37
0
    def packagePopup(self, packageview, pkgs, pnt):
        
        menu = QtGui.QMenu(packageview)
        menu.move(pnt)
        
        hasinstalled = bool([pkg for pkg in pkgs if pkg.installed
                             and self._changeset.get(pkg) is not REMOVE])
        hasnoninstalled = bool([pkg for pkg in pkgs if not pkg.installed
                                and self._changeset.get(pkg) is not INSTALL])

        class PackagesAction(object):
        
            def __init__(self, pkgs):
                self._pkgs = pkgs
                self._callback = None
                self._userdata = None
            
            def connect(self, item, callback, userdata=None):
                self._callback = callback
                self._userdata = userdata
            
            def slot(self):
                self._callback(self._pkgs, self._userdata)

        installaction = PackagesAction(pkgs)

        iconset = QtGui.QIcon(getPixmap("package-install"))
        item = menu.addAction(iconset, _("Install"), installaction.slot)
        installaction.connect(item, self.actOnPackages, INSTALL)
        if not hasnoninstalled:
            item.setEnabled(False)

        reinstallaction = PackagesAction(pkgs)

        iconset = QtGui.QIcon(getPixmap("package-reinstall"))
        item = menu.addAction(iconset, _("Reinstall"), reinstallaction.slot)
        reinstallaction.connect(item, self.actOnPackages, REINSTALL)
        if not hasinstalled:
            item.setEnabled(False)

        removeaction = PackagesAction(pkgs)

        iconset = QtGui.QIcon(getPixmap("package-remove"))
        item = menu.addAction(iconset, _("Remove"), removeaction.slot)
        removeaction.connect(item, self.actOnPackages, REMOVE)
        if not hasinstalled:
            item.setEnabled(False)

        keepaction = PackagesAction(pkgs)

        if not hasinstalled:
            iconset = QtGui.QIcon(getPixmap("package-available"))
        else:
            iconset = QtGui.QIcon(getPixmap("package-installed"))
        item = menu.addAction(iconset, _("Keep"), keepaction.slot)
        keepaction.connect(item, self.actOnPackages, KEEP)
        if not [pkg for pkg in pkgs if pkg in self._changeset]:
            item.setEnabled(False)

        fixaction = PackagesAction(pkgs)

        iconset = QtGui.QIcon(getPixmap("package-broken"))
        item = menu.addAction(iconset, _("Fix problems"), fixaction.slot)
        fixaction.connect(item, self.actOnPackages, FIX)
        if not hasinstalled:
            item.setEnabled(False)

        inconsistent = False
        thislocked = None
        alllocked = None
        names = pkgconf.getFlagTargets("lock")
        if [pkg for pkg in pkgs if pkg in self._changeset]:
            inconsistent = True
        else:
            for pkg in pkgs:
                if (names and pkg.name in names and 
                    ("=", pkg.version) in names[pkg.name]):
                    newthislocked = True
                    newalllocked = len(names[pkg.name]) > 1
                else:
                    newthislocked = False
                    newalllocked = pkgconf.testFlag("lock", pkg)
                if (thislocked is not None and thislocked != newthislocked or
                    alllocked is not None and alllocked != newalllocked):
                    inconsistent = True
                    break
                thislocked = newthislocked
                alllocked = newalllocked

        lockaction = PackagesAction(pkgs)

        if thislocked:
            if not hasnoninstalled:
                iconset = QtGui.QIcon(getPixmap("package-installed"))
            else:
                iconset = QtGui.QIcon(getPixmap("package-available"))
            item = menu.addAction(iconset, _("Unlock this version"), lockaction.slot)
            lockaction.connect(item, self.lockPackages, False)
        else:
            if not hasnoninstalled:
                iconset = QtGui.QIcon(getPixmap("package-installed-locked"))
            else:
                iconset = QtGui.QIcon(getPixmap("package-available-locked"))
            item = menu.addAction(iconset, _("Lock this version"), lockaction.slot)
            lockaction.connect(item, self.lockPackages, True)
        if inconsistent:
            item.setEnabled(False)

        lockallaction = PackagesAction(pkgs)

        if alllocked:
            if not hasnoninstalled:
                iconset = QtGui.QIcon(getPixmap("package-installed"))
            else:
                iconset = QtGui.QIcon(getPixmap("package-available"))
            item = menu.addAction(iconset, _("Unlock all versions"), lockallaction.slot)
            lockallaction.connect(item, self.lockAllPackages, False)
        else:
            if not hasnoninstalled:
                iconset = QtGui.QIcon(getPixmap("package-installed-locked"))
            else:
                iconset = QtGui.QIcon(getPixmap("package-available-locked"))
            item = menu.addAction(iconset, _("Lock all versions"), lockallaction.slot)
            lockallaction.connect(item, self.lockAllPackages, True)
        if inconsistent:
            item.setEnabled(False)

        priorityaction = PackagesAction(pkgs)
        
        item = menu.addAction(_("Priority"), priorityaction.slot)
        priorityaction.connect(item, self.priorityPackages)
        if len(pkgs) != 1:
            item.setEnabled(False)

        menu.show()
        menu.exec_(packageview.mapToGlobal(pnt))
Exemple #38
0
                       ki18n(""), KAboutData.License_GPL_V2,
                       ki18n("2008 Canonical, Inc."), ki18n(""),
                       "http://smartpm.org", "*****@*****.**")
for author in AUTHORS:
    name, email = author.rsplit(" ", 1)
    aboutData.addAuthor(ki18n(name), ki18n(""), email.strip("<>"), "")

KCmdLineArgs.init(sys.argv, aboutData)
app = KApplication()

import smart

ctrl = smart.init()

mainWindow = KMainWindow()
smart_icon = QIcon(getPixmap("smart"))
mainWindow.setWindowIcon(smart_icon)
sysTray = QSystemTrayIcon(smart_icon, None)
smart_image = getPixmap("smart").toImage()
aboutData.setProgramLogo(QVariant(smart_image))

menu = QMenu(None)
menu.addAction(KIcon("view-refresh"), "Check for updates", smart_update)
menu.addAction(smart_icon, "Launch Smart", smart_gui)
menu.addSeparator()
menu.addAction(KIcon("help-about"), "About", show_about)
menu.addAction(KIcon("application-exit"), "Quit", exit_applet)
sysTray.setContextMenu(menu)

sysTray.show()
Exemple #39
0
    def __init__(self, parent=None):
        QtGui.QDialog.__init__(self, parent)

        self.setWindowIcon(QtGui.QIcon(getPixmap("smart")))
        self.setWindowTitle(_("Icon Legend"))

        layout = QtGui.QVBoxLayout(self)

        self._vbox = QtGui.QWidget(self)
        QtGui.QVBoxLayout(self._vbox)
        self._vbox.layout().setMargin(10)
        self._vbox.layout().setSpacing(10)

        layout.addWidget(self._vbox)

        label = QtGui.QLabel(
            "<b>" +
            _("The following icons are used to indicate\nthe current status of a package:"
              ).replace("\n", "<br>") + "</b>", self._vbox)
        label.show()
        self._vbox.layout().addWidget(label)

        grid = QtGui.QWidget(self)
        QtGui.QGridLayout(grid)
        grid.layout().setSpacing(5)
        grid.layout().setMargin(5)
        grid.layout().setColumnStretch(1, 1)
        grid.show()
        self._vbox.layout().addWidget(grid)

        row = 0
        for icon, legend in [
            (getPixmap("package-install"), _("Marked for installation")),
            (getPixmap("package-reinstall"), _("Marked for re-installation")),
            (getPixmap("package-upgrade"), _("Marked for upgrade")),
            (getPixmap("package-downgrade"), _("Marked for downgrade")),
            (getPixmap("package-remove"), _("Marked for removal")),
            (getPixmap("package-available"), _("Not installed")),
            (getPixmap("package-new"), _("Not installed (new)")),
            (getPixmap("package-available-locked"),
             _("Not installed (locked)")),
            (getPixmap("package-installed"), _("Installed")),
            (getPixmap("package-installed-outdated"),
             _("Installed (upgradable)")),
            (getPixmap("package-installed-locked"), _("Installed (locked)")),
            (getPixmap("package-broken"), _("Broken")),
        ]:
            image = QtGui.QLabel("", grid)
            image.setPixmap(icon)
            image.show()
            grid.layout().addWidget(image, row, 0, QtCore.Qt.AlignLeft)
            label = QtGui.QLabel(legend, grid)
            label.show()
            grid.layout().addWidget(label, row, 1, QtCore.Qt.AlignLeft)
            row = row + 1

        self._buttonbox = QtGui.QWidget(self._vbox)
        QtGui.QHBoxLayout(self._buttonbox)
        self._buttonbox.layout().setSpacing(10)
        self._buttonbox.layout().addStretch(1)
        self._buttonbox.show()
        self._vbox.layout().addWidget(self._buttonbox)

        self._closebutton = QtGui.QPushButton(_("Close"), self._buttonbox)
        self._closebutton.show()
        QtCore.QObject.connect(self._closebutton, QtCore.SIGNAL("clicked()"),
                               self, QtCore.SLOT("hide()"))
        self._buttonbox.layout().addWidget(self._closebutton)
    def __init__(self, parent=None):
        QtGui.QWidget.__init__(self, parent)

        self.show()
        self._expandPackages = True

        self._changeset = {}
        self._vbox = QtGui.QVBoxLayout(self)
        # Tree View
        
        self._treeview = QtGui.QTreeWidget(self)
        
        # Tree View Style start
        
        self._treeview.setEnabled(True)
        self._treeview.setGeometry(QtCore.QRect(10, 10, 500, 200))
        sizePolicy = QtGui.QSizePolicy(QtGui.QSizePolicy.Expanding, QtGui.QSizePolicy.Expanding)
        sizePolicy.setHorizontalStretch(5)
        sizePolicy.setVerticalStretch(4)
        sizePolicy.setHeightForWidth(self._treeview.sizePolicy().hasHeightForWidth())
        self._treeview.setSizePolicy(sizePolicy)
        self._treeview.setMinimumSize(QtCore.QSize(500, 200))
        font = QtGui.QFont()
        font.setFamily(_fromUtf8("FreeSans"))
        font.setPointSize(11)
        self._treeview.setFont(font)
        self._treeview.setMouseTracking(True)
        self._treeview.setAcceptDrops(True)
        self._treeview.setAutoFillBackground(False)
        self._treeview.setFrameShape(QtGui.QFrame.StyledPanel)
        self._treeview.setFrameShadow(QtGui.QFrame.Raised)
        self._treeview.setLineWidth(2)
        self._treeview.setMidLineWidth(1)
        self._treeview.setAutoScroll(False)
        self._treeview.setTabKeyNavigation(True)
        self._treeview.setAlternatingRowColors(True)
        self._treeview.setSelectionBehavior(QtGui.QAbstractItemView.SelectRows)
        self._treeview.setAnimated(True)
        self._treeview.setHeaderHidden(False)
        self._treeview.setExpandsOnDoubleClick(True)
        self._treeview.setObjectName(_fromUtf8("_treeview"))
        self._treeview.headerItem().setText(0, _fromUtf8("1"))
        self._treeview.header().setCascadingSectionResizes(True)
        self._treeview.header().setDefaultSectionSize(160)
        self._treeview.header().setHighlightSections(True)
        self._treeview.header().setMinimumSectionSize(50)
        self._treeview.header().setSortIndicatorShown(True)

        # Tree View Style end

        QtCore.QObject.connect(self._treeview, QtCore.SIGNAL("itemClicked(QTreeWidgetItem *, int)"), self._clicked)
        QtCore.QObject.connect(self._treeview, QtCore.SIGNAL("itemDoubleClicked(QTreeWidgetItem *, int)"), self._doubleClicked)
        QtCore.QObject.connect(self._treeview, QtCore.SIGNAL("itemPressed(QTreeWidgetItem *, int)"), self._pressed)
        QtCore.QObject.connect(self._treeview, QtCore.SIGNAL("itemSelectionChanged()"), self._selectionChanged)
        #self._treeview.setAllColumnsShowFocus(True)
        #self._treeview.setRootIsDecorated(True)
        self._treeview.show()
        self._vbox.addWidget(self._treeview)
        
        #self._treeview.setSelectionMode(QtGui.QTreeView.Extended)
        
        #self._treeview.addColumn("") # pixmap
        #self._treeview.addColumn(_("Package"))
        #self._treeview.addColumn(_("Version"))
        self._treeview.setHeaderLabels(["", _("Package"), _("Version")])

        self._ipixbuf = getPixmap("package-installed")
        self._ilpixbuf = getPixmap("package-installed-locked")
        self._apixbuf = getPixmap("package-available")
        self._alpixbuf = getPixmap("package-available-locked")
        self._npixbuf = getPixmap("package-new")
        self._nlpixbuf = getPixmap("package-new-locked")
        self._fpixbuf = getPixmap("folder")
        self._Ipixbuf = getPixmap("package-install")
        self._Rpixbuf = getPixmap("package-remove")
        self._rpixbuf = getPixmap("package-reinstall")
    def __init__(self, parent=None):

        self._window = QtGui.QDialog(parent)
        self._window.setWindowIcon(QtGui.QIcon(getPixmap("smart")))
        self._window.setWindowTitle(_("New Package Priority"))
        self._window.setModal(True)

        #self._window.setMinimumSize(600, 400)

        vbox = QtGui.QWidget(self._window)
        QtGui.QVBoxLayout(vbox)
        vbox.layout().setMargin(10)
        vbox.layout().setSpacing(10)
        vbox.show()

        table = QtGui.QWidget(self._window)
        QtGui.QGridLayout(table)
        table.layout().setSpacing(10)
        table.show()
        vbox.layout().addWidget(table)
        
        label = QtGui.QLabel(_("Package Name:"), table)
        table.layout().addWidget(label)

        self._name = QtGui.QLineEdit(table)
        self._name.show()
        table.layout().addWidget(self._name)

        label = QtGui.QLabel(_("Channel Alias:"), table)
        table.layout().addWidget(label)

        self._alias = QtGui.QLineEdit(table)
        self._alias.setText("*")
        self._alias.show()
        table.layout().addWidget(self._alias)

        label = QtGui.QLabel(_("Priority:"), table)
        table.layout().addWidget(label)

        self._priority = QtGui.QSpinBox(table)
        self._priority.setSingleStep(1)
        self._priority.setRange(-100000,+100000)
        self._priority.show()
        table.layout().addWidget(self._priority)

        sep = QtGui.QFrame(vbox)
        sep.setFrameShape(QtGui.QFrame.HLine)
        sep.setFrameShadow(QtGui.QFrame.Sunken)
        sep.show()
        vbox.layout().addWidget(sep)

        bbox = QtGui.QWidget(vbox)
        QtGui.QHBoxLayout(bbox)
        bbox.layout().setSpacing(10)
        bbox.layout().addStretch(1)
        bbox.show()
        vbox.layout().addWidget(bbox)

        button = QtGui.QPushButton(_("Cancel"), bbox)
        QtCore.QObject.connect(button, QtCore.SIGNAL("clicked()"), self._window, QtCore.SLOT("reject()"))
        bbox.layout().addWidget(button)

        button = QtGui.QPushButton(_("OK"), bbox)
        QtCore.QObject.connect(button, QtCore.SIGNAL("clicked()"), self._window, QtCore.SLOT("accept()"))
        bbox.layout().addWidget(button)

        button.setDefault(True)
        vbox.adjustSize()
        self._window.adjustSize()
Exemple #42
0
    def __init__(self, parent=None):

        self._window = QtGui.QDialog(None)
        self._window.setWindowIcon(QtGui.QIcon(getPixmap("smart")))
        self._window.setWindowTitle(_("Mirrors"))
        self._window.setModal(True)

        self._window.setMinimumSize(600, 400)

        layout = QtGui.QVBoxLayout(self._window)
        #layout.setResizeMode(QtGui.QLayout.FreeResize)

        vbox = QtGui.QWidget(self._window)
        QtGui.QVBoxLayout(vbox)
        vbox.layout().setMargin(10)
        vbox.layout().setSpacing(10)
        vbox.show()

        layout.addWidget(vbox)

        self._treeview = QtGui.QTreeWidget(vbox)
        self._treeview.setHeaderHidden(True)
        self._treeview.show()
        vbox.layout().addWidget(self._treeview)

        #self._treeview.addColumn(_("Mirror"))
        self._treeview.setHeaderLabels([_("Mirror")])
        QtCore.QObject.connect(
            self._treeview,
            QtCore.SIGNAL("itemChanged(QTreeWidgetItem *, int)"),
            self.itemChanged)
        QtCore.QObject.connect(self._treeview,
                               QtCore.SIGNAL("itemSelectionChanged()"),
                               self.selectionChanged)

        bbox = QtGui.QWidget(vbox)
        QtGui.QHBoxLayout(bbox)
        bbox.layout().setSpacing(10)
        bbox.layout().addStretch(1)
        bbox.show()
        vbox.layout().addWidget(bbox)

        button = QtGui.QPushButton(_("New"), bbox)
        button.setEnabled(True)
        button.setIcon(QtGui.QIcon(getPixmap("crystal-add")))
        button.show()
        QtCore.QObject.connect(button, QtCore.SIGNAL("clicked()"),
                               self.newMirror)
        self._newmirror = button
        bbox.layout().addWidget(button)

        button = QtGui.QPushButton(_("Delete"), bbox)
        button.setEnabled(False)
        button.setIcon(QtGui.QIcon(getPixmap("crystal-delete")))
        button.show()
        QtCore.QObject.connect(button, QtCore.SIGNAL("clicked()"),
                               self.delMirror)
        self._delmirror = button
        bbox.layout().addWidget(button)

        button = QtGui.QPushButton(_("Close"), bbox)
        QtCore.QObject.connect(button, QtCore.SIGNAL("clicked()"),
                               self._window, QtCore.SLOT("accept()"))
        bbox.layout().addWidget(button)

        button.setDefault(True)
Exemple #43
0
    def __init__(self, parent=None):

        self._window = QtGui.QDialog(None)
        self._window.setWindowIcon(QtGui.QIcon(getPixmap("smart")))
        self._window.setWindowTitle(_("Flags"))
        self._window.setModal(True)
        
        self._window.setMinimumSize(600, 400)

        layout = QtGui.QVBoxLayout(self._window)
        #layout.setResizeMode(QtGui.QLayout.FreeResize)

        topvbox = QtGui.QWidget(self._window)
        QtGui.QVBoxLayout(topvbox)
        topvbox.layout().setMargin(10)
        topvbox.layout().setSpacing(10)
        topvbox.show()

        layout.addWidget(topvbox)

        tophbox = QtGui.QWidget(topvbox)
        QtGui.QHBoxLayout(tophbox)
        tophbox.layout().setSpacing(20)
        tophbox.show()
        topvbox.layout().addWidget(tophbox)

        # Left side
        vbox = QtGui.QGroupBox(tophbox)
        QtGui.QVBoxLayout(vbox)
        vbox.layout().setSpacing(10)
        vbox.show()
        tophbox.layout().addWidget(vbox)

        self._flagsview = QtGui.QTableWidget(vbox)
        self._flagsview.show()
        vbox.layout().addWidget(self._flagsview)

        QtCore.QObject.connect(self._flagsview, QtCore.SIGNAL("selectionChanged()"), self.flagSelectionChanged)

        #self._flagsview.addColumn(_("Flags"))
        self._flagsview.setHorizontalHeaderLabels([_("Flags")])
        self._flagsview.horizontalHeader().show()

        #bbox = QtGui.QHBox(vbox)
        bbox = QtGui.QWidget(vbox)
        QtGui.QHBoxLayout(bbox)
        bbox.layout().setMargin(5)
        bbox.layout().setSpacing(10)
        bbox.show()
        vbox.layout().addWidget(bbox)

        button = QtGui.QPushButton(_("New"), bbox)
        button.setEnabled(True)
        button.setIcon(QtGui.QIcon(getPixmap("crystal-add")))
        button.show()
        QtCore.QObject.connect(button, QtCore.SIGNAL("clicked()"), self.newFlag)
        self._newflag = button
        bbox.layout().addWidget(button)

        button = QtGui.QPushButton(_("Delete"), bbox)
        button.setEnabled(False)
        button.setIcon(QtGui.QIcon(getPixmap("crystal-delete")))
        button.show()
        QtCore.QObject.connect(button, QtCore.SIGNAL("clicked()"), self.delFlag)
        self._delflag = button
        bbox.layout().addWidget(button)

        # Right side
        vbox = QtGui.QGroupBox(tophbox)
        QtGui.QVBoxLayout(vbox)
        vbox.layout().setSpacing(10)
        vbox.show()
        tophbox.layout().addWidget(vbox)

        self._targetsview = QtGui.QTableWidget(vbox)
        self._targetsview.show()
        vbox.layout().addWidget(self._targetsview)

        QtCore.QObject.connect(self._targetsview, QtCore.SIGNAL("selectionChanged()"), self.targetSelectionChanged)

        #self._targetsview.addColumn(_("Targets"))
        self._targetsview.setHorizontalHeaderLabels([_("Targets")])
        self._targetsview.horizontalHeader().show()

        bbox = QtGui.QWidget(vbox)
        QtGui.QHBoxLayout(bbox)
        bbox.layout().setMargin(5)
        bbox.layout().setSpacing(10)
        bbox.show()
        vbox.layout().addWidget(bbox)

        button = QtGui.QPushButton(_("New"), bbox)
        button.setEnabled(False)
        button.setIcon(QtGui.QIcon(getPixmap("crystal-add")))
        button.show()
        QtCore.QObject.connect(button, QtCore.SIGNAL("clicked()"), self.newTarget)
        self._newtarget = button
        bbox.layout().addWidget(button)

        button = QtGui.QPushButton(_("Delete"), bbox)
        button.setEnabled(False)
        button.setIcon(QtGui.QIcon(getPixmap("crystal-delete")))
        button.show()
        QtCore.QObject.connect(button, QtCore.SIGNAL("clicked()"), self.delTarget)
        self._deltarget = button
        bbox.layout().addWidget(button)


        # Bottom
        sep = QtGui.QFrame(topvbox)
        sep.setFrameShape(QtGui.QFrame.HLine)
        sep.setFrameShadow(QtGui.QFrame.Sunken)
        sep.show()
        topvbox.layout().addWidget(sep)

        bbox = QtGui.QWidget(topvbox)
        QtGui.QHBoxLayout(bbox)
        bbox.layout().setSpacing(10)
        bbox.layout().addStretch(1)
        bbox.show()
        topvbox.layout().addWidget(bbox)

        button = QtGui.QPushButton(_("Close"), bbox)
        button.show()
        QtCore.QObject.connect(button, QtCore.SIGNAL("clicked()"), self._window, QtCore.SLOT("accept()"))
        bbox.layout().addWidget(button)
        
        button.setDefault(True)