Esempio n. 1
0
def promptText(parent, message, title = None, text="", rx=None, help=None):
    """
    Prompts for a text. Returns None on cancel, otherwise the input string.
    rx = if given, regexp string that the input must validate against
    help = if given, the docbook id in the help menu handbook.
    """
    d = KDialog(parent)
    buttons = KDialog.Ok | KDialog.Cancel
    if help:
        buttons |= KDialog.Help
        d.setHelp(help)
    d.setButtons(KDialog.ButtonCode(buttons))
    if title:
        d.setCaption(title)
    v = KVBox()
    v.setSpacing(4)
    d.setMainWidget(v)
    QLabel(message, v)
    edit = KLineEdit(v)
    if rx:
        edit.setValidator(QRegExpValidator(QRegExp(rx), edit))
    edit.setText(text)
    d.show()
    edit.setFocus()
    if d.exec_():
        return edit.text()
Esempio n. 2
0
    def __init__(self, parent=None):
        KVBox.__init__(self, parent)
        self.help = QLabel(i18n(helpText), self)
        self.layout().setAlignment(self.help, Qt.AlignHCenter)
        self.setSpacing(10)

        hBox = KHBox(self)

        display = QTreeWidget(hBox)
        display.setSizePolicy(QSizePolicy.Expanding, QSizePolicy.Expanding)
        display.setHeaderLabels(["Volume", "File Path", "Accessible"])
        display.setColumnWidth(0, 200)
        display.setColumnWidth(1, 300)

        # retrieve a list of Solid.Device for this machine
        deviceList = Solid.Device.allDevices()

        # filter the list of all devices and display matching results
        # note that we never create a Solid.StorageAccess object, but
        # receive one from the 'asDeviceInterface' call
        for device in deviceList:
            if device.isDeviceInterface(Solid.DeviceInterface.StorageAccess):
                access = device.asDeviceInterface(
                    Solid.DeviceInterface.StorageAccess)
                QTreeWidgetItem(display, [
                    device.product(),
                    access.filePath(),
                    str(access.isAccessible())
                ])
Esempio n. 3
0
    def __init__(self, parent=None):
        KVBox.__init__(self, parent)
        self.help = QLabel(i18n(helpText), self)
        self.layout().setAlignment(self.help, Qt.AlignHCenter)
        self.setSpacing(10)

        audioDriverStr = {
                            Solid.AudioInterface.Alsa: "Alsa",\
                            Solid.AudioInterface.OpenSoundSystem: "Open Sound",\
                            Solid.AudioInterface.UnknownAudioDriver: "Unknown"
                         }


        audioInterfaceTypeStr = {
                                  Solid.AudioInterface.UnknownAudioInterfaceType: "Unknown",\
                                  Solid.AudioInterface.AudioControl: "Control",\
                                  Solid.AudioInterface.AudioInput: "In",\
                                  Solid.AudioInterface.AudioOutput: "Out"
                                }

        soundcardTypeStr = {
                             Solid.AudioInterface.InternalSoundcard: "Internal",\
                             Solid.AudioInterface.UsbSoundcard: "USB",\
                             Solid.AudioInterface.FirewireSoundcard: "Firewire",\
                             Solid.AudioInterface.Headset: "Headset",\
                             Solid.AudioInterface.Modem: "Modem"
                           }

        hBox = KHBox(self)

        display = QTreeWidget(hBox)
        display.setSizePolicy(QSizePolicy.Expanding, QSizePolicy.Expanding)
        display.setHeaderLabels(
            ["Item", "Name", "Driver", "I/F Type", "Sound Card Type"])
        display.setColumnWidth(0, 300)
        display.setColumnWidth(1, 300)
        display.setColumnWidth(3, 75)

        # retrieve a list of Solid.Device for this machine
        deviceList = Solid.Device.allDevices()

        # filter the list of all devices and display matching results
        # note that we never create a Solid.AudioInterface object, but
        # receive one from the 'asDeviceInterface' call
        for device in deviceList:
            if device.isDeviceInterface(Solid.DeviceInterface.AudioInterface):
                audio = device.asDeviceInterface(
                    Solid.DeviceInterface.AudioInterface)
                devtype = audio.deviceType()
                devstr = []
                for key in audioInterfaceTypeStr:
                    flag = key & devtype
                    if flag:
                        devstr.append(audioInterfaceTypeStr[key])

                QTreeWidgetItem(display, [
                    device.product(),
                    audio.name(), audioDriverStr[audio.driver()],
                    "/".join(devstr), soundcardTypeStr[audio.soundcardType()]
                ])
    def __init__(self, parent=None):
        KVBox.__init__(self, parent)
        self.help  = QLabel (i18n (helpText), self)
        self.layout ().setAlignment (self.help, Qt.AlignHCenter)
        self.setSpacing (10)

        hBox = KHBox (self)
                
        display = QTreeWidget (hBox)        
        display.setSizePolicy (QSizePolicy.Expanding, QSizePolicy.Expanding)
        display.setHeaderLabels (["Volume", "File Path", "Accessible"])
        display.setColumnWidth (0, 200)
        display.setColumnWidth (1, 300)   

        # retrieve a list of Solid.Device for this machine
        deviceList = Solid.Device.allDevices ()

        # filter the list of all devices and display matching results
        # note that we never create a Solid.StorageAccess object, but
        # receive one from the 'asDeviceInterface' call
        for device in deviceList:
            if device.isDeviceInterface (Solid.DeviceInterface.StorageAccess):
                access = device.asDeviceInterface (Solid.DeviceInterface.StorageAccess)
                QTreeWidgetItem (display, [device.product (),
                                           access.filePath (),
                                           str (access.isAccessible ())])
