示例#1
0
    def __init__(self, title, main_app, model_controller, plugin_manager):
        qt.QMainWindow.__init__(self, None, title, qt.Qt.WDestructiveClose)
        self.setWindowState(qt.Qt.WindowMaximized)
        self.setCaption(title)

        self.setIcon(
            qt.QPixmap(os.path.join(CONF.getIconsPath(), 'faraday_icon.png')))

        self._main_app = main_app
        self._model_controller = model_controller

        self._mainArea = qt.QHBox(self)
        self.setCentralWidget(self._mainArea)
        self._vb_splitter = qt.QSplitter(self._mainArea)
        self._vb_splitter.setOrientation(qt.QSplitter.Vertical)
        self._hb_splitter = qt.QSplitter(self._vb_splitter)
        self._hb_splitter.setOrientation(qt.QSplitter.Horizontal)

        self.statusBar().setSizeGripEnabled(False)

        self._shell_widgets = []
        self._notifications = []
        self._tab_manager = TabManager(self._hb_splitter)
        self._perspective_manager = PerspectiveManager(self._hb_splitter,
                                                       self._main_app)

        self._hosts_treeview = HostsBrowser(self._perspective_manager,
                                            self._model_controller, 'Hosts')
        notifier.registerWidget(self._hosts_treeview)

        self._perspective_manager.registerPerspective(self._hosts_treeview,
                                                      default=True)

        wtw = WorkspaceTreeWindow(self._perspective_manager, 'Workspaces',
                                  self._main_app.getWorkspaceManager())
        self._perspective_manager.registerPerspective(wtw)
        self._workspaces_treeview = wtw

        self._log_console = LogConsole(self._vb_splitter, 'Console')

        self._actions = dict()
        self._setupActions()

        self._menues = {}
        self._setupMenues()

        self.main_toolbar = qt.QToolBar(self, 'main toolbar')
        self._setupMainToolbar()

        self.location_toolbar = LocationToolbar(self, 'location toolbar')
        self.location_toolbar.setOffset(1500)

        self._status_bar_widgets = dict()
        self._setupStatusBar()

        self._is_shell_maximized = False

        self.shell_font = qt.QFont()
        self.shell_font.setRawName(CONF.getFont())
        self.setSizeFont()
示例#2
0
    def __init__(self, parent=None):

        self._window = qt.QDialog(parent)
        self._window.setIcon(getPixmap("smart"))
        self._window.setCaption(_("Package Priority"))
        self._window.setModal(True)
        
        #self._window.setMinimumSize(600, 400)

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

        self._vbox = vbox

        self._table = qt.QGrid(2, vbox)
        self._table.setSpacing(10)
        self._table.show()

        bbox = qt.QHBox(vbox)
        bbox.setSpacing(10)
        bbox.layout().addStretch(1)
        bbox.show()

        button = qt.QPushButton(_("Close"), bbox)
        qt.QObject.connect(button, qt.SIGNAL("clicked()"), self._window, qt.SLOT("hide()"))

        self._vbox.adjustSize()
        self._window.adjustSize()
示例#3
0
    def __init__(self, parent=None, configuration=None):
        BaseDialog.__init__(self,
                            parent,
                            "Config Dialog",
                            layout_margin=10,
                            layout_spacing=15,
                            modal=True)

        self.configuration = configuration

        hbox = qt.QHBox(self)

        self.contentsWidget = qt.QIconView(hbox)

        self.contentsWidget.setMaximumWidth(128)

        self.pagesWidget = qt.QWidgetStack(hbox)
        self.pagesWidget.addWidget(ConfigurationPage(), 0)
        self.pagesWidget.addWidget(UpdatePage(), 1)
        self.pagesWidget.setSizePolicy(
            qt.QSizePolicy(qt.QSizePolicy.Expanding, qt.QSizePolicy.Expanding))

        self.createIcons()
        hbox.setStretchFactor(self.contentsWidget, 0)
        hbox.setStretchFactor(self.pagesWidget, 10)
        self.layout.addWidget(hbox)

        self.setupButtons({
            "ok": None,
            "cancel": self.close,
        })
