コード例 #1
0
ファイル: MainWindow.py プロジェクト: Mvedrines/Pythagora
 def toggleHideRestore(self):
     '''Show or hide the window based on some parameters. We can detect
     when we are obscured and come to the top. In other cases we hide if
     mapped and show if not.
     '''
     if KDE:
         if KWindowSystem.activeWindow() == self.winId() and self.isVisible():
             self.hide()
         else:
             self.show()
             KWindowSystem.forceActiveWindow(self.winId())
     else:
         if self.isVisible():
             self.hide()
         else: self.show()
コード例 #2
0
 def toggleHideRestore(self):
     '''Show or hide the window based on some parameters. We can detect
     when we are obscured and come to the top. In other cases we hide if
     mapped and show if not.
     '''
     if KDE:
         if KWindowSystem.activeWindow() == self.winId() and self.isVisible(
         ):
             self.hide()
         else:
             self.show()
             KWindowSystem.forceActiveWindow(self.winId())
     else:
         if self.isVisible():
             self.hide()
         else:
             self.show()
コード例 #3
0
ファイル: main.py プロジェクト: spamalot/kdei3status
    def init(self):
        # Fill space if in a horizontal panel.
        self.setSizePolicy(QSizePolicy(QSizePolicy.Expanding,
                                        QSizePolicy.Preferred))

        layout = QGraphicsLinearLayout(Qt.Horizontal, self.applet)
        layout.setContentsMargins(0, 0, 0, 0)
        self.applet.setLayout(layout)

        self.icon = Plasma.IconWidget(self.applet)
        self.label = Plasma.Label(self.applet)
        # TODO: Improve handling of very long window titles.
        self.label.setWordWrap(False)

        layout.addItem(self.icon)
        layout.addItem(self.label)
        layout.setStretchFactor(self.label, 1)

        # Reasonable default size -- can be resized later by user.
        self.resize(500, 30)

        self.refreshTimer = QTimer()
        self.refreshTimer.setInterval(I3STATUS_REFRESH_INTERVAL)
        self.refreshTimer.timeout.connect(self.reloadI3statusText)
        self.statusIterator = execute(["i3status"])
        self.refreshTimer.start()

        self.windowChangeTimer = QTimer()
        self.windowChangeTimer.setSingleShot(True)
        self.windowChangeTimer.setInterval(TITLE_DISPLAY_TIMEOUT)
        self.windowChangeTimer.timeout.connect(self.hideTitleText)

        KWindowSystem.self().windowRemoved.connect(self.windowRemoved)
        KWindowSystem.self().windowChanged.connect(self.windowChanged)
        KWindowSystem.self().activeWindowChanged.connect(
            self.activeWindowChanged)
コード例 #4
0
  def __init__(self, datadir=None, options=None, parent=None, file=None, attachWinID=None):
    """ Provide a KDE based graphical user interface to configure
        the used software repositories, corresponding authentication keys
        and update automation """
    SoftwareProperties.__init__(self, options=options, datadir=datadir)

    self.options = options
    self.datadir = datadir

    global kapp
    kapp = KApplication()

    self.userinterface = SoftwarePropertiesKDEUI(datadir)
    self.userinterface.setWindowIcon(KIcon("applications-other"))
    self.userinterface.button_auth_restore.setIcon(KIcon("edit-undo"))
    self.userinterface.button_add_auth.setIcon(KIcon("list-add"))
    self.userinterface.button_auth_remove.setIcon(KIcon("list-remove"))
    self.userinterface.button_remove.setIcon(KIcon("list-remove"))
    self.userinterface.button_edit.setIcon(KIcon("document-edit"))
    self.userinterface.button_add.setIcon(KIcon("list-add"))
    self.userinterface.button_add_cdrom.setIcon(KIcon("media-optical"))
    translate_widget(self.userinterface)
    self.userinterface.show()
    if attachWinID is not None:
        KWindowSystem.setMainWindow(self.userinterface, int(attachWinID))

    # rejected() signal from Close button
    kapp.connect(self.userinterface.buttonBox, SIGNAL("rejected()"), self.on_close_button)

    self.userinterface.buttonBox.button(QDialogButtonBox.Reset).setEnabled(False)

    # Put some life into the user interface:
    self.init_server_chooser()
    self.init_popcon()
    self.init_auto_update()
    self.init_release_upgrades()
    self.show_auto_update_level()
    # Setup the key list
    self.init_keys()
    self.show_keys()
    # Setup the ISV sources list
    self.init_isv_sources()
    self.show_isv_sources()
    self.show_cdrom_sources()

    kapp.connect(self.userinterface.checkbutton_source_code, SIGNAL("clicked()"), self.on_checkbutton_source_code_toggled)
    kapp.connect(self.userinterface.button_auth_restore, SIGNAL("clicked()"), self.on_restore_clicked)
    kapp.connect(self.userinterface.button_add_auth, SIGNAL("clicked()"), self.add_key_clicked)
    kapp.connect(self.userinterface.button_auth_remove, SIGNAL("clicked()"), self.remove_key_clicked)
    kapp.connect(self.userinterface.checkbutton_popcon, SIGNAL("toggled(bool)"), self.on_checkbutton_popcon_toggled)
    kapp.connect(self.userinterface.checkbutton_auto_update, SIGNAL("toggled(bool)"), self.on_auto_update_toggled)
    kapp.connect(self.userinterface.combobox_update_interval, SIGNAL("currentIndexChanged(int)"), self.on_combobox_update_interval_changed)
    kapp.connect(self.userinterface.button_remove, SIGNAL("clicked()"), self.on_remove_clicked)
    kapp.connect(self.userinterface.button_edit, SIGNAL("clicked()"), self.on_edit_clicked)
    kapp.connect(self.userinterface.button_add_cdrom, SIGNAL("clicked()"), self.on_button_add_cdrom_clicked)
    kapp.connect(self.userinterface.button_add, SIGNAL("clicked()"), self.on_add_clicked)
    kapp.connect(self.userinterface.treeview_sources, SIGNAL("itemChanged(QTreeWidgetItem*, int)"), self.on_isv_source_toggled)
    kapp.connect(self.userinterface.treeview_sources, SIGNAL("itemClicked(QTreeWidgetItem*, int)"), self.on_treeview_sources_cursor_changed)
    kapp.connect(self.userinterface.treeview_cdroms, SIGNAL("itemChanged(QTreeWidgetItem*, int)"), self.on_cdrom_source_toggled)
    kapp.connect(self.userinterface.treeview2, SIGNAL("itemClicked(QTreeWidgetItem*, int)"), self.on_treeview_keys_cursor_changed)
    button_close = self.userinterface.buttonBox.button(QDialogButtonBox.Close)
    button_close.setIcon(KIcon("dialog-close"))
    button_revert = self.userinterface.buttonBox.button(QDialogButtonBox.Reset)
    button_revert.setIcon(KIcon("edit-undo"))
    kapp.connect(button_revert, SIGNAL("clicked()"), self.on_button_revert_clicked)

    self.init_distro()
    self.show_distro()
コード例 #5
0
ファイル: main.py プロジェクト: spamalot/kdei3status
 def reloadTitleText(self):
     """Get the window title from the active window."""
     windowInfo = KWindowSystem.windowInfo(self.wid, NET.WMName)
     self.titleText = windowInfo.name()
コード例 #6
0
ファイル: main.py プロジェクト: spamalot/kdei3status
 def activeWindowChanged(self, wid):
     self.wid = wid
     self.reloadTitleText()
     self.showTitleText()
     self.windowChangeTimer.start()
     self.icon.setIcon(QIcon(KWindowSystem.icon(wid)))