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 | 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) 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())
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()) ])
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 ())
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)
def __init__(self, parent): super(MainFrame, self).__init__(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.button.clicked.connect(self.showDialog)
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)
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()) ])
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)
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)
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()) ])
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())
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)
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)
def __init__(self, parent=None): KVBox.__init__(self, parent) self.help = QLabel(helpText, self) self.layout().setAlignment(self.help, Qt.AlignHCenter) hBox = KHBox(self)