示例#4
0
    def __init__(self, *args, **kwargs):
        qt.QWidget.__init__(self, *args)

        self.configuration = Configuration.Configuration()
      
        self.setCaption("GUI Editor")

        tb = qt.QHBox(self)
        toolsBox = qt.QGrid(6, tb)
        HorizontalSpacer(tb)
        toolsBox.setSizePolicy(qt.QSizePolicy.Expanding, qt.QSizePolicy.Fixed)
        self.cmdAddWindow = ToolButton(toolsBox, "window_new", self.addWindow, "add a new window (container)")
        self.cmdAddTab=ToolButton(toolsBox, "tab", self.addTab, "add a new tab (container)")
        self.cmdAddHBox=ToolButton(toolsBox, "add_hbox", self.addHBox, "add a new horizontal box (container)")
        self.cmdAddVBox=ToolButton(toolsBox, "add_vbox", self.addVBox, "add a new vertical box (container)")
        self.cmdAddHGroupBox=ToolButton(toolsBox, "hgroupbox", self.addHGroupBox, "add a new horizontal group box (container)")
        self.cmdAddVGroupBox=ToolButton(toolsBox, "vgroupbox", self.addVGroupBox, "add a new vertical group box (container)")
        self.cmdAddHSpacer=ToolButton(toolsBox, "add_hspacer", self.addHSpacer, "add a new horizontal spacer")
        self.cmdAddVSpacer=ToolButton(toolsBox, "add_vspacer", self.addVSpacer, "add a new vertical spacer")
        self.cmdAddHSplitter=ToolButton(toolsBox, "hsplitter", self.addHSplitter, "add a new horizontal splitter (container)")
        self.cmdAddVSplitter=ToolButton(toolsBox, "vsplitter", self.addVSplitter, "add a new vertical splitter (container)")
        self.cmdAddIcon=ToolButton(toolsBox, "icon", self.addIcon, "add a new icon")
        self.cmdAddLabel=ToolButton(toolsBox, "label", self.addLabel, "add a new label")
        treeHandlingBox = qt.QHBox(self)
        treeHandlingBox.setSizePolicy(qt.QSizePolicy.Expanding, qt.QSizePolicy.Fixed)
        self.cmdShowConnections=ToolButton(treeHandlingBox, "connect_creating", self.showConnections, "manage connections between items")
        HorizontalSpacer(treeHandlingBox,size=20)
        self.cmdMoveUp=ToolButton(treeHandlingBox, "Up2", self.moveUp, "move an item up")
        self.cmdMoveDown=ToolButton(treeHandlingBox, "Down2", self.moveDown, "move an item down")
        HorizontalSpacer(treeHandlingBox, size=10)
        self.cmdRemoveItem=ToolButton(treeHandlingBox, "delete_small", self.removeItem, "delete an item")
        HorizontalSpacer(treeHandlingBox)
        
        self.treeLayout = GUIListView(self)
        self.rootElement = qt.QListViewItem(self.treeLayout, "GUI tree", "")
        self.rootElement.setOpen(True)

        qt.QObject.connect(self.treeLayout, qt.SIGNAL('selectionChanged(QListViewItem *)'), self.itemSelected)
        qt.QObject.connect(self.treeLayout, qt.SIGNAL('doubleClicked(QListViewItem *, const QPoint &, int)'), self.itemDoubleClicked)
        qt.QObject.connect(self.treeLayout, qt.SIGNAL('itemRenamed(QListViewItem *, int)'), self.itemRenamed)
        qt.QObject.connect(self.treeLayout, qt.PYSIGNAL('dragdrop'), self.itemDragDropped)
        qt.QObject.connect(self.treeLayout, qt.PYSIGNAL('contextMenuRequested'), self.itemRightClicked)
     
        qt.QVBoxLayout(self, 0, 10)
        self.layout().addWidget(tb)
        self.layout().addWidget(treeHandlingBox)
        self.layout().addWidget(self.treeLayout)
示例#5
0
 def open_hbox(self, text=None):
     if text:
         hb = qt.QGroupBox(1, qt.QGroupBox.Vertical, text,
                           self.group[-1][0])
     else:
         hb = qt.QHBox(self.group[-1][0])
     self.group.append([hb, -1])
     self.mode.append('h')
示例#6
0
    def __init__(self, parent=None):
        qt.QDialog.__init__(self, parent)

        self.setIcon(getPixmap("smart"))
        self.setCaption(_("Change Summary"))
        self.setModal(True)
        self.setMinimumSize(600, 400)
        centerWindow(self)

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

        self._label = qt.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 = qt.QLabel("", self)
        self._vbox.addWidget(self._sizelabel)

        self._confirmbbox = qt.QHBox(self)
        self._confirmbbox.setSpacing(10)
        self._confirmbbox.layout().addStretch(1)
        self._vbox.addWidget(self._confirmbbox)

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

        self._closebbox = qt.QHBox(self)
        self._closebbox.setSpacing(10)
        self._closebbox.layout().addStretch(1)
        self._vbox.addWidget(self._closebbox)

        self._closebutton = qt.QPushButton(_("Close"), self._closebbox)
        qt.QObject.connect(self._closebutton, qt.SIGNAL("clicked()"), self,
                           qt.SLOT("close()"))
示例#7
0
 def __init__(self, parent, name, *args, **kwargs):
     qt.QHBox.__init__(self, parent, name)
     self.setName(name)
     self.setSpacing(0)
     hb = qt.QHBox(self)
     self._lstr = qt.QLabel("Perspective", hb, "perspective_label")
     self._lcombo = qt.QComboBox(hb, 'Perspective_ComboBox')
     self.connect(self._lcombo, qt.SIGNAL('activated(int)'),
                  parent.setActivePerspective)