Esempio n. 5
0
 def __init__(self, mainwin, pdfs):
     KDialog.__init__(self, mainwin)
     self.mainwin = mainwin
     self.setAttribute(Qt.WA_DeleteOnClose)
     self.setButtons(KDialog.ButtonCode(
         KDialog.User1 | KDialog.Ok | KDialog.Cancel))
     self.setButtonGuiItem(KDialog.Ok, KStandardGuiItem.print_())
     self.setButtonIcon(KDialog.User1, KIcon("edit-select-all"))
     self.setButtonText(KDialog.User1, i18n("Select all"))
     self.setCaption(i18n("Print documents"))
     b = KVBox(self)
     b.setSpacing(4)
     QLabel(i18n("Please select the files you want to print:"), b)
     fileList = QListWidget(b)
     fileList.setIconSize(QSize(22, 22))
     fileList.setWhatsThis(i18n(
         "These are the PDF documents that are up-to-date (i.e. newer than "
         "the LilyPond source document). "
         "Check the documents you want to send to the printer."))
     
     for pdf in pdfs:
         i = QListWidgetItem(KIcon("application-pdf"), os.path.basename(pdf),
             fileList)
         i.setFlags(Qt.ItemIsEnabled | Qt.ItemIsSelectable |
             Qt.ItemIsUserCheckable)
         i.setCheckState(Qt.Unchecked)
     
     fileList.item(0).setCheckState(Qt.Checked)
     self.fileList = fileList
     self.setMainWidget(b)
     self.resize(350, 200)
     self.pdfs = pdfs
     self.user1Clicked.connect(self.selectAll)
Esempio n. 6
0
    def __init__(self, parent=None):
        KVBox.__init__(self, parent)
        self.help = QLabel(i18n(helpText), self)
        self.layout().setAlignment(self.help, Qt.AlignHCenter | Qt.AlignTop)
        self.setSpacing(40)

        hBox = KHBox(self)
        vBox1 = KVBox(hBox)
        vBox2 = KVBox(hBox)

        hBox.layout().setAlignment(vBox1, Qt.AlignHCenter)
        hBox.layout().setAlignment(vBox2, Qt.AlignHCenter)
        vBox1.setMargin(20)
        vBox2.setSpacing(20)

        self.datePickerLabel = QLabel("KDatePicker", vBox1)

        self.datePicker = KDatePicker(vBox2)
        self.datePicker.setFixedSize(400, 200)

        self.other = QLabel("KDateWidget", vBox1)
        vBox1.layout().setAlignment(self.other, Qt.AlignBottom)

        self.dateDisplay = KDateWidget(vBox2)

        self.connect(self.datePicker, SIGNAL("dateChanged(QDate)"), self.dateDisplay.setDate)
    def __init__(self, parent=None):
        KVBox.__init__(self, parent)
        self.help  = QLabel (i18n (helpText), self)
        self.layout ().setAlignment (self.help, Qt.AlignHCenter)
        self.setSpacing (10)

        audioDriverStr = {
                            Solid.AudioInterface.Alsa: "Alsa",\
                            Solid.AudioInterface.OpenSoundSystem: "Open Sound",\
                            Solid.AudioInterface.UnknownAudioDriver: "Unknown"
                         }


        audioInterfaceTypeStr = {
                                  Solid.AudioInterface.UnknownAudioInterfaceType: "Unknown",\
                                  Solid.AudioInterface.AudioControl: "Control",\
                                  Solid.AudioInterface.AudioInput: "In",\
                                  Solid.AudioInterface.AudioOutput: "Out"
                                }

        soundcardTypeStr = {
                             Solid.AudioInterface.InternalSoundcard: "Internal",\
                             Solid.AudioInterface.UsbSoundcard: "USB",\
                             Solid.AudioInterface.FirewireSoundcard: "Firewire",\
                             Solid.AudioInterface.Headset: "Headset",\
                             Solid.AudioInterface.Modem: "Modem"
                           }
        
        hBox = KHBox (self)
                
        display = QTreeWidget (hBox)
        display.setSizePolicy (QSizePolicy.Expanding, QSizePolicy.Expanding)
        display.setHeaderLabels (["Item", "Name", "Driver", "I/F Type", "Sound Card Type"])
        display.setColumnWidth (0, 300)
        display.setColumnWidth (1, 300)
        display.setColumnWidth (3, 75)

        # retrieve a list of Solid.Device for this machine
        deviceList = Solid.Device.allDevices ()

        
        # filter the list of all devices and display matching results
        # note that we never create a Solid.AudioInterface object, but
        # receive one from the 'asDeviceInterface' call
        for device in deviceList:
            if device.isDeviceInterface (Solid.DeviceInterface.AudioInterface):
                audio = device.asDeviceInterface (Solid.DeviceInterface.AudioInterface)
                devtype = audio.deviceType ()
                devstr  = []
                for key in audioInterfaceTypeStr:
                    flag = key & devtype
                    if flag:
                        devstr.append (audioInterfaceTypeStr [key])
                        
                QTreeWidgetItem (display, [device.product (),
                                           audio.name (),
                                           audioDriverStr [audio.driver ()],
                                           "/".join (devstr),
                                           soundcardTypeStr [audio.soundcardType ()]])
    def __init__(self, parent):
        KVBox.__init__(self, parent)
        self.help = QLabel(helpText, self)
        self.layout().setAlignment(self.help, Qt.AlignHCenter)

        hBox = KHBox(self)
        self.button = KPushButton(i18n("Show %s" % dialogName), hBox)
        self.button.setMaximumSize(250, 30)

        self.connect(self.button, SIGNAL("clicked()"), self.showDialog)