示例#8
0
    def __init__(self, parent=None):

        self._window = qt.QDialog(parent)
        self._window.setIcon(getPixmap("smart"))
        self._window.setCaption(_("New Package Priority"))
        self._window.setModal(True)

        #self._window.setMinimumSize(600, 400)

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

        table = qt.QGrid(2, vbox)
        table.setSpacing(10)
        table.show()

        label = qt.QLabel(_("Package Name:"), table)

        self._name = qt.QLineEdit(table)
        self._name.show()

        label = qt.QLabel(_("Channel Alias:"), table)

        self._alias = qt.QLineEdit(table)
        self._alias.setText("*")
        self._alias.show()

        label = qt.QLabel(_("Priority:"), table)

        self._priority = qt.QSpinBox(table)
        self._priority.setSteps(1, 10)
        self._priority.setRange(-100000,+100000)
        self._priority.show()

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

        bbox = qt.QHBox(vbox)
        bbox.setSpacing(10)
        bbox.layout().addStretch(1)
        bbox.show()

        button = qt.QPushButton(_("Cancel"), bbox)
        qt.QObject.connect(button, qt.SIGNAL("clicked()"), self._window, qt.SLOT("reject()"))

        button = qt.QPushButton(_("OK"), bbox)
        qt.QObject.connect(button, qt.SIGNAL("clicked()"), self._window, qt.SLOT("accept()"))

        button.setDefault(True)
        vbox.adjustSize()
        self._window.adjustSize()
示例#9
0
    def __init__(self, parent=None):

        self._window = qt.QDialog(None)
        self._window.setIcon(getPixmap("smart"))
        self._window.setCaption(_("Priorities"))
        #self._window.setModal(True)

        self._window.setMinimumSize(600, 400)

        layout = qt.QVBoxLayout(self._window)
        layout.setResizeMode(qt.QLayout.FreeResize)

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

        layout.addWidget(vbox)

        self._treeview = qt.QListView(vbox)
        self._treeview.setAllColumnsShowFocus(True)
        self._treeview.show()

        qt.QObject.connect(self._treeview, qt.SIGNAL("itemRenamed(QListViewItem *, int, const QString &)"), self.itemRenamed)
        qt.QObject.connect(self._treeview, qt.SIGNAL("selectionChanged()"), self.selectionChanged)

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

        bbox = qt.QHBox(vbox)
        bbox.setSpacing(10)
        bbox.layout().addStretch(1)
        bbox.show()

        button = qt.QPushButton(_("New"), bbox)
        button.setEnabled(True)
        button.setIconSet(qt.QIconSet(getPixmap("crystal-add")))
        button.show()
        qt.QObject.connect(button, qt.SIGNAL("clicked()"), self.newPriority)
        self._newpriority = button

        button = qt.QPushButton(_("Delete"), bbox)
        button.setEnabled(False)
        button.setIconSet(qt.QIconSet(getPixmap("crystal-delete")))
        button.show()
        qt.QObject.connect(button, qt.SIGNAL("clicked()"), self.delPriority)
        self._delpriority = button

        button = qt.QPushButton(_("Close"), bbox)
        qt.QObject.connect(button, qt.SIGNAL("clicked()"), self._window, qt.SLOT("accept()"))
        
        button.setDefault(True)
        vbox.adjustSize()
示例#10
0
    def __init__(self, parent=None):

        self._window = qt.QDialog(parent)
        self._window.setIcon(getPixmap("smart"))
        self._window.setCaption(_("New Target"))
        self._window.setModal(True)

        #self._window.setMinimumSize(600, 400)

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

        table = qt.QGrid(2, vbox)
        table.setSpacing(10)
        table.show()

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

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

        blank = qt.QWidget(table)

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

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

        bbox = qt.QHBox(vbox)
        bbox.setSpacing(10)
        bbox.layout().addStretch(1)
        bbox.show()

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

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

        vbox.adjustSize()
        self._window.adjustSize()
示例#11
0
文件: legend.py 项目: pombreda/smart
    def __init__(self, parent=None):
        qt.QDialog.__init__(self, parent)

        self.setIcon(getPixmap("smart"))
        self.setCaption(_("Icon Legend"))

        layout = qt.QVBoxLayout(self)

        self._vbox = qt.QVBox(self)
        self._vbox.setMargin(10)
        self._vbox.setSpacing(10)

        layout.add(self._vbox)

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

        grid = qt.QGrid(2, self._vbox)
        grid.setSpacing(5)
        grid.setMargin(5)
        grid.show()
  
        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 = qt.QLabel("", grid)
            image.setPixmap(icon)
            image.show()
            label = qt.QLabel(legend, grid)
            label.show()
        
        self._buttonbox = qt.QHBox(self._vbox)
        self._buttonbox.setSpacing(10)
        self._buttonbox.layout().addStretch(1)
        self._buttonbox.show()

        self._closebutton = qt.QPushButton(_("Close"), self._buttonbox)
        self._closebutton.show()
        qt.QObject.connect(self._closebutton, qt.SIGNAL("clicked()"), self, qt.SLOT("hide()"))
示例#12
0
    def __init__(self, parent, name, *args, **kwargs):
        qt.QToolBar.__init__(self, parent, name)
        self.setName(name)
        hb = qt.QHBox(self)
        self._lstr = qt.QLabel("Filter: ", hb, "Filter label")

        self._lcombo = CustomQCombobox(True, hb, 'Filter ComboBox',
                                       parent.setFilter)
        self._values = [""]
        self._lcombo.insertStrList(self._values)
        self._lcombo.setFixedSize(300, 25)
        self._lbutton = qt.QPushButton("Set", hb, "Filter Toggle Button")
        self._lbutton.setFixedSize(50, 25)
        self.connect(self._lbutton, qt.SIGNAL('clicked()'), parent.setFilter)
示例#13
0
    def __init__(self, parent=None, name="scan_plot_widget"):
        qt.QWidget.__init__(self, parent, name)

        self.xdata = []
        self.ylabel = ""

        self.isRealTimePlot = None
        self.isConnected = None
        self.isScanning = None

        self.lblTitle = qt.QLabel(self)
        self.graphPanel = qt.QFrame(self)
        buttonBox = qt.QHBox(self)
        self.lblPosition = qt.QLabel(buttonBox)
        self.graph = QtBlissGraph(self.graphPanel)

        qt.QObject.connect(
            self.graph, qt.PYSIGNAL("QtBlissGraphSignal"), self.handleBlissGraphSignal
        )
        qt.QObject.disconnect(
            self.graph,
            qt.SIGNAL("plotMousePressed(const QMouseEvent&)"),
            self.graph.onMousePressed,
        )
        qt.QObject.disconnect(
            self.graph,
            qt.SIGNAL("plotMouseReleased(const QMouseEvent&)"),
            self.graph.onMouseReleased,
        )

        self.graph.canvas().setMouseTracking(True)
        self.graph.enableLegend(False)
        self.graph.enableZoom(False)
        # self.graph.setAutoLegend(False)
        self.lblPosition.setAlignment(qt.Qt.AlignRight)
        self.lblTitle.setAlignment(qt.Qt.AlignHCenter)
        self.lblTitle.setSizePolicy(qt.QSizePolicy.Expanding, qt.QSizePolicy.Fixed)
        self.lblPosition.setSizePolicy(qt.QSizePolicy.Expanding, qt.QSizePolicy.Fixed)
        buttonBox.setSizePolicy(qt.QSizePolicy.Expanding, qt.QSizePolicy.Fixed)

        qt.QVBoxLayout(self.graphPanel)
        self.graphPanel.layout().addWidget(self.graph)

        qt.QVBoxLayout(self)
        self.layout().addWidget(self.lblTitle)
        self.layout().addWidget(buttonBox)
        self.layout().addWidget(self.graphPanel)
        self.setPaletteBackgroundColor(qt.Qt.white)
示例#14
0
    def __init__(self, parent=None):
        qt.QDialog.__init__(self, parent)

        self.setIcon(getPixmap("smart"))
        self.setCaption(_("Log"))
        self.setMinimumSize(400, 300)
        #self.setModal(True)

        layout = qt.QVBoxLayout(self)
        layout.setResizeMode(qt.QLayout.FreeResize)

        self._vbox = qt.QVBox(self)
        self._vbox.setMargin(10)
        self._vbox.setSpacing(10)
        self._vbox.show()

        layout.add(self._vbox)

        self._scrollview = BackgroundScrollView(self._vbox)
        self._scrollview.setVScrollBarMode(qt.QScrollView.AlwaysOn)
        self._scrollview.setFrameStyle(qt.QFrame.StyledPanel | qt.QFrame.Sunken)
        self._scrollview.show()

        self._textview = qt.QLabel(self._scrollview.viewport())
        self._textview.setAlignment(qt.Qt.AlignTop)
        self._textview.setTextFormat(qt.Qt.LogText)
        self._textview.show()
        self._textview.adjustSize()
        
        self._textview.setEraseColor(self._scrollview.eraseColor())

        self._buttonbox = qt.QHBox(self._vbox)
        self._buttonbox.setSpacing(10)
        self._buttonbox.layout().addStretch(1)
        self._buttonbox.show()

        self._clearbutton = qt.QPushButton(_("Clear"), self._buttonbox)
        self._clearbutton.show()
        qt.QObject.connect(self._clearbutton, qt.SIGNAL("clicked()"), self.clearText)

        self._closebutton = qt.QPushButton(_("Close"), self._buttonbox)
        self._closebutton.show()
        qt.QObject.connect(self._closebutton, qt.SIGNAL("clicked()"), self, qt.SLOT("hide()"))

        self._closebutton.setDefault(True)
示例#15
0
    def __init__(self, parent=None):

        self._fields = {}
        self._fieldn = 0

        self._window = qt.QDialog(parent)
        self._window.setIcon(getPixmap("smart"))
        self._window.setCaption(_("Edit Channel"))
        self._window.setModal(True)

        layout = qt.QVBoxLayout(self._window)
        layout.setResizeMode(qt.QLayout.FreeResize)

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

        layout.addWidget(vbox)
        self._vbox = vbox

        self._table = qt.QGrid(2, vbox)
        self._table.setSpacing(10)
        self._table.show()

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

        bbox = qt.QHBox(vbox)
        bbox.setSpacing(10)
        bbox.layout().addStretch(1)
        bbox.show()

        button = qt.QPushButton(_("Cancel"), bbox)
        qt.QObject.connect(button, qt.SIGNAL("clicked()"), self._window,
                           qt.SLOT("reject()"))

        button = qt.QPushButton(_("OK"), bbox)
        qt.QObject.connect(button, qt.SIGNAL("clicked()"), self._window,
                           qt.SLOT("accept()"))

        button.setDefault(True)