Esempio n. 9
0
    def __init__(self, parent=None):
        KVBox.__init__(self, parent)
        self.help = QLabel(i18n(helpText), self)
        self.layout().setAlignment(self.help, Qt.AlignHCenter)
        self.setSpacing(10)

        hBox = KHBox(self)

        display = QTreeWidget(hBox)
        display.setSizePolicy(QSizePolicy.Expanding, QSizePolicy.Expanding)
        display.setHeaderLabels(["Device", "Bus", "Type", "Hot Plug", "Removable"])
        display.setColumnWidth(0, 150)

        # convert enum values to strings for display
        bus2Str = {
            Solid.StorageDrive.Ide: "IDE",
            Solid.StorageDrive.Usb: "USB",
            Solid.StorageDrive.Ieee1394: "IEE1394",
            Solid.StorageDrive.Scsi: "SCSI",
            Solid.StorageDrive.Sata: "SATA",
            Solid.StorageDrive.Platform: "Platform",
        }

        driveType2Str = {
            Solid.StorageDrive.HardDisk: "Hard Disk",
            Solid.StorageDrive.CdromDrive: "CD ROM",
            Solid.StorageDrive.Floppy: "Floppy",
            Solid.StorageDrive.Tape: "Tape",
            Solid.StorageDrive.CompactFlash: "Compact Flash",
            Solid.StorageDrive.MemoryStick: "Memory Stick",
            Solid.StorageDrive.SmartMedia: "Smart Media",
            Solid.StorageDrive.SdMmc: "SD MMC",
            Solid.StorageDrive.Xd: "XD",
        }

        # retrieve a list of Solid.Device for this machine
        deviceList = Solid.Device.allDevices()

        # filter the list of all devices and display matching results
        # note that we never create a Solid.StorageDrive object, but
        # receive one from the call to 'asDeviceInterface'
        for device in deviceList:
            if device.isDeviceInterface(Solid.DeviceInterface.StorageDrive):
                drive = device.asDeviceInterface(Solid.DeviceInterface.StorageDrive)
                QTreeWidgetItem(
                    display,
                    [
                        device.product(),
                        bus2Str[drive.bus()],
                        driveType2Str[drive.driveType()],
                        str(drive.isHotpluggable()),
                        str(drive.isRemovable()),
                    ],
                )
Esempio n. 10
0
    def __init__(self, parent):
        KVBox.__init__(self, parent)
        self.help = QLabel(helpText, self)
        self.layout().setAlignment(self.help, Qt.AlignHCenter)

        hBox = KHBox(self)
        self.button = KPushButton(i18n("Show %s" % dialogName), hBox)
        self.button.setMaximumSize(250, 30)

        self.helpmenu = KHelpMenu(parent, "", False)
        self.button.clicked.connect(self.helpmenu.aboutKDE)
Esempio n. 11
0
    def __init__(self, parent=None):
        KVBox.__init__(self, parent)
        self.help = QLabel(helpText, self)
        self.layout().setAlignment(self.help, Qt.AlignHCenter)

        hBox1 = KHBox(self)
        hBox1.setSpacing(10)
        hBox1.setMargin(40)

        colorButtonLabel = QLabel("KColorButton", hBox1)
        colorButton = KColorButton(hBox1)

        colorCellsLabel = QLabel("KColorCells", hBox1)
        colorCells = KColorCells(hBox1, 1, 8)
        colorCells.setMaximumSize(160, 20)
        colorCells.setColor(0, Qt.black)
        colorCells.setColor(1, Qt.red)
        colorCells.setColor(2, Qt.yellow)
        colorCells.setColor(3, Qt.blue)
        colorCells.setColor(4, Qt.darkGreen)
        colorCells.setColor(5, Qt.magenta)
        colorCells.setColor(6, Qt.gray)
        colorCells.setColor(7, Qt.white)

        colorComboLabel = QLabel("KColorCombo", hBox1)
        colorCombo = KColorCombo(hBox1)

        colorList = [
            Qt.black, Qt.red, Qt.yellow, Qt.blue, Qt.darkGreen, Qt.magenta,
            Qt.gray, Qt.white
        ]
        colorCombo.setColors(colorList)
        colorCombo.setMaximumWidth(80)

        hBox2 = KHBox(self)
        hBox2.setSpacing(10)
        self.layout().setAlignment(hBox2, Qt.AlignHCenter | Qt.AlignTop)
        self.setStretchFactor(hBox2, 1)

        colorPatchLabel = QLabel("KColorPatch", hBox2)
        hBox2.layout().setAlignment(colorPatchLabel, Qt.AlignHCenter)
        self.colorPatch = KColorPatch(hBox2)
        self.colorPatch.setFixedSize(40, 40)
        hBox2.layout().setAlignment(self.colorPatch, Qt.AlignHCenter)

        self.colorPatch.setColor(Qt.red)
        self.colorPatch.show()

        self.connect(colorButton, SIGNAL("changed (const QColor&)"),
                     self.colorPatch.setColor)
        self.connect(colorCells, SIGNAL("colorSelected (int, const QColor&)"),
                     self.colorCellSelected)
        self.connect(colorCombo, SIGNAL("activated (const QColor&)"),
                     self.colorPatch.setColor)