示例#16
0
    def __init__(self, parent=None):

        self._window = qt.QDialog(parent)
        self._window.setIcon(getPixmap("smart"))
        self._window.setCaption(_("Select Channels"))
        self._window.setModal(True)

        self._window.setMinimumSize(600, 400)

        layout = qt.QVBoxLayout(self._window)
        layout.setResizeMode(qt.QLayout.FreeResize)

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

        layout.addWidget(vbox)

        self._treeview = qt.QListView(vbox)
        self._treeview.setSizePolicy(qt.QSizePolicy.Expanding,
                                     qt.QSizePolicy.Expanding)
        self._treeview.setAllColumnsShowFocus(True)
        self._treeview.show()

        self._treeview.addColumn("")
        self._treeview.addColumn(_("Alias"))
        self._treeview.addColumn(_("Type"))
        self._treeview.addColumn(_("Name"))

        bbox = qt.QHBox(vbox)
        bbox.setSpacing(10)
        bbox.layout().addStretch(1)
        bbox.show()

        button = qt.QPushButton(_("Cancel"), bbox)
        qt.QObject.connect(button, qt.SIGNAL("clicked()"), self._window,
                           qt.SLOT("reject()"))

        button = qt.QPushButton(_("OK"), bbox)
        qt.QObject.connect(button, qt.SIGNAL("clicked()"), self._window,
                           qt.SLOT("accept()"))

        button.setDefault(True)
示例#17
0
    def __init__(self, parent=None):

        self._window = qt.QDialog(parent)
        self._window.setIcon(getPixmap("smart"))
        self._window.setCaption(_("New Channel"))
        self._window.setModal(True)

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

        table = qt.QGrid(2, vbox)
        table.setSpacing(10)
        table.show()
        self._table = table

        label = qt.QLabel(_("Type:"), table)

        self._typevbox = qt.QVButtonGroup(table)
        self._typevbox.setFrameStyle(qt.QFrame.NoFrame)
        self._typevbox.show()

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

        bbox = qt.QHBox(vbox)
        bbox.setSpacing(10)
        bbox.layout().addStretch(1)
        bbox.show()

        button = qt.QPushButton(_("Cancel"), bbox)
        qt.QObject.connect(button, qt.SIGNAL("clicked()"), self._window,
                           qt.SLOT("reject()"))

        button = qt.QPushButton(_("OK"), bbox)
        qt.QObject.connect(button, qt.SIGNAL("clicked()"), self._window,
                           qt.SLOT("accept()"))

        self._ok = button
        self._ok.setEnabled(False)
示例#18
0
    def __init__(self, *args, **kwargs):
        qt.QWidget.__init__(self, *args)

        self.setCaption("Hardware Repository browser")
        
        tb = qt.QHBox(self)
        self.cmdRefresh = qt.QToolButton(tb)
        self.cmdRefresh.setIconSet(qt.QIconSet(Icons.load("reload")))
        qt.QToolTip.add(self.cmdRefresh, "refresh HWR objects tree")
        self.cmdClose = qt.QToolButton(tb)
        self.cmdClose.setIconSet(qt.QIconSet(Icons.load("button_cancel")))
        qt.QToolTip.add(self.cmdClose, "close HWR browser")
        HorizontalSpacer(tb)
        tb.setSizePolicy(qt.QSizePolicy.Expanding, qt.QSizePolicy.Fixed)

        qt.QObject.connect(self.cmdRefresh, qt.SIGNAL("clicked()"), self.refresh)
        qt.QObject.connect(self.cmdClose, qt.SIGNAL("clicked()"), self.close)

        qt.QVBoxLayout(self)
        self.layout().addWidget(tb)
        self.add_hwr_browser()
示例#19
0
    def __init__(self, parent=None):

        self._changed = False

        self._window = qt.QDialog(None)
        self._window.setIcon(getPixmap("smart"))
        self._window.setCaption(_("Channels"))
        self._window.setModal(True)

        self._window.setMinimumSize(600, 400)

        layout = qt.QVBoxLayout(self._window)
        layout.setResizeMode(qt.QLayout.FreeResize)

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

        layout.addWidget(vbox)

        self._treeview = qt.QListView(vbox)
        self._treeview.setSizePolicy(qt.QSizePolicy.Expanding,
                                     qt.QSizePolicy.Expanding)
        self._treeview.setAllColumnsShowFocus(True)
        self._treeview.setSelectionMode(qt.QListView.Single)
        self._treeview.show()

        qt.QObject.connect(self._treeview, qt.SIGNAL("selectionChanged()"),
                           self.selectionChanged)
        qt.QObject.connect(
            self._treeview,
            qt.SIGNAL("doubleClicked(QListViewItem *, const QPoint &, int)"),
            self.doubleClicked)

        self._treeview.addColumn("")
        self._treeview.addColumn(_("Pri"))
        self._treeview.addColumn(_("Alias"))
        self._treeview.addColumn(_("Type"))
        self._treeview.addColumn(_("Name"))

        bbox = qt.QHBox(vbox)
        bbox.setSpacing(10)
        bbox.layout().addStretch(1)
        bbox.show()

        button = qt.QPushButton(_("New"), bbox)
        button.setIconSet(qt.QIconSet(getPixmap("crystal-add")))
        button.show()
        qt.QObject.connect(button, qt.SIGNAL("clicked()"), self.newChannel)
        self._newchannel = button

        button = qt.QPushButton(_("Delete"), bbox)
        button.setEnabled(False)
        button.setIconSet(qt.QIconSet(getPixmap("crystal-delete")))
        button.show()
        qt.QObject.connect(button, qt.SIGNAL("clicked()"), self.delChannel)
        self._delchannel = button

        button = qt.QPushButton(_("Edit"), bbox)
        button.setEnabled(False)
        button.setIconSet(qt.QIconSet(getPixmap("crystal-edit")))
        button.show()
        qt.QObject.connect(button, qt.SIGNAL("clicked()"), self.editChannel)
        self._editchannel = button

        button = qt.QPushButton(_("Close"), bbox)
        qt.QObject.connect(button, qt.SIGNAL("clicked()"), self._window,
                           qt.SLOT("accept()"))

        button.setDefault(True)
        vbox.adjustSize()
示例#20
0
    def __init__(self, parent=None):

        self._window = qt.QDialog(parent)
        self._window.setIcon(getPixmap("smart"))
        self._window.setCaption(_("New Channel"))
        self._window.setModal(True)

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

        table = qt.QGrid(1, vbox)
        table.setSpacing(10)
        table.show()

        label = qt.QLabel(_("Method:"), table)

        methodvbox = qt.QVButtonGroup(table)
        methodvbox.show()

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

        bbox = qt.QHBox(vbox)
        bbox.setSpacing(10)
        bbox.layout().addStretch(1)
        bbox.show()

        button = qt.QPushButton(_("Cancel"), bbox)
        qt.QObject.connect(button, qt.SIGNAL("clicked()"), self._window,
                           qt.SLOT("reject()"))

        button = qt.QPushButton(_("OK"), bbox)
        qt.QObject.connect(button, qt.SIGNAL("clicked()"), self._window,
                           qt.SLOT("accept()"))

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

        self._method = None
        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 = qt.QRadioButton(descr, methodvbox, method)
            qt.QObject.connect(radio, qt.SIGNAL("clicked()"), self.ok)
            act = RadioAction(radio, method, descr)
            act.connect(self, "_method", method)
            radio.show()

        methodvbox.adjustSize()
        vbox.adjustSize()
        self._window.adjustSize()
示例#21
0
    def __init__(self, hassub, parent=None):
        Progress.__init__(self)
        qt.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.setIcon(getPixmap("smart"))
        self.setCaption(_("Operation Progress"))

        vbox = qt.QVBoxLayout(self, 10, 10)
        vbox.setResizeMode(qt.QLayout.FreeResize)
        vbox.setMargin(10)
        vbox.setSpacing(10)

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

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

        if hassub:
            self._listview = qt.QListView(self)
            self._listview.setSorting(-1, False)
            self._listview.setSelectionMode(qt.QListView.NoSelection)
            self._listview.show()
            vbox.addWidget(self._listview)

            column = self._listview.addColumn(_("Progress"))
            self._listview.setColumnWidthMode(column, qt.QListView.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, qt.QListView.Manual)
            self._listview.setColumnWidth(column, 165)
            self._desccolumn = column

            self._subiters = {}
            self._subindex = 0

            self._bbox = qt.QHBox(self)
            self._bbox.setSpacing(10)
            self._bbox.layout().addStretch(1)
            vbox.addWidget(self._bbox)

            button = qt.QPushButton(_("Cancel"), self._bbox)
            button.show()
            qt.QObject.connect(button, qt.SIGNAL("clicked()"), self._cancel)