Esempio n. 12
0
    def __init__(self, parent):
        KVBox.__init__(self, parent)
        self.help = QLabel(helpText, self)
        self.layout().setAlignment(self.help, Qt.AlignHCenter)

        hBox = KHBox(self)
        self.button = KPushButton(i18n("Show %s" % dialogName), hBox)
        self.button.setMaximumSize(250, 30)

        self.helpmenu = KHelpMenu(parent, "", False)
        self.button.clicked.connect(self.helpmenu.aboutKDE)
Esempio n. 13
0
    def __init__(self, parent):
        KVBox.__init__(self, parent)
        self.setSpacing (40)
        self.help = QLabel (i18n (helpText), self)
        self.layout ().setAlignment (self.help, Qt.AlignHCenter)

        self.button = KPushButton(i18n("Show %s" % dialogName), self)
        self.button.setFixedSize (200, 30)
        self.layout ().setAlignment (self.button, Qt.AlignHCenter)
        self.fontLabel = QLabel (quote, self)
        self.layout ().setAlignment (self.fontLabel, Qt.AlignHCenter)
        
        self.connect(self.button, SIGNAL('clicked()'), self.showDialog)
Esempio n. 14
0
    def __init__(self, parent):
        KVBox.__init__(self, parent)
        self.setSpacing(40)
        self.help = QLabel(i18n(helpText), self)
        self.layout().setAlignment(self.help, Qt.AlignHCenter)

        self.button = KPushButton(i18n("Show %s" % dialogName), self)
        self.button.setFixedSize(200, 30)
        self.layout().setAlignment(self.button, Qt.AlignHCenter)
        self.fontLabel = QLabel(quote, self)
        self.layout().setAlignment(self.fontLabel, Qt.AlignHCenter)

        self.connect(self.button, SIGNAL('clicked()'), self.showDialog)
Esempio n. 15
0
    def __init__(self, parent=None):
        KVBox.__init__(self, parent)
        self.help = QLabel(i18n(helpText), self)
        self.layout().setAlignment(self.help, Qt.AlignHCenter)
        self.setSpacing(10)

        hBox = KHBox(self)

        display = QTreeWidget(hBox)
        display.setSizePolicy(QSizePolicy.Expanding, QSizePolicy.Expanding)
        display.setHeaderLabels(
            ["Device", "Bus", "Type", "Hot Plug", "Removable"])
        display.setColumnWidth(0, 150)

        # convert enum values to strings for display
        bus2Str = {Solid.StorageDrive.Ide : "IDE",\
                   Solid.StorageDrive.Usb : "USB",\
                   Solid.StorageDrive. Ieee1394 : "IEE1394",\
                   Solid.StorageDrive.Scsi : "SCSI",\
                   Solid.StorageDrive.Sata : "SATA",\
                   Solid.StorageDrive.Platform : "Platform"
                  }


        driveType2Str = {Solid.StorageDrive.HardDisk : "Hard Disk",\
                         Solid.StorageDrive.CdromDrive : "CD ROM",\
                         Solid.StorageDrive.Floppy : "Floppy",\
                         Solid.StorageDrive.Tape : "Tape",\
                         Solid.StorageDrive.CompactFlash : "Compact Flash",\
                         Solid.StorageDrive.MemoryStick : "Memory Stick",\
                         Solid.StorageDrive.SmartMedia : "Smart Media",\
                         Solid.StorageDrive.SdMmc : "SD MMC",\
                         Solid.StorageDrive.Xd : "XD"
                        }

        # retrieve a list of Solid.Device for this machine
        deviceList = Solid.Device.allDevices()

        # filter the list of all devices and display matching results
        # note that we never create a Solid.StorageDrive object, but
        # receive one from the call to 'asDeviceInterface'
        for device in deviceList:
            if device.isDeviceInterface(Solid.DeviceInterface.StorageDrive):
                drive = device.asDeviceInterface(
                    Solid.DeviceInterface.StorageDrive)
                QTreeWidgetItem(display, [
                    device.product(), bus2Str[drive.bus()],
                    driveType2Str[drive.driveType()],
                    str(drive.isHotpluggable()),
                    str(drive.isRemovable())
                ])