示例#22
0
    def show(self, pkg):

        priority = sysconf.get(("package-priorities", pkg.name), {})
        
        table = self._table
        #table.foreach(table.remove)

        label = qt.QLabel(_("Package:"), table)
        label.show()

        label = qt.QLabel("<b>%s</b>" % pkg.name, table)
        label.show()

        class AliasCheckBox(qt.QCheckBox):
        
            def __init__(self, name, parent):
                qt.QSpinBox.__init__(self, name, parent)

            def connect(self, signal, slot, spin, alias):
                qt.QObject.connect(self, qt.SIGNAL(signal), slot)
                self._spin = spin
                self._alias = alias
            
            def toggled(self, check):
                spin = self._spin
                alias = self._alias
                if check:
                    priority[alias] = int(spin.value())
                    spin.setEnabled(True)
                else:
                    if alias in priority:
                        del priority[alias]
                    spin.setEnabled(False)

        class AliasSpinBox(qt.QSpinBox):
        
            def __init__(self, parent):
                qt.QSpinBox.__init__(self, parent)
            
            def connect(self, signal, slot, alias):
                qt.QObject.connect(self, qt.SIGNAL(signal), slot)
                self._alias = alias
            
            def value_changed(self, value):
                alias = spin._alias
                priority[alias] = value

        label = qt.QLabel(_("Default priority:"), table)
        label.show()

        hbox = qt.QHBox(table)
        hbox.setSpacing(10)
        hbox.show()

        radio = qt.QRadioButton(_("Channel default"), hbox)
        radio.setChecked(None not in priority)
        radio.show()
        
        radio = qt.QRadioButton(_("Set to"), hbox)
        radio.setChecked(None in priority)
        radio.show()
        spin = qt.QSpinBox(hbox)
        spin.setSteps(1, 10)
        spin.setRange(-100000,+100000)
        spin.setValue(priority.get(None, 0))
        spin.show()

        label = qt.QLabel(_("Channel priority:"), table)
        label.show()

        chantable = qt.QGrid(2, table)
        chantable.setSpacing(10)
        chantable.show()

        pos = 0
        channels = sysconf.get("channels")
        for alias in channels:
            channel = channels[alias]
            if not getChannelInfo(channel.get("type")).kind == "package":
                continue
            name = channel.get("name")
            if not name:
                name = alias
            check = AliasCheckBox(name, chantable)
            check.setChecked(alias in priority)
            check.show()
            spin = AliasSpinBox(chantable)
            if alias not in priority:
                spin.setEnabled(False)
            spin.setSteps(1, 10)
            spin.setRange(-100000,+100000)
            spin.setValue(priority.get(alias, 0))
            spin.connect("valueChanged(int)", spin.value_changed, alias)
            check.connect("toggled(bool)", check.toggled, spin, alias)
            spin.show()
            pos += 1
        
        table.adjustSize()
        self._vbox.adjustSize()
        self._window.adjustSize()
        
        self._window.show()
        self._window.raiseW()
        self._window.setActiveWindow()
        self._window.exec_loop()
        self._window.hide()

        if not priority:
            sysconf.remove(("package-priorities", pkg.name))
        else:
            sysconf.set(("package-priorities", pkg.name), priority)
示例#23
0
    def __init__(self, parent, model_controller, caption):
        qt.QVBox.__init__(self, parent)

        self._model_controller = model_controller

        self.modelUpdateTimer = qt.QTimer(self)
       
        self.__pendingModelObjectRedraws = []

        self.reindex_flag_lock = Lock()
        self.reindex_flag = False

        self.connect( self.modelUpdateTimer, qt.SIGNAL("timeout()"), self._modelObjectViewUpdater)
                                        
        self.modelUpdateTimer.start( 1000  , False)
                                                                                 

        self.setName(caption) if caption else self.setName("")

        self.setFrameStyle(qt.QFrame.Panel | qt.QFrame.Plain)
        self.setLineWidth(0)

        self._host_items = {}

                                                                                                   
        self._category_items = {}

                                                                                                
                                                                        
        self._category_tree = {}

        self.contextpopups = {}
        self._setupContextPopups()

        self.contextdispatchers = {}

                       
        self._filter = ""
        self.ix = None

        self._setupContextDispatchers()

        split = qt.QSplitter(self)
        split.setOrientation(qt.QSplitter.Vertical)

        lv = self.listview = ModelObjectListView(split)
                                     
                                       
                                         
        lv.setRootIsDecorated(True)

                                               
        self.connect( lv, qt.SIGNAL("selectionChanged()"), self._itemSelected )
        self.connect( lv, qt.SIGNAL("rightButtonPressed(QListViewItem *,const QPoint&,int)"), self._showContextMenu )
                                                        
        lv.addColumn("Hosts")
        lv.setColumnWidthMode(0,qt.QListView.Maximum)
                                                                                    

                         
        lv.setTreeStepSize(20)

                                                                           
                                                                                                  
                                                                
                                                             
        self.rootitem = None

                                            
               

                                                                           
        self.details_table = EditionTable(split)
        hbox = qt.QHBox(self)
        self.object_label = qt.QLabel("", hbox)
        self.object_label.setMinimumSize(qt.QSize(50, 25))
        self.save_button = SaveButton(hbox, self._item_save)
        self._save_callback = None

        self.prefchilds = []