Esempio n. 16
0
    def __init__(self, parent=None):
        KVBox.__init__(self, parent)
        self.help  = QLabel (helpText, self)
        self.layout ().setAlignment (self.help, Qt.AlignHCenter)
        
        hBox1 = KHBox (self)
        hBox1.setSpacing (10)
        hBox1.setMargin (40)

        
        colorButtonLabel = QLabel ("KColorButton", hBox1)
        colorButton = KColorButton (hBox1)

        colorCellsLabel = QLabel ("KColorCells", hBox1)
        colorCells = KColorCells (hBox1, 1, 8)
        colorCells.setMaximumSize (160, 20)
        colorCells.setColor (0, Qt.black)
        colorCells.setColor (1, Qt.red)
        colorCells.setColor (2, Qt.yellow)
        colorCells.setColor (3, Qt.blue)
        colorCells.setColor (4, Qt.darkGreen)
        colorCells.setColor (5, Qt.magenta)
        colorCells.setColor (6, Qt.gray)
        colorCells.setColor (7, Qt.white)
        
        
        colorComboLabel = QLabel ("KColorCombo", hBox1)
        colorCombo = KColorCombo (hBox1)

        colorList = [Qt.black, Qt.red, Qt.yellow, Qt.blue, Qt.darkGreen, Qt.magenta, Qt.gray, Qt.white]
        colorCombo.setColors (colorList)
        colorCombo.setMaximumWidth (80)
        
        hBox2 = KHBox (self)
        hBox2.setSpacing (10)
        self.layout ().setAlignment (hBox2, Qt.AlignHCenter | Qt.AlignTop)
        self.setStretchFactor (hBox2, 1)
        
        colorPatchLabel = QLabel ("KColorPatch", hBox2)
        hBox2.layout ().setAlignment (colorPatchLabel, Qt.AlignHCenter)
        self.colorPatch = KColorPatch (hBox2)
        self.colorPatch.setFixedSize (40, 40)
        hBox2.layout ().setAlignment (self.colorPatch, Qt.AlignHCenter)

        self.colorPatch.setColor (Qt.red)
        self.colorPatch.show ()

        self.connect (colorButton, SIGNAL ("changed (const QColor&)"), self.colorPatch.setColor)
        self.connect (colorCells, SIGNAL ("colorSelected (int, const QColor&)"), self.colorCellSelected)
        self.connect (colorCombo, SIGNAL ("activated (const QColor&)"), self.colorPatch.setColor)
Esempio n. 17
0
    def __init__(self, parent):
        KVBox.__init__(self, parent)
        self.help = QLabel(helpText, self)
        self.layout().setAlignment(self.help, Qt.AlignHCenter)

        hBox = KHBox(self)
        self.button = KPushButton(i18n("Show %s" % dialogName), hBox)
        self.button.setMaximumSize(250, 30)

        self.connect(self.button, SIGNAL('clicked()'), self.showDialog)

        self.colorPatch = KColorPatch(hBox)
        self.colorPatch.setColor(Qt.red)
        self.colorPatch.setMaximumSize(40, 40)
Esempio n. 18
0
    def __init__(self, parent=None):
        KVBox.__init__(self, parent)
        self.help  = QLabel (i18n (helpText), self)
        self.layout ().setAlignment (self.help, Qt.AlignHCenter)
        self.setSpacing (10)
        
        display = QTreeWidget (self)        
        display.setHeaderLabels (["Product", "Vendor", "UDI"])
        display.setColumnWidth (0, 300)

        # retrieve a list of Solid.Device for this machine
        deviceList = Solid.Device.allDevices ()
        
        for device in deviceList:
            item = QTreeWidgetItem (display, [device.product (), device.vendor (), device.udi ()])
Esempio n. 19
0
    def __init__(self, parent = None):
        KVBox.__init__(self, parent)
        self.help  = QLabel (helpText, self)
        self.layout ().setAlignment (self.help, Qt.AlignHCenter)
        self.setMargin (40)
        
        # choose an image at random
        self.pix   = QPixmap (os.path.join (imagePath, "poster%i.png" % randint (0, 6)))

        hBox = KHBox (self)
        self.poster = QLabel (hBox)
        self.poster.setPixmap (self.pix)

        self.layout ().setAlignment (hBox, Qt.AlignHCenter)
        self.setStretchFactor (hBox, 1)
Esempio n. 20
0
    def __init__(self, parent=None):
        KVBox.__init__(self, parent)
        self.help = QLabel(helpText, self)
        self.layout().setAlignment(self.help, Qt.AlignHCenter)
        self.setMargin(40)

        # choose an image at random
        self.pix = QPixmap(
            os.path.join(imagePath, "poster%i.png" % randint(0, 6)))

        hBox = KHBox(self)
        self.poster = QLabel(hBox)
        self.poster.setPixmap(self.pix)

        self.layout().setAlignment(hBox, Qt.AlignHCenter)
        self.setStretchFactor(hBox, 1)
Esempio n. 21
0
    def __init__(self, parent=None):
        KVBox.__init__(self, parent)
        self.help = QLabel(i18n(helpText), self)
        self.layout().setAlignment(self.help, Qt.AlignHCenter)
        self.setSpacing(10)

        statusString = {
                          Solid.Networking.Unknown: "Unknown",\
                          Solid.Networking.Unconnected: "Unconnected",\
                          Solid.Networking.Disconnecting: "Disconnecting",\
                          Solid.Networking.Connecting: "Connecting",\
                          Solid.Networking.Connected: "Connected"\
                       }

        status = Solid.Networking.status()
        self.label = QLabel("Status:   %s" % statusString[status], self)

        hBox = KHBox(self)

        display = QTreeWidget(hBox)
        display.setSizePolicy(QSizePolicy.Expanding, QSizePolicy.Expanding)
        display.setHeaderLabels(
            ["Interface", "Name", "Wireless", "HW Addr", "MAC Addr"])
        display.setColumnWidth(0, 200)
        display.setColumnWidth(1, 75)
        display.setColumnWidth(3, 150)

        # retrieve a list of Solid.Device for this machine
        deviceList = Solid.Device.allDevices()

        # filter the list of all devices and display matching results
        # note that we never create a Solid.NetworkInterface object, but
        # receive one from the 'asDeviceInterface' call
        for device in deviceList:
            if device.isDeviceInterface(
                    Solid.DeviceInterface.NetworkInterface):
                iface = device.asDeviceInterface(
                    Solid.DeviceInterface.NetworkInterface)
                QTreeWidgetItem(display, [
                    device.product(),
                    iface.ifaceName(),
                    str(iface.isWireless()),
                    iface.hwAddress(),
                    str(iface.macAddress())
                ])
Esempio n. 22
0
    def __init__(self, parent=None):
        KVBox.__init__(self, parent)
        self.help = QLabel(i18n(helpText), self)
        self.layout().setAlignment(self.help, Qt.AlignHCenter)
        self.setSpacing(10)

        statusString = {
            Solid.Networking.Unknown: "Unknown",
            Solid.Networking.Unconnected: "Unconnected",
            Solid.Networking.Disconnecting: "Disconnecting",
            Solid.Networking.Connecting: "Connecting",
            Solid.Networking.Connected: "Connected",
        }

        status = Solid.Networking.status()
        self.label = QLabel("Status:   %s" % statusString[status], self)

        hBox = KHBox(self)

        display = QTreeWidget(hBox)
        display.setSizePolicy(QSizePolicy.Expanding, QSizePolicy.Expanding)
        display.setHeaderLabels(["Interface", "Name", "Wireless", "HW Addr", "MAC Addr"])
        display.setColumnWidth(0, 200)
        display.setColumnWidth(1, 75)
        display.setColumnWidth(3, 150)

        # retrieve a list of Solid.Device for this machine
        deviceList = Solid.Device.allDevices()

        # filter the list of all devices and display matching results
        # note that we never create a Solid.NetworkInterface object, but
        # receive one from the 'asDeviceInterface' call
        for device in deviceList:
            if device.isDeviceInterface(Solid.DeviceInterface.NetworkInterface):
                iface = device.asDeviceInterface(Solid.DeviceInterface.NetworkInterface)
                QTreeWidgetItem(
                    display,
                    [
                        device.product(),
                        iface.ifaceName(),
                        str(iface.isWireless()),
                        iface.hwAddress(),
                        str(iface.macAddress()),
                    ],
                )
Esempio n. 23
0
    def __init__(self, parent=None):
        KVBox.__init__(self, parent)
        self.help = QLabel(i18n(helpText), self)
        self.layout().setAlignment(self.help, Qt.AlignHCenter)
        self.setSpacing(10)

        display = QTreeWidget(self)
        display.setHeaderLabels(["Product", "Vendor", "UDI"])
        display.setColumnWidth(0, 300)

        # retrieve a list of Solid.Device for this machine
        deviceList = Solid.Device.allDevices()

        for device in deviceList:
            item = QTreeWidgetItem(
                display, [device.product(),
                          device.vendor(),
                          device.udi()])
Esempio n. 24
0
    def __init__(self, parent=None):
        KVBox.__init__(self, parent)
        self.help  = QLabel (i18n (helpText), self)
        self.layout ().setAlignment (self.help, Qt.AlignHCenter)
        self.setSpacing (10)
        
        display = QTreeWidget (self)        
        display.setHeaderLabels (["Processor", "Max Speed", "Number", "Change Freq"])
        
        # retrieve a list of Solid.Device for this machine
        deviceList = Solid.Device.allDevices ()

        # filter the list of all devices and display matching results
        for device in deviceList:
            if device.isDeviceInterface (Solid.DeviceInterface.Processor):
                cpu = device.asDeviceInterface (Solid.DeviceInterface.Processor)
                QTreeWidgetItem (display, [device.product (),
                                           str (cpu.maxSpeed ()),
                                           str (cpu.number ()),
                                           str (cpu.canChangeFrequency ())])
Esempio n. 25
0
    def __init__(self, parent=None):
        KVBox.__init__(self, parent)
        self.help  = QLabel (i18n (helpText), self)
        self.layout ().setAlignment (self.help, Qt.AlignHCenter)
        self.setSpacing (10)
        
        display = QTreeWidget ()        
        display.setHeaderLabels (["Processor", "Max Speed", "Number", "Change Freq"])
        
        # retrieve a list of Solid.Device for this machine
        deviceList = Solid.Device.allDevices ()

        # filter the list of all devices and display matching results
        for device in deviceList:
            if device.isDeviceInterface (Solid.DeviceInterface.Processor):
                cpu = device.asDeviceInterface (Solid.DeviceInterface.Processor)
                QTreeWidgetItem (display, [device.product (),
                                           str (cpu.maxSpeed ()),
                                           str (cpu.number ()),
                                           str (cpu.canChangeFrequency ())])
Esempio n. 26
0
 def __init__(self, tool):
     KVBox.__init__(self)
     self.tool = tool
     
     h = KHBox(self)
     h.layout().setContentsMargins(8, 2, 4, 0)
     l = QLabel(i18n("Direction:"), h)
     d = self.directionWidget = QComboBox(h)
     d.addItems([i18n("Up"), i18n("Neutral"), i18n("Down")])
     d.setItemIcon(0, KIcon("arrow-up"))
     d.setItemIcon(2, KIcon("arrow-down"))
     d.setCurrentIndex(1)
     l.setBuddy(d)
     h.setToolTip(i18n(
         "Where to add articulations et cetera: "
         "above or below the staff or in the default position."))
     
     t = self.toolboxWidget = ToolBox(self)
     # don't allow us to shrink below the minimum size of our children
     self.setSizePolicy(QSizePolicy.Minimum, QSizePolicy.Minimum)
     width = max(w.minimumSizeHint().width() for w in t.widgets) + 12
     self.setMinimumWidth(width)