示例#24
0
    def __init__(self, parent=None):

        self._window = qt.QDialog(None)
        self._window.setIcon(getPixmap("smart"))
        self._window.setCaption(_("Flags"))
        self._window.setModal(True)

        self._window.setMinimumSize(600, 400)

        layout = qt.QVBoxLayout(self._window)
        layout.setResizeMode(qt.QLayout.FreeResize)

        topvbox = qt.QVBox(self._window)
        topvbox.setMargin(10)
        topvbox.setSpacing(10)
        topvbox.show()

        layout.addWidget(topvbox)

        tophbox = qt.QHBox(topvbox)
        tophbox.setSpacing(20)
        tophbox.show()

        # Left side
        vbox = qt.QVGroupBox(tophbox)
        vbox.setInsideSpacing(10)
        vbox.show()

        self._flagsview = qt.QListView(vbox)
        self._flagsview.show()

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

        self._flagsview.addColumn(_("Flags"))

        bbox = qt.QHBox(vbox)
        bbox.setMargin(5)
        bbox.setSpacing(10)
        bbox.show()

        button = qt.QPushButton(_("New"), bbox)
        button.setEnabled(True)
        button.setIconSet(qt.QIconSet(getPixmap("crystal-add")))
        button.show()
        qt.QObject.connect(button, qt.SIGNAL("clicked()"), self.newFlag)
        self._newflag = button

        button = qt.QPushButton(_("Delete"), bbox)
        button.setEnabled(False)
        button.setIconSet(qt.QIconSet(getPixmap("crystal-delete")))
        button.show()
        qt.QObject.connect(button, qt.SIGNAL("clicked()"), self.delFlag)
        self._delflag = button

        # Right side
        vbox = qt.QVGroupBox(tophbox)
        vbox.setInsideSpacing(10)
        vbox.show()

        self._targetsview = qt.QListView(vbox)
        self._targetsview.show()

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

        self._targetsview.addColumn(_("Targets"))

        bbox = qt.QHBox(vbox)
        bbox.setMargin(5)
        bbox.setSpacing(10)
        bbox.show()

        button = qt.QPushButton(_("New"), bbox)
        button.setEnabled(False)
        button.setIconSet(qt.QIconSet(getPixmap("crystal-add")))
        button.show()
        qt.QObject.connect(button, qt.SIGNAL("clicked()"), self.newTarget)
        self._newtarget = button

        button = qt.QPushButton(_("Delete"), bbox)
        button.setEnabled(False)
        button.setIconSet(qt.QIconSet(getPixmap("crystal-delete")))
        button.show()
        qt.QObject.connect(button, qt.SIGNAL("clicked()"), self.delTarget)
        self._deltarget = button

        # Bottom
        sep = qt.QFrame(topvbox)
        sep.setFrameShape(qt.QFrame.HLine)
        sep.setFrameShadow(qt.QFrame.Sunken)
        sep.show()

        bbox = qt.QHBox(topvbox)
        bbox.setSpacing(10)
        bbox.layout().addStretch(1)
        bbox.show()

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

        button.setDefault(True)
示例#25
0
    def __init__(self, *args):
        BlissWidget.__init__(self, *args)

        self.diffractometer_hwobj = None

        self.addProperty("mnemonic", "string", "")
        self.addProperty("label", "string", "")
        self.addProperty("showLabel", "boolean", True)
        self.addProperty("showBox", "boolean", True)
        self.addProperty("showStop", "boolean", True)
        self.addProperty("showPosition", "boolean", True)
        self.addProperty("icons", "string", "")

        self.container_hbox = qt.QHGroupBox(self)
        self.container_hbox.setSizePolicy(qt.QSizePolicy.Minimum, qt.QSizePolicy.Fixed)

        self.label_hbox = qt.QHBox(self.container_hbox)
        self.motor_hbox = qt.QHBox(self.container_hbox)

        self.label = qt.QLabel(self.label_hbox)

        self.kappa_value_edit = qt.QLineEdit(self.motor_hbox)
        self.kappa_value_edit.setFixedSize(qt.QSize(55, 25))
        self.kappa_value_edit.setValidator(qt.QDoubleValidator(0, 180, 2, self))
        self.kappa_value_edit.setPaletteBackgroundColor(widget_colors.LIGHT_GREEN)
        self.kappa_value_edit.setAlignment(qt.QWidget.AlignRight)
        self.phi_value_edit = qt.QLineEdit(self.motor_hbox)
        self.phi_value_edit.setFixedSize(qt.QSize(55, 25))
        self.phi_value_edit.setValidator(qt.QDoubleValidator(0, 180, 2, self))
        self.phi_value_edit.setPaletteBackgroundColor(widget_colors.LIGHT_GREEN)
        self.phi_value_edit.setAlignment(qt.QWidget.AlignRight)

        self.move_motors_button = qt.QPushButton("Apply", self.motor_hbox)
        self.stop_motors_button = qt.QPushButton(self.motor_hbox)
        self.stop_motors_button.setPixmap(Icons.load("stop_small"))
        self.stop_motors_button.setEnabled(False)

        self.connect(
            self.kappa_value_edit,
            qt.SIGNAL("textChanged(const QString &)"),
            self.kappa_edit_input_changed,
        )
        self.connect(
            self.phi_value_edit,
            qt.SIGNAL("textChanged(const QString &)"),
            self.phi_edit_input_changed,
        )
        self.connect(
            self.move_motors_button,
            qt.SIGNAL("clicked()"),
            self.move_motors_button_clicked,
        )
        self.connect(
            self.stop_motors_button,
            qt.SIGNAL("clicked()"),
            self.stop_motors_button_clicked,
        )

        self.stop_motors_button.setSizePolicy(
            qt.QSizePolicy.Fixed, qt.QSizePolicy.Minimum
        )
        self.setSizePolicy(qt.QSizePolicy.Minimum, qt.QSizePolicy.Fixed)
        qt.QVBoxLayout(self)
        self.layout().addWidget(self.container_hbox)