Esempio n. 27
0
    def __init__(self, parent=None):
        KVBox.__init__(self, parent)
        self.help  = QLabel (i18n (helpText), self)
        self.layout ().setAlignment (self.help, Qt.AlignHCenter)
        self.setSpacing (10)

        hBox = KHBox (self)

        display = QTreeWidget (hBox)        
        display.setSizePolicy (QSizePolicy.Expanding, QSizePolicy.Expanding)
        display.setHeaderLabels (["Volume", "FS Type", "Label", "Ignored", "Size", "Usage"])
        display.setColumnWidth (0, 150)

        # convert enum values to strings for display
        usageType2Str = { Solid.StorageVolume.Other : "Other",\
                          Solid.StorageVolume.Unused : "Unused",\
                          Solid.StorageVolume.FileSystem : "File System",
                          Solid.StorageVolume.PartitionTable : "Partition Tbl",\
                          Solid.StorageVolume.Raid : "Raid",\
                          Solid.StorageVolume.Encrypted : "Encrypted"
                        }        

        # retrieve a list of Solid.Device for this machine
        deviceList = Solid.Device.allDevices ()

        # filter the list of all devices and display matching results
        # note that we never create a Solid.StorageVolume object,
        # but receive one from the 'asDeviceInterface" call
        for device in deviceList:
            if device.isDeviceInterface (Solid.DeviceInterface.StorageVolume):
                volume = device.asDeviceInterface (Solid.DeviceInterface.StorageVolume)
                QTreeWidgetItem (display, [device.product (),
                                           volume.fsType (),
                                           volume.label (),
                                           str (volume.isIgnored ()),
                                           "%i MB" % (volume.size ()/1024/1024),
                                           usageType2Str [volume.usage ()]])
Esempio n. 28
0
 def __init__(self, parent=None):
     KVBox.__init__(self, parent)
     self.help  = QLabel (helpText, self)
     self.layout ().setAlignment (self.help, Qt.AlignHCenter)
     
     hBox = KHBox (self)
Esempio n. 29
0
    def __init__(self, parent=None):
        super(KVBox, self).__init__(parent)
        self.help = QLabel(i18n(helpText), self)
        self.layout().setAlignment(self.help, Qt.AlignHCenter)
        self.setSpacing(10)

        hBox = KHBox(self)
        self.layout().setAlignment(hBox, Qt.AlignHCenter)

        cBox = KVBox(hBox)
        hBox.layout().setAlignment(cBox, Qt.AlignTop)
        hBox.setSpacing(25)
        hBox.setMargin(10)

        self.stdDirs = KStandardDirs()
        types = self.stdDirs.allTypes()

        comboLbl = QLabel("Types", cBox)
        combo = KComboBox(cBox)
        combo.addItems(types)
        cBox.layout().setAlignment(comboLbl, Qt.AlignTop)
        cBox.layout().setAlignment(combo, Qt.AlignTop)

        # We're calling the QString version of the signal, as
        # currentIndexChanged can also be emitted with an int (the index that
        # changed)

        combo.currentIndexChanged[QString].connect(self.slotIndexChanged)

        lBox = KVBox(hBox)
        listLbl = QLabel("Directories", lBox)
        self.location = KListWidget(lBox)
        self.location.setMaximumSize(400, 200)
        lBox.layout().setAlignment(listLbl, Qt.AlignTop)
        lBox.layout().setAlignment(self.location, Qt.AlignTop)

        QLabel(self.stdDirs.installPath("ui"), self)

        self.slotIndexChanged(combo.currentText())
Esempio n. 30
0
    def __init__(self, parent=None):
        KVBox.__init__(self, parent)
        self.help  = QLabel (i18n (helpText), self)
        self.layout ().setAlignment (self.help, Qt.AlignHCenter)
        self.setSpacing (10)
        
        hBox          = KHBox (self)
        self.layout ().setAlignment (hBox, Qt.AlignHCenter)
        
        cBox          = KVBox (hBox)
        hBox.layout ().setAlignment (cBox, Qt.AlignTop)
        hBox.setSpacing (25)
        hBox.setMargin (10)

        self.stdDirs  = KStandardDirs ()
        types         = self.stdDirs.allTypes ()
        
        comboLbl      = QLabel ("Types", cBox)
        combo         = KComboBox (cBox)        
        combo.addItems (types)
        cBox.layout ().setAlignment (comboLbl, Qt.AlignTop)
        cBox.layout ().setAlignment (combo, Qt.AlignTop)
        
        self.connect (combo, SIGNAL ("currentIndexChanged (const QString&)"), self.slotIndexChanged)

        lBox          = KVBox (hBox)
        listLbl       = QLabel ("Directories", lBox)
        self.location = KListWidget (lBox)
        self.location.setMaximumSize (400, 200)
        lBox.layout ().setAlignment (listLbl, Qt.AlignTop)
        lBox.layout ().setAlignment (self.location, Qt.AlignTop)

        QLabel (self.stdDirs.installPath ("ui"), self)

        self.slotIndexChanged (combo.currentText ())
Esempio n. 31
0
    def __init__(self, parent=None):
        KVBox.__init__(self, parent)
        self.help = QLabel(i18n(helpText), self)
        self.layout().setAlignment(self.help, Qt.AlignHCenter | Qt.AlignTop)
        self.setSpacing(40)

        hBox = KHBox(self)
        vBox1 = KVBox(hBox)
        vBox2 = KVBox(hBox)

        hBox.layout().setAlignment(vBox1, Qt.AlignHCenter)
        hBox.layout().setAlignment(vBox2, Qt.AlignHCenter)
        vBox1.setMargin(20)
        vBox2.setSpacing(20)

        self.datePickerLabel = QLabel("KDatePicker", vBox1)

        self.datePicker = KDatePicker(vBox2)
        self.datePicker.setFixedSize(400, 200)

        self.other = QLabel('KDateWidget', vBox1)
        vBox1.layout().setAlignment(self.other, Qt.AlignBottom)

        self.dateDisplay = KDateWidget(vBox2)

        self.connect(self.datePicker, SIGNAL('dateChanged(QDate)'),
                     self.dateDisplay.setDate)
Esempio n. 32
0
    def __init__(self, parent=None):
        KVBox.__init__(self, parent)
        self.help = QLabel(helpText, self)
        self.layout().setAlignment(self.help, Qt.AlignHCenter)

        hBox = KHBox(self)
Esempio n. 33
0
    def __init__(self, parent=None):
        KVBox.__init__(self, parent)
        self.help = QLabel(i18n(helpText), self)
        self.layout().setAlignment(self.help, Qt.AlignHCenter)
        self.setSpacing(10)

        hBox = KHBox(self)
        self.layout().setAlignment(hBox, Qt.AlignHCenter)

        cBox = KVBox(hBox)
        hBox.layout().setAlignment(cBox, Qt.AlignTop)
        hBox.setSpacing(25)
        hBox.setMargin(10)

        self.stdDirs = KStandardDirs()
        types = self.stdDirs.allTypes()

        comboLbl = QLabel("Types", cBox)
        combo = KComboBox(cBox)
        combo.addItems(types)
        cBox.layout().setAlignment(comboLbl, Qt.AlignTop)
        cBox.layout().setAlignment(combo, Qt.AlignTop)

        self.connect(combo, SIGNAL("currentIndexChanged (const QString&)"),
                     self.slotIndexChanged)

        lBox = KVBox(hBox)
        listLbl = QLabel("Directories", lBox)
        self.location = KListWidget(lBox)
        self.location.setMaximumSize(400, 200)
        lBox.layout().setAlignment(listLbl, Qt.AlignTop)
        lBox.layout().setAlignment(self.location, Qt.AlignTop)

        self.slotIndexChanged(combo.currentText())
Esempio n. 34
0
    def __init__(self, parent, updatedFiles, warnpreview):
        KDialog.__init__(self, parent)
        self.setAttribute(Qt.WA_DeleteOnClose)
        self.setButtons(KDialog.ButtonCode(KDialog.Ok | KDialog.Cancel))
        self.setCaption(i18n("Email documents"))
        self.showButtonSeparator(True)
        b = KVBox(self)
        b.setSpacing(4)
        QLabel(i18n("Please select the files you want to send:"), b)
        fileList = QListWidget(b)
        fileList.setIconSize(QSize(22, 22))
        fileList.setWhatsThis(i18n(
            "These are the files that are up-to-date (i.e. newer than "
            "the LilyPond source document). Also LilyPond files included "
            "by the source document are shown."))
        
        lyFiles = ly.parse.findIncludeFiles(updatedFiles.lyfile,
            config("preferences").readPathEntry("lilypond include path", []))
        pdfFiles = updatedFiles("pdf")
        midiFiles = updatedFiles("mid*")
        
        if warnpreview and pdfFiles:
            QLabel(i18np(
                "Note: this PDF file has been created with "
                "embedded point-and-click URLs (preview mode), which "
                "increases the file size dramatically. "
                "Please consider to rebuild the file in publish mode, "
                "because then the PDF file is much smaller.",
                "Note: these PDF files have been created with "
                "embedded point-and-click URLs (preview mode), which "
                "increases the file size dramatically. "
                "Please consider to rebuild the files in publish mode, "
                "because then the PDF files are much smaller.",
                len(pdfFiles)), b).setWordWrap(True)
        
        if not pdfFiles and not midiFiles:
            QLabel(i18n(
                "Note: If there are no PDF and no MIDI files, you "
                "probably need to run LilyPond to update those files, "
                "before sending the e-mail."),
                b).setWordWrap(True)
            
        self.fileList = fileList
        self.setMainWidget(b)
        self.resize(450, 300)
        
        basedir = os.path.dirname(updatedFiles.lyfile)
        exts = config("general").readEntry("email_extensions", [".pdf"])
        
        def item(icon, fileName):
            """ Add item to the fileList list widget. """
            directory, name = os.path.split(fileName)
            if directory != basedir:
                name += " ({0})".format(os.path.normpath(directory))
            i = QListWidgetItem(KIcon(icon), name, fileList)
            i.setFlags(Qt.ItemIsEnabled | Qt.ItemIsSelectable | Qt.ItemIsUserCheckable)
            i.ext = os.path.splitext(fileName)[1]
            i.url = KUrl.fromPath(fileName).url()
            i.setCheckState(Qt.Checked if i.ext in exts else Qt.Unchecked)

        # insert the files
        for lyfile in lyFiles:
            item("text-x-lilypond", lyfile)
        for pdf in pdfFiles:
            item("application-pdf", pdf)
        for midi in midiFiles:
            item("audio-midi", midi)