def createConfigurationInterface(self, parent): self.selectDevice = DevicePanel(self, parent) parent.addPage(self.selectDevice,"Panel Devices") self.interfaceSettings = InterfaceSettings(self, parent) parent.addPage(self.interfaceSettings, 'Interface') self.sizeSelect = SizeWidget(self, parent) parent.addPage(self.sizeSelect, "Size") self.colorSelect = ColorWidget(self, parent) parent.addPage(self.colorSelect, "Color") self.connect(parent, SIGNAL("okClicked()"), self.configAccepted) self.connect(parent, SIGNAL("cancelClicked()"), self.configDenied)
def setupUi(self, ToolBox): ToolBox.setObjectName(_fromUtf8("ToolBox")) ToolBox.resize(438, 636) ToolBox.setWindowTitle(QtGui.QApplication.translate("ToolBox", "ToolBox", None, QtGui.QApplication.UnicodeUTF8)) icon = QtGui.QIcon() icon.addPixmap(QtGui.QPixmap(_fromUtf8(":/icons/resources/icons/app-icons/logo_small.png")), QtGui.QIcon.Normal, QtGui.QIcon.Off) ToolBox.setWindowIcon(icon) ToolBox.setAutoFillBackground(True) ToolBox.setStyleSheet(QtGui.QApplication.translate("ToolBox", "0", None, QtGui.QApplication.UnicodeUTF8)) ToolBox.setFrameShape(QtGui.QFrame.StyledPanel) self.drawingPage = QtGui.QWidget() self.drawingPage.setGeometry(QtCore.QRect(0, 0, 436, 389)) self.drawingPage.setObjectName(_fromUtf8("drawingPage")) self.verticalLayout_14 = QtGui.QVBoxLayout(self.drawingPage) self.verticalLayout_14.setMargin(1) self.verticalLayout_14.setObjectName(_fromUtf8("verticalLayout_14")) self.scrollArea_6 = QtGui.QScrollArea(self.drawingPage) self.scrollArea_6.setStyleSheet(_fromUtf8("QScrollArea::title { \n" " background-color: transparent;\n" " subcontrol-position: top left; /* position at the top left*/ \n" " padding:2 13px;\n" " } \n" "\n" "QScrollArea { \n" " border: 2px solid gray;\n" " background-color: lightgray;\n" " border-radius: 5px; \n" " } \n" "")) self.scrollArea_6.setWidgetResizable(True) self.scrollArea_6.setObjectName(_fromUtf8("scrollArea_6")) self.scrollAreaWidgetContents_6 = QtGui.QWidget() self.scrollAreaWidgetContents_6.setGeometry(QtCore.QRect(0, 0, 430, 383)) self.scrollAreaWidgetContents_6.setObjectName(_fromUtf8("scrollAreaWidgetContents_6")) self.verticalLayout_15 = QtGui.QVBoxLayout(self.scrollAreaWidgetContents_6) self.verticalLayout_15.setMargin(1) self.verticalLayout_15.setObjectName(_fromUtf8("verticalLayout_15")) self.drawingPropertiesWidget = DrawingPropertiesWidget(self.scrollAreaWidgetContents_6) self.drawingPropertiesWidget.setToolTip(QtGui.QApplication.translate("ToolBox", "Custom widget", None, QtGui.QApplication.UnicodeUTF8)) self.drawingPropertiesWidget.setWhatsThis(QtGui.QApplication.translate("ToolBox", "You don\'t care", None, QtGui.QApplication.UnicodeUTF8)) self.drawingPropertiesWidget.setObjectName(_fromUtf8("drawingPropertiesWidget")) self.verticalLayout_15.addWidget(self.drawingPropertiesWidget) self.scrollArea_6.setWidget(self.scrollAreaWidgetContents_6) self.verticalLayout_14.addWidget(self.scrollArea_6) icon1 = QtGui.QIcon() icon1.addPixmap(QtGui.QPixmap(_fromUtf8(":/icons/resources/icons/app-icons/property.png")), QtGui.QIcon.Normal, QtGui.QIcon.Off) ToolBox.addItem(self.drawingPage, icon1, _fromUtf8("")) self.strokeStylePage = QtGui.QWidget() self.strokeStylePage.setGeometry(QtCore.QRect(0, 0, 436, 389)) self.strokeStylePage.setObjectName(_fromUtf8("strokeStylePage")) self.verticalLayout = QtGui.QVBoxLayout(self.strokeStylePage) self.verticalLayout.setMargin(1) self.verticalLayout.setObjectName(_fromUtf8("verticalLayout")) self.scrollArea = QtGui.QScrollArea(self.strokeStylePage) self.scrollArea.setMinimumSize(QtCore.QSize(235, 0)) self.scrollArea.setAutoFillBackground(False) self.scrollArea.setStyleSheet(_fromUtf8("QScrollArea::title { \n" " background-color: transparent;\n" " subcontrol-position: top left; /* position at the top left*/ \n" " padding:2 13px;\n" " } \n" "\n" "QScrollArea { \n" " border: 2px solid gray;\n" " background-color: lightgray;\n" " border-radius: 5px; \n" " } ")) self.scrollArea.setFrameShape(QtGui.QFrame.NoFrame) self.scrollArea.setFrameShadow(QtGui.QFrame.Plain) self.scrollArea.setWidgetResizable(True) self.scrollArea.setObjectName(_fromUtf8("scrollArea")) self.scrollAreaWidgetContents = QtGui.QWidget() self.scrollAreaWidgetContents.setGeometry(QtCore.QRect(0, 0, 430, 383)) self.scrollAreaWidgetContents.setMinimumSize(QtCore.QSize(200, 181)) self.scrollAreaWidgetContents.setObjectName(_fromUtf8("scrollAreaWidgetContents")) self.verticalLayout_2 = QtGui.QVBoxLayout(self.scrollAreaWidgetContents) self.verticalLayout_2.setMargin(1) self.verticalLayout_2.setObjectName(_fromUtf8("verticalLayout_2")) self.strokeStyleWidget = StrokeStyleWidget(self.scrollAreaWidgetContents) self.strokeStyleWidget.setToolTip(QtGui.QApplication.translate("ToolBox", "Custom widget", None, QtGui.QApplication.UnicodeUTF8)) self.strokeStyleWidget.setWhatsThis(QtGui.QApplication.translate("ToolBox", "You don\'t care", None, QtGui.QApplication.UnicodeUTF8)) self.strokeStyleWidget.setObjectName(_fromUtf8("strokeStyleWidget")) self.verticalLayout_2.addWidget(self.strokeStyleWidget) self.scrollArea.setWidget(self.scrollAreaWidgetContents) self.verticalLayout.addWidget(self.scrollArea) icon2 = QtGui.QIcon() icon2.addPixmap(QtGui.QPixmap(_fromUtf8(":/icons/resources/icons/tool-icons/drawings.png")), QtGui.QIcon.Normal, QtGui.QIcon.Off) ToolBox.addItem(self.strokeStylePage, icon2, _fromUtf8("")) self.strokeColorPage = QtGui.QWidget() self.strokeColorPage.setGeometry(QtCore.QRect(0, 0, 436, 389)) self.strokeColorPage.setObjectName(_fromUtf8("strokeColorPage")) self.verticalLayout_3 = QtGui.QVBoxLayout(self.strokeColorPage) self.verticalLayout_3.setMargin(1) self.verticalLayout_3.setObjectName(_fromUtf8("verticalLayout_3")) self.scrollArea_2 = QtGui.QScrollArea(self.strokeColorPage) self.scrollArea_2.setStyleSheet(_fromUtf8("QScrollArea::title { \n" " background-color: transparent;\n" " subcontrol-position: top left; /* position at the top left*/ \n" " padding:2 13px;\n" " } \n" "\n" "QScrollArea { \n" " border: 2px solid gray;\n" " background-color: lightgray;\n" " border-radius: 5px; \n" " } ")) self.scrollArea_2.setFrameShape(QtGui.QFrame.NoFrame) self.scrollArea_2.setFrameShadow(QtGui.QFrame.Plain) self.scrollArea_2.setWidgetResizable(True) self.scrollArea_2.setObjectName(_fromUtf8("scrollArea_2")) self.scrollAreaWidgetContents_2 = QtGui.QWidget() self.scrollAreaWidgetContents_2.setGeometry(QtCore.QRect(0, 0, 430, 383)) self.scrollAreaWidgetContents_2.setObjectName(_fromUtf8("scrollAreaWidgetContents_2")) self.verticalLayout_13 = QtGui.QVBoxLayout(self.scrollAreaWidgetContents_2) self.verticalLayout_13.setMargin(1) self.verticalLayout_13.setObjectName(_fromUtf8("verticalLayout_13")) self.verticalLayout_4 = QtGui.QVBoxLayout() self.verticalLayout_4.setObjectName(_fromUtf8("verticalLayout_4")) self.strokeColor = ColorWidget(self.scrollAreaWidgetContents_2) self.strokeColor.setToolTip(QtGui.QApplication.translate("ToolBox", "Custom color widget", None, QtGui.QApplication.UnicodeUTF8)) self.strokeColor.setWhatsThis(QtGui.QApplication.translate("ToolBox", "You don\'t care", None, QtGui.QApplication.UnicodeUTF8)) self.strokeColor.setObjectName(_fromUtf8("strokeColor")) self.verticalLayout_4.addWidget(self.strokeColor) self.formLayout_2 = QtGui.QFormLayout() self.formLayout_2.setContentsMargins(9, 0, 9, 9) self.formLayout_2.setHorizontalSpacing(22) self.formLayout_2.setVerticalSpacing(9) self.formLayout_2.setObjectName(_fromUtf8("formLayout_2")) self.label_14 = QtGui.QLabel(self.scrollAreaWidgetContents_2) self.label_14.setText(QtGui.QApplication.translate("ToolBox", "Current Color:", None, QtGui.QApplication.UnicodeUTF8)) self.label_14.setObjectName(_fromUtf8("label_14")) self.formLayout_2.setWidget(0, QtGui.QFormLayout.LabelRole, self.label_14) self.strokeColorLabel = QtGui.QLabel(self.scrollAreaWidgetContents_2) self.strokeColorLabel.setStyleSheet(_fromUtf8("QLabel {\n" " border: 1px solid \n" "}")) self.strokeColorLabel.setText(_fromUtf8("")) self.strokeColorLabel.setObjectName(_fromUtf8("strokeColorLabel")) self.formLayout_2.setWidget(0, QtGui.QFormLayout.FieldRole, self.strokeColorLabel) self.label_6 = QtGui.QLabel(self.scrollAreaWidgetContents_2) self.label_6.setText(QtGui.QApplication.translate("ToolBox", "Stroke Enabled:", None, QtGui.QApplication.UnicodeUTF8)) self.label_6.setObjectName(_fromUtf8("label_6")) self.formLayout_2.setWidget(1, QtGui.QFormLayout.LabelRole, self.label_6) self.shouldStrokeCheckbox = QtGui.QCheckBox(self.scrollAreaWidgetContents_2) self.shouldStrokeCheckbox.setLayoutDirection(QtCore.Qt.RightToLeft) self.shouldStrokeCheckbox.setText(_fromUtf8("")) self.shouldStrokeCheckbox.setObjectName(_fromUtf8("shouldStrokeCheckbox")) self.formLayout_2.setWidget(1, QtGui.QFormLayout.FieldRole, self.shouldStrokeCheckbox) self.verticalLayout_4.addLayout(self.formLayout_2) self.verticalLayout_13.addLayout(self.verticalLayout_4) self.scrollArea_2.setWidget(self.scrollAreaWidgetContents_2) self.verticalLayout_3.addWidget(self.scrollArea_2) icon3 = QtGui.QIcon() icon3.addPixmap(QtGui.QPixmap(_fromUtf8(":/icons/resources/icons/tool-icons/color1.png")), QtGui.QIcon.Normal, QtGui.QIcon.Off) ToolBox.addItem(self.strokeColorPage, icon3, _fromUtf8("")) self.strokeFillPage = QtGui.QWidget() self.strokeFillPage.setGeometry(QtCore.QRect(0, 0, 436, 389)) self.strokeFillPage.setAutoFillBackground(True) self.strokeFillPage.setObjectName(_fromUtf8("strokeFillPage")) self.verticalLayout_9 = QtGui.QVBoxLayout(self.strokeFillPage) self.verticalLayout_9.setMargin(1) self.verticalLayout_9.setObjectName(_fromUtf8("verticalLayout_9")) self.scrollArea_3 = QtGui.QScrollArea(self.strokeFillPage) self.scrollArea_3.setAutoFillBackground(True) self.scrollArea_3.setStyleSheet(_fromUtf8("QScrollArea::title { \n" " background-color: transparent;\n" " subcontrol-position: top left; /* position at the top left*/ \n" " padding:2 13px;\n" " } \n" "\n" "QScrollArea { \n" " border: 2px solid gray;\n" " background-color: lightgray;\n" " border-radius: 5px; \n" " } \n" "")) self.scrollArea_3.setFrameShape(QtGui.QFrame.NoFrame) self.scrollArea_3.setFrameShadow(QtGui.QFrame.Plain) self.scrollArea_3.setWidgetResizable(True) self.scrollArea_3.setObjectName(_fromUtf8("scrollArea_3")) self.scrollAreaWidgetContents_3 = QtGui.QWidget() self.scrollAreaWidgetContents_3.setGeometry(QtCore.QRect(0, 0, 430, 383)) self.scrollAreaWidgetContents_3.setMinimumSize(QtCore.QSize(0, 0)) self.scrollAreaWidgetContents_3.setAutoFillBackground(True) self.scrollAreaWidgetContents_3.setObjectName(_fromUtf8("scrollAreaWidgetContents_3")) self.verticalLayout_12 = QtGui.QVBoxLayout(self.scrollAreaWidgetContents_3) self.verticalLayout_12.setMargin(1) self.verticalLayout_12.setObjectName(_fromUtf8("verticalLayout_12")) self.verticalLayout_5 = QtGui.QVBoxLayout() self.verticalLayout_5.setSpacing(0) self.verticalLayout_5.setObjectName(_fromUtf8("verticalLayout_5")) self.fillColor = ColorWidget(self.scrollAreaWidgetContents_3) self.fillColor.setToolTip(QtGui.QApplication.translate("ToolBox", "Custom color widget", None, QtGui.QApplication.UnicodeUTF8)) self.fillColor.setWhatsThis(QtGui.QApplication.translate("ToolBox", "You don\'t care", None, QtGui.QApplication.UnicodeUTF8)) self.fillColor.setObjectName(_fromUtf8("fillColor")) self.verticalLayout_5.addWidget(self.fillColor) self.formLayout_3 = QtGui.QFormLayout() self.formLayout_3.setSizeConstraint(QtGui.QLayout.SetMaximumSize) self.formLayout_3.setFieldGrowthPolicy(QtGui.QFormLayout.AllNonFixedFieldsGrow) self.formLayout_3.setLabelAlignment(QtCore.Qt.AlignRight|QtCore.Qt.AlignTrailing|QtCore.Qt.AlignVCenter) self.formLayout_3.setFormAlignment(QtCore.Qt.AlignRight|QtCore.Qt.AlignTop|QtCore.Qt.AlignTrailing) self.formLayout_3.setContentsMargins(9, 0, 9, 9) self.formLayout_3.setHorizontalSpacing(22) self.formLayout_3.setVerticalSpacing(9) self.formLayout_3.setObjectName(_fromUtf8("formLayout_3")) self.label_8 = QtGui.QLabel(self.scrollAreaWidgetContents_3) self.label_8.setText(QtGui.QApplication.translate("ToolBox", "Current Color:", None, QtGui.QApplication.UnicodeUTF8)) self.label_8.setObjectName(_fromUtf8("label_8")) self.formLayout_3.setWidget(0, QtGui.QFormLayout.LabelRole, self.label_8) self.fillColorLabel = QtGui.QLabel(self.scrollAreaWidgetContents_3) self.fillColorLabel.setMinimumSize(QtCore.QSize(0, 0)) self.fillColorLabel.setMaximumSize(QtCore.QSize(16777215, 16777215)) self.fillColorLabel.setLayoutDirection(QtCore.Qt.LeftToRight) self.fillColorLabel.setStyleSheet(_fromUtf8("QLabel {\n" " border: 1px solid black;\n" "}")) self.fillColorLabel.setText(_fromUtf8("")) self.fillColorLabel.setAlignment(QtCore.Qt.AlignRight|QtCore.Qt.AlignTrailing|QtCore.Qt.AlignVCenter) self.fillColorLabel.setObjectName(_fromUtf8("fillColorLabel")) self.formLayout_3.setWidget(0, QtGui.QFormLayout.FieldRole, self.fillColorLabel) self.label_9 = QtGui.QLabel(self.scrollAreaWidgetContents_3) self.label_9.setAutoFillBackground(False) self.label_9.setText(QtGui.QApplication.translate("ToolBox", "Fill Enabled:", None, QtGui.QApplication.UnicodeUTF8)) self.label_9.setAlignment(QtCore.Qt.AlignRight|QtCore.Qt.AlignTrailing|QtCore.Qt.AlignVCenter) self.label_9.setObjectName(_fromUtf8("label_9")) self.formLayout_3.setWidget(1, QtGui.QFormLayout.LabelRole, self.label_9) self.shouldFillCheckbox = QtGui.QCheckBox(self.scrollAreaWidgetContents_3) self.shouldFillCheckbox.setLayoutDirection(QtCore.Qt.RightToLeft) self.shouldFillCheckbox.setAutoFillBackground(False) self.shouldFillCheckbox.setText(_fromUtf8("")) self.shouldFillCheckbox.setObjectName(_fromUtf8("shouldFillCheckbox")) self.formLayout_3.setWidget(1, QtGui.QFormLayout.FieldRole, self.shouldFillCheckbox) self.verticalLayout_5.addLayout(self.formLayout_3) self.verticalLayout_12.addLayout(self.verticalLayout_5) self.scrollArea_3.setWidget(self.scrollAreaWidgetContents_3) self.verticalLayout_9.addWidget(self.scrollArea_3) ToolBox.addItem(self.strokeFillPage, icon3, _fromUtf8("")) self.fontPage = QtGui.QWidget() self.fontPage.setGeometry(QtCore.QRect(0, 0, 436, 389)) self.fontPage.setObjectName(_fromUtf8("fontPage")) self.verticalLayout_6 = QtGui.QVBoxLayout(self.fontPage) self.verticalLayout_6.setMargin(1) self.verticalLayout_6.setObjectName(_fromUtf8("verticalLayout_6")) self.scrollArea_4 = QtGui.QScrollArea(self.fontPage) self.scrollArea_4.setMinimumSize(QtCore.QSize(0, 0)) self.scrollArea_4.setStyleSheet(_fromUtf8("QScrollArea::title { \n" " background-color: transparent;\n" " subcontrol-position: top left; /* position at the top left*/ \n" " padding:2 13px;\n" " } \n" "\n" "QScrollArea { \n" " border: 2px solid gray;\n" " background-color: lightgray;\n" " border-radius: 5px; \n" " } \n" "")) self.scrollArea_4.setWidgetResizable(True) self.scrollArea_4.setObjectName(_fromUtf8("scrollArea_4")) self.scrollAreaWidgetContents_4 = QtGui.QWidget() self.scrollAreaWidgetContents_4.setGeometry(QtCore.QRect(0, 0, 430, 383)) self.scrollAreaWidgetContents_4.setMinimumSize(QtCore.QSize(180, 0)) self.scrollAreaWidgetContents_4.setObjectName(_fromUtf8("scrollAreaWidgetContents_4")) self.verticalLayout_8 = QtGui.QVBoxLayout(self.scrollAreaWidgetContents_4) self.verticalLayout_8.setMargin(1) self.verticalLayout_8.setObjectName(_fromUtf8("verticalLayout_8")) self.fontWidget = FontWidget(self.scrollAreaWidgetContents_4) self.fontWidget.setToolTip(QtGui.QApplication.translate("ToolBox", "Custom widget", None, QtGui.QApplication.UnicodeUTF8)) self.fontWidget.setWhatsThis(QtGui.QApplication.translate("ToolBox", "You don\'t care", None, QtGui.QApplication.UnicodeUTF8)) self.fontWidget.setObjectName(_fromUtf8("fontWidget")) self.verticalLayout_8.addWidget(self.fontWidget) self.scrollArea_4.setWidget(self.scrollAreaWidgetContents_4) self.verticalLayout_6.addWidget(self.scrollArea_4) icon4 = QtGui.QIcon() icon4.addPixmap(QtGui.QPixmap(_fromUtf8(":/icons/resources/icons/tool-icons/text.png")), QtGui.QIcon.Normal, QtGui.QIcon.Off) ToolBox.addItem(self.fontPage, icon4, _fromUtf8("")) self.usersPage = QtGui.QWidget() self.usersPage.setGeometry(QtCore.QRect(0, 0, 436, 389)) self.usersPage.setObjectName(_fromUtf8("usersPage")) self.verticalLayout_10 = QtGui.QVBoxLayout(self.usersPage) self.verticalLayout_10.setSpacing(6) self.verticalLayout_10.setMargin(2) self.verticalLayout_10.setObjectName(_fromUtf8("verticalLayout_10")) self.scrollArea_5 = QtGui.QScrollArea(self.usersPage) self.scrollArea_5.setWidgetResizable(True) self.scrollArea_5.setObjectName(_fromUtf8("scrollArea_5")) self.scrollAreaWidgetContents_5 = QtGui.QWidget() self.scrollAreaWidgetContents_5.setGeometry(QtCore.QRect(0, 0, 430, 383)) self.scrollAreaWidgetContents_5.setObjectName(_fromUtf8("scrollAreaWidgetContents_5")) self.verticalLayout_11 = QtGui.QVBoxLayout(self.scrollAreaWidgetContents_5) self.verticalLayout_11.setMargin(2) self.verticalLayout_11.setObjectName(_fromUtf8("verticalLayout_11")) self.treeView = QtGui.QTreeView(self.scrollAreaWidgetContents_5) self.treeView.setSortingEnabled(True) self.treeView.setAnimated(True) self.treeView.setObjectName(_fromUtf8("treeView")) self.treeView.header().setDefaultSectionSize(0) self.verticalLayout_11.addWidget(self.treeView) self.scrollArea_5.setWidget(self.scrollAreaWidgetContents_5) self.verticalLayout_10.addWidget(self.scrollArea_5) icon5 = QtGui.QIcon() icon5.addPixmap(QtGui.QPixmap(_fromUtf8(":/icons/resources/icons/app-icons/users.png")), QtGui.QIcon.Normal, QtGui.QIcon.Off) ToolBox.addItem(self.usersPage, icon5, _fromUtf8("")) self.chatPage = QtGui.QWidget() self.chatPage.setGeometry(QtCore.QRect(0, 0, 436, 389)) self.chatPage.setObjectName(_fromUtf8("chatPage")) self.verticalLayout_16 = QtGui.QVBoxLayout(self.chatPage) self.verticalLayout_16.setMargin(1) self.verticalLayout_16.setObjectName(_fromUtf8("verticalLayout_16")) self.dockWidget = QtGui.QDockWidget(self.chatPage) self.dockWidget.setObjectName(_fromUtf8("dockWidget")) self.dockWidgetContents = QtGui.QWidget() self.dockWidgetContents.setObjectName(_fromUtf8("dockWidgetContents")) self.verticalLayout_7 = QtGui.QVBoxLayout(self.dockWidgetContents) self.verticalLayout_7.setObjectName(_fromUtf8("verticalLayout_7")) self.chatWidget = ChatWidget(self.dockWidgetContents) self.chatWidget.setToolTip(QtGui.QApplication.translate("ToolBox", "Custom widget", None, QtGui.QApplication.UnicodeUTF8)) self.chatWidget.setWhatsThis(QtGui.QApplication.translate("ToolBox", "You don\'t care", None, QtGui.QApplication.UnicodeUTF8)) self.chatWidget.setObjectName(_fromUtf8("chatWidget")) self.verticalLayout_7.addWidget(self.chatWidget) self.dockWidget.setWidget(self.dockWidgetContents) self.verticalLayout_16.addWidget(self.dockWidget) icon6 = QtGui.QIcon() icon6.addPixmap(QtGui.QPixmap(_fromUtf8(":/icons/resources/icons/app-icons/chat.png")), QtGui.QIcon.Normal, QtGui.QIcon.Off) ToolBox.addItem(self.chatPage, icon6, _fromUtf8("")) self.actionCapSquare = QtGui.QAction(ToolBox) self.actionCapSquare.setCheckable(True) icon7 = QtGui.QIcon() icon7.addPixmap(QtGui.QPixmap(_fromUtf8(":/icons/resources/icons/app-icons/capsquare.png")), QtGui.QIcon.Normal, QtGui.QIcon.Off) self.actionCapSquare.setIcon(icon7) self.actionCapSquare.setText(QtGui.QApplication.translate("ToolBox", "capSquare", None, QtGui.QApplication.UnicodeUTF8)) self.actionCapSquare.setObjectName(_fromUtf8("actionCapSquare")) self.actionCapRound = QtGui.QAction(ToolBox) self.actionCapRound.setCheckable(True) icon8 = QtGui.QIcon() icon8.addPixmap(QtGui.QPixmap(_fromUtf8(":/icons/resources/icons/app-icons/capround.png")), QtGui.QIcon.Normal, QtGui.QIcon.Off) self.actionCapRound.setIcon(icon8) self.actionCapRound.setText(QtGui.QApplication.translate("ToolBox", "capRound", None, QtGui.QApplication.UnicodeUTF8)) self.actionCapRound.setObjectName(_fromUtf8("actionCapRound")) self.actionCapFlat = QtGui.QAction(ToolBox) self.actionCapFlat.setCheckable(True) icon9 = QtGui.QIcon() icon9.addPixmap(QtGui.QPixmap(_fromUtf8(":/icons/resources/icons/app-icons/capbutt.png")), QtGui.QIcon.Normal, QtGui.QIcon.Off) self.actionCapFlat.setIcon(icon9) self.actionCapFlat.setText(QtGui.QApplication.translate("ToolBox", "capFlat", None, QtGui.QApplication.UnicodeUTF8)) self.actionCapFlat.setObjectName(_fromUtf8("actionCapFlat")) self.actionJoinRound = QtGui.QAction(ToolBox) self.actionJoinRound.setCheckable(True) icon10 = QtGui.QIcon() icon10.addPixmap(QtGui.QPixmap(_fromUtf8(":/icons/resources/icons/app-icons/joinround.png")), QtGui.QIcon.Normal, QtGui.QIcon.Off) self.actionJoinRound.setIcon(icon10) self.actionJoinRound.setText(QtGui.QApplication.translate("ToolBox", "joinRound", None, QtGui.QApplication.UnicodeUTF8)) self.actionJoinRound.setObjectName(_fromUtf8("actionJoinRound")) self.actionJoinMiter = QtGui.QAction(ToolBox) self.actionJoinMiter.setCheckable(True) icon11 = QtGui.QIcon() icon11.addPixmap(QtGui.QPixmap(_fromUtf8(":/icons/resources/icons/app-icons/joinmiter.png")), QtGui.QIcon.Normal, QtGui.QIcon.Off) self.actionJoinMiter.setIcon(icon11) self.actionJoinMiter.setText(QtGui.QApplication.translate("ToolBox", "joinMiter", None, QtGui.QApplication.UnicodeUTF8)) self.actionJoinMiter.setObjectName(_fromUtf8("actionJoinMiter")) self.actionJoinBevel = QtGui.QAction(ToolBox) self.actionJoinBevel.setCheckable(True) icon12 = QtGui.QIcon() icon12.addPixmap(QtGui.QPixmap(_fromUtf8(":/icons/resources/icons/app-icons/joinbevel.png")), QtGui.QIcon.Normal, QtGui.QIcon.Off) self.actionJoinBevel.setIcon(icon12) self.actionJoinBevel.setText(QtGui.QApplication.translate("ToolBox", "joinBevel", None, QtGui.QApplication.UnicodeUTF8)) self.actionJoinBevel.setObjectName(_fromUtf8("actionJoinBevel")) self.actionStrokeColor = QtGui.QAction(ToolBox) self.actionStrokeColor.setIcon(icon3) self.actionStrokeColor.setText(QtGui.QApplication.translate("ToolBox", "strokeColor", None, QtGui.QApplication.UnicodeUTF8)) self.actionStrokeColor.setObjectName(_fromUtf8("actionStrokeColor")) self.actionFillColor = QtGui.QAction(ToolBox) self.actionFillColor.setIcon(icon3) self.actionFillColor.setText(QtGui.QApplication.translate("ToolBox", "fillColor", None, QtGui.QApplication.UnicodeUTF8)) self.actionFillColor.setObjectName(_fromUtf8("actionFillColor")) self.actionShouldFill = QtGui.QAction(ToolBox) self.actionShouldFill.setCheckable(True) self.actionShouldFill.setText(QtGui.QApplication.translate("ToolBox", "shouldFill", None, QtGui.QApplication.UnicodeUTF8)) self.actionShouldFill.setObjectName(_fromUtf8("actionShouldFill")) self.actionShouldStroke = QtGui.QAction(ToolBox) self.actionShouldStroke.setCheckable(True) self.actionShouldStroke.setText(QtGui.QApplication.translate("ToolBox", "shouldStroke", None, QtGui.QApplication.UnicodeUTF8)) self.actionShouldStroke.setObjectName(_fromUtf8("actionShouldStroke")) self.actionWidthChange = QtGui.QAction(ToolBox) self.actionWidthChange.setText(QtGui.QApplication.translate("ToolBox", "widthChange", None, QtGui.QApplication.UnicodeUTF8)) self.actionWidthChange.setObjectName(_fromUtf8("actionWidthChange")) self.actionDashSet = QtGui.QAction(ToolBox) self.actionDashSet.setText(QtGui.QApplication.translate("ToolBox", "dashSet", None, QtGui.QApplication.UnicodeUTF8)) self.actionDashSet.setObjectName(_fromUtf8("actionDashSet")) self.actionDashPhaseChange = QtGui.QAction(ToolBox) self.actionDashPhaseChange.setText(QtGui.QApplication.translate("ToolBox", "dashPhaseChange", None, QtGui.QApplication.UnicodeUTF8)) self.actionDashPhaseChange.setObjectName(_fromUtf8("actionDashPhaseChange")) self.actionFontStyleBold = QtGui.QAction(ToolBox) self.actionFontStyleBold.setCheckable(True) icon13 = QtGui.QIcon() icon13.addPixmap(QtGui.QPixmap(_fromUtf8(":/icons/resources/icons/app-icons/bold.png")), QtGui.QIcon.Normal, QtGui.QIcon.Off) self.actionFontStyleBold.setIcon(icon13) self.actionFontStyleBold.setText(QtGui.QApplication.translate("ToolBox", "fontStyleBold", None, QtGui.QApplication.UnicodeUTF8)) self.actionFontStyleBold.setObjectName(_fromUtf8("actionFontStyleBold")) self.actionFontStyleItalic = QtGui.QAction(ToolBox) self.actionFontStyleItalic.setCheckable(True) icon14 = QtGui.QIcon() icon14.addPixmap(QtGui.QPixmap(_fromUtf8(":/icons/resources/icons/app-icons/italic.png")), QtGui.QIcon.Normal, QtGui.QIcon.Off) self.actionFontStyleItalic.setIcon(icon14) self.actionFontStyleItalic.setText(QtGui.QApplication.translate("ToolBox", "fontStyleItalic", None, QtGui.QApplication.UnicodeUTF8)) self.actionFontStyleItalic.setObjectName(_fromUtf8("actionFontStyleItalic")) self.actionFontFamilySet = QtGui.QAction(ToolBox) self.actionFontFamilySet.setIcon(icon4) self.actionFontFamilySet.setText(QtGui.QApplication.translate("ToolBox", "fontFamilySet", None, QtGui.QApplication.UnicodeUTF8)) self.actionFontFamilySet.setObjectName(_fromUtf8("actionFontFamilySet")) self.actionFontSizeSet = QtGui.QAction(ToolBox) self.actionFontSizeSet.setText(QtGui.QApplication.translate("ToolBox", "fontSizeSet", None, QtGui.QApplication.UnicodeUTF8)) self.actionFontSizeSet.setObjectName(_fromUtf8("actionFontSizeSet")) self.actionChangeCharCounter = QtGui.QAction(ToolBox) self.actionChangeCharCounter.setText(QtGui.QApplication.translate("ToolBox", "changeCharCounter", None, QtGui.QApplication.UnicodeUTF8)) self.actionChangeCharCounter.setObjectName(_fromUtf8("actionChangeCharCounter")) self.retranslateUi(ToolBox) ToolBox.setCurrentIndex(6) QtCore.QObject.connect(self.shouldFillCheckbox, QtCore.SIGNAL(_fromUtf8("toggled(bool)")), self.actionShouldFill.toggle) QtCore.QObject.connect(self.strokeColor, QtCore.SIGNAL(_fromUtf8("colorChanged(QColor)")), ToolBox.strokeColorChanged) QtCore.QObject.connect(self.fillColor, QtCore.SIGNAL(_fromUtf8("colorChanged(QColor)")), ToolBox.fillColorChanged) QtCore.QObject.connect(self.shouldStrokeCheckbox, QtCore.SIGNAL(_fromUtf8("toggled(bool)")), self.actionShouldStroke.toggle) QtCore.QMetaObject.connectSlotsByName(ToolBox)
class plasmaVolume(plasmascript.Applet): closeApplet = pyqtSignal() killThread = pyqtSignal() refresh = pyqtSignal() refreshByDP = pyqtSignal() def __init__(self,parent,args=None): plasmascript.Applet.__init__(self,parent) def _initColor(self): self.fontColourVar = self.initValue('fontColour') self.sliderColour1Var = self.initValue('sliderColour1', 1355022335) self.sliderColour2Var = self.initValue('sliderColour2', 1355022335) self.handlerColourVar = self.initValue('handlerColour', 1355022335) style_horiz = STYLE_HORYZ style_vert = STYLE_VERT sliderColour1 = ColorWidget(self).getRGBaStyle((QString(self.sliderColour1Var).toUInt()[0], True), 'slider') sliderColour2 = ColorWidget(self).getRGBaStyle((QString(self.sliderColour2Var).toUInt()[0], True), 'slider') handlerColour = ColorWidget(self).getRGBaStyle((QString(self.handlerColourVar).toUInt()[0], True), 'slider') #print sliderColour1, sliderColour2, handlerColour style_horiz = style_horiz.replace("#FFF777", sliderColour1) style_vert = style_vert.replace("#FFF777", sliderColour1) style_horiz = style_horiz.replace("#2277FF", sliderColour2) style_vert = style_vert.replace("#2277FF", sliderColour2) style_horiz = style_horiz.replace("#CCCCCC", handlerColour) style_vert = style_vert.replace("#CCCCCC", handlerColour) return style_horiz, style_vert def initColor(self): self.style_horiz, self.style_vert = self._initColor() def _initSize(self, style_horiz = STYLE_HORYZ, style_vert = STYLE_VERT): self.Settings.beginGroup("Size") self.marginVar = self.Settings.value('Margin', 3).toString() self.thicknessVar = self.Settings.value('Thickness', 5).toString() self.handlerThicknessVar = self.Settings.value('HThickness', 5).toString() self.handlerLedgeVar = self.Settings.value('HLedge', 3).toString() self.Settings.endGroup() style_horiz = style_horiz.replace("__MARGIN__", self.marginVar) style_vert = style_vert.replace("__MARGIN__", self.marginVar) style_horiz = style_horiz.replace("__THICK__", self.thicknessVar) style_vert = style_vert.replace("__THICK__", self.thicknessVar) style_horiz = style_horiz.replace("__HTHICK__", self.handlerThicknessVar) style_vert = style_vert.replace("__HTHICK__", self.handlerThicknessVar) style_horiz = style_horiz.replace("__HLEDGE__", self.handlerLedgeVar) style_vert = style_vert.replace("__HLEDGE__", self.handlerLedgeVar) return style_horiz, style_vert def initSize(self): self.style_horiz, self.style_vert = \ self._initSize(self.style_horiz, self.style_vert) def initSensitivityVariable(self): if self.config().hasKey("Sensitivity") : data_ = self.config().readEntry("Sensitivity") value, state = data_.toInt() if not state : value = 100 else : value = 100 if value<100 : s = -1*( 2 + int(float(100-value)/33) ) else : s = 1 + int(float(value-100)/25) self.sensitivity = s def initSlidersRange(self): self.sliderMaxValue = 100 self.sliderMinValue = 0 if self.sensitivity > 1 : self.sliderMaxValue = int(100.0/self.sensitivity) elif self.sensitivity < 1 : self.sliderMaxValue = abs(100*self.sensitivity) def initValue(self, key_, default = '0'): if self.Settings.contains(key_) : #print key_, Settings.value(key_).toString() return self.Settings.value(key_).toString() else : if default == '0' : default = ColorWidget(self).getSystemColor('int') self.Settings.setValue(key_, QVariant(default)) #print key_, Settings.value(key_).toString() return default def init(self): self.setImmutability(Plasma.Mutable) #s = '' #for i in xrange(60) : s += '*' #print s #print 'New init in: ', time.strftime("%Y_%m_%d_%H:%M:%S", time.localtime()) #print [str(s) for s in self.config().keyList()], ' ALSA Devices' self.Flag = T(self) self.setHasConfigurationInterface(True) self.Settings = QSettings('plasmaVolume','plasmaVolume') self.panelDevices = self.Settings.value('PanelDevices').toString().split(',') self.panelDevices.removeAll('') self.connect(self.applet, SIGNAL('destroyed()'), self.down) self.closeApplet.connect(self._close) self.killThread.connect(self.stopWaitingVolumeChange) self.refresh.connect(self.refreshData) self.refreshByDP.connect(self.refreshByDevicePanel) self.applet.geometryChanged.connect(self._resizeEvent) self._icon = QIcon().fromTheme('preferences-desktop-sound') self.initIcon() self.Dialog = Plasma.Dialog() self.Dialog.setAspectRatioMode(Plasma.IgnoreAspectRatio) self.Dialog.setResizeHandleCorners( Plasma.Dialog.ResizeCorner(2) ) self.Dialog.layout = QGridLayout() global warningMsg if warningMsg != '' : self.layout = QGraphicsLinearLayout() labelMsg = Plasma.Label() Msg = 'Error : ' + str(warningMsg) + '.<br>Please, install necessary packet.' labelMsg.setText("<font color=red><b>" + Msg + "</b></font>") labelMsg.setToolTip(Msg) self.layout.addItem(labelMsg) self.setLayout(self.layout) self.notification("<font color=red><b>" + Msg + "</b></font>") else: self.Timer = QTimer() self.initContent() self.showPanelDevices() if not len(self.listAllDevices) : self.notification("Audio devices not found.") self.setLayout(self.layout) def initIcon(self): self.layout = QGraphicsLinearLayout(self.applet) self.layout.setContentsMargins(1, 1, 1, 1) self.layout.setSpacing(0) self.layout.setMinimumSize(10.0, 10.0) self.layoutSliders = QGraphicsGridLayout() self.layoutSliders.setSpacing(0) self.icon = Plasma.IconWidget() self.icon.setIcon(self._icon) self.icon.setToolTip('ALSA Volume Control') self.connect(self.icon, SIGNAL('clicked()'), self.showSliders) self.icon.setMaximumSize(40.0, 40.0) def startWaitingVolumeChange(self): if len(self.listAllDevices) and not self.Flag.isRunning() : self.Flag.Key = True self.Flag.start() def stopWaitingVolumeChange(self): if self.Flag.isRunning() : self.Flag.stop() def initContent(self): self.initColor() self.initSize() self.initSensitivityVariable() self.initSlidersRange() if hasattr(self, 'Dialog') : del self.Dialog self.Dialog = QWidget() self.Dialog.layout = QGridLayout() if hasattr(self, 'sliderHandle') : del self.sliderHandle if hasattr(self, 'label') : del self.label if hasattr(self, 'ao') : del self.ao if hasattr(self, 'listAllDevices') : del self.listAllDevices if hasattr(self, 'Scroll') : del self.Scroll if hasattr(self, 'ScrollWidget') : del self.ScrollWidget self.Scroll = QScrollArea() fontStyle = ColorWidget(self).getRGBaStyle((QString(self.fontColourVar).toUInt()[0], True)) iconPath = QIcon().fromTheme('view-refresh') self.rescanDevices = QPushButton(iconPath, '') #self.rescanDevices.setStyleSheet(fontStyle) self.rescanDevices.setToolTip('Rescan') self.rescanDevices.clicked.connect(self.rescan) self.panelNameLabel = QLabel('<b><u>Common Device Panel</u></b>') self.panelNameLabel.setStyleSheet(fontStyle) self.Dialog.layout.addWidget(self.panelNameLabel,0,1) self.Dialog.layout.addWidget(self.rescanDevices,0,2) self.sliderHandle = [] self.label = [] self.ao = [] i = 0 self.listAllDevices = [] cardList = alsaaudio.cards() cardIndexList = [] for card in xrange(100) : try: if alsaaudio.mixers(card) : cardIndexList.append(card) #print card, alsaaudio.mixers(card), cardList[i]; i += 1 except alsaaudio.ALSAAudioError : #print card, ' error' pass finally : pass i = 0 for card in cardIndexList : try: for audioDevice in alsaaudio.mixers(card) : self.listAllDevices.append((audioDevice, card, cardList[i])) except alsaaudio.ALSAAudioError : #print card, ' error' pass finally : i += 1 #print self.listAllDevices i = 0 for audioDevice in self.listAllDevices : name = str(audioDevice[0]) cardIndex = audioDevice[1] card = audioDevice[2] #print name, cardIndex, card self.ao.append(AudioOutput(name, self, i, cardIndex)) if not ( self.ao[i].capability in ([], ['']) ) : self.sliderHandle.append(QSlider(Qt.Horizontal)) self.sliderHandle[i].setTickPosition(QSlider.TicksBelow) self.sliderHandle[i].name = name + ' \\ ' + card self.sliderHandle[i].setRange(self.sliderMinValue, self.sliderMaxValue) self.ao[i].initSliderValues() self.Dialog.layout.addWidget(self.sliderHandle[i],i+1,5) self.sliderHandle[i].valueChanged.connect(self.ao[i].receiveValueFromSlider) self.label.append(name) self.label[i] = QLabel('<b><i>' + name + ' \\ ' + card + '</i></b>') self.label[i].setStyleSheet(fontStyle) self.label[i].setToolTip(name) self.Dialog.layout.addWidget(self.label[i],i+1,1) if not (self.ao[i].Mute_ is None) : self.Dialog.layout.addWidget(self.ao[i].Mute_,i+1,2) self.ao[i].Mute_.clicked.connect(self.ao[i].changeMuteState) self.connect(self, SIGNAL('changed()'), self.ao[i].receiveVolumeFromDevice) self.connect(self, SIGNAL('changed()'), self.ao[i].receiveVolumeFromDevice) else: self.label.append('') self.sliderHandle.append('') #print name, cardIndex, card, 'not capability' i += 1 self.Dialog.setLayout(self.Dialog.layout) self.Scroll.setWidgetResizable(True) self.Scroll.setWidget(self.Dialog) self.ScrollWidget = Plasma.Dialog() self.ScrollWidget.layout = QGridLayout() self.ScrollWidget.layout.addWidget(self.Scroll, 0, 0) self.ScrollWidget.setMaximumHeight(650) self.ScrollWidget.setMinimumSize(350, 350) self.ScrollWidget.setLayout(self.ScrollWidget.layout) self.ScrollWidget.setAspectRatioMode(Plasma.IgnoreAspectRatio) self.ScrollWidget.setResizeHandleCorners( Plasma.Dialog.ResizeCorner(6) ) def showPanelDevices(self): if not (self.layoutSliders is None) : if hasattr(self, 'sliderHPlasma') : del self.sliderHPlasma del self.layoutSliders if not (self.layout is None) : self.layout.removeItem(self.icon) del self.layout self.initIcon() if self.Settings.value('Icon_On').toString() == '1'\ or self.panelDevices.isEmpty() : self.layout.addItem(self.icon) self.icon.show() if self.Settings.value('Vertical::widgetOrientation').toString() == '1': oriental_ = Qt.Horizontal style_ = self.style_horiz if self.formFactor() == Plasma.Horizontal : self.setMaximumWidth(35) elif self.formFactor() in (Plasma.Planar, Plasma.MediaCenter) : pass else: oriental_ = Qt.Vertical style_ = self.style_vert if self.formFactor() == Plasma.Vertical : self.setMaximumHeight(35) elif self.formFactor() in (Plasma.Planar, Plasma.MediaCenter) : pass i = 0 self.sliderHPlasma = [] # print self.panelDevices, '---' for slider in self.sliderHandle: if (type(slider) is not str): sliderName = slider.name if sliderName in self.panelDevices: ## ["Master","PCM","Front","Line"]: if self.ao[i].capability != [] : # print sliderName,'--' self.sliderHPlasma.append(Plasma.Slider()) self.sliderHPlasma[i].setOrientation(oriental_) self.sliderHPlasma[i].setToolTip(sliderName) self.sliderHPlasma[i].name = sliderName self.sliderHPlasma[i].setStyleSheet(style_) self.sliderHPlasma[i].setRange(self.sliderMinValue, self.sliderMaxValue) self.sliderHPlasma[i].mouseDoubleClickEvent = self.mouseDoubleClickEvent self.sliderHPlasma[i].mouseReleaseEvent = self.mouseReleaseEvent self.ao[i].initSliderValues() if oriental_ == Qt.Vertical: self.layoutSliders.addItem(self.sliderHPlasma[i], 0, i) else: self.layoutSliders.addItem(self.sliderHPlasma[i], i, 0) self.sliderHPlasma[i].valueChanged.connect(self.ao[i].receiveValueFromSlider) else: self.sliderHPlasma.append('') else: self.sliderHPlasma.append('') else: self.sliderHPlasma.append('') i += 1 self.layout.addItem(self.layoutSliders) self.setLayout(self.layout) self.Timer.singleShot(2000, self.startWaitingVolumeChange) def showSliders(self): if self.ScrollWidget.isVisible(): self.ScrollWidget.close() self.writeParameters() else: self.ScrollWidget.show() self.ScrollWidget.move(self.popupPosition(self.ScrollWidget.sizeHint())) ##Dialog def createConfigurationInterface(self, parent): self.selectDevice = DevicePanel(self, parent) parent.addPage(self.selectDevice,"Panel Devices") self.interfaceSettings = InterfaceSettings(self, parent) parent.addPage(self.interfaceSettings, 'Interface') self.sizeSelect = SizeWidget(self, parent) parent.addPage(self.sizeSelect, "Size") self.colorSelect = ColorWidget(self, parent) parent.addPage(self.colorSelect, "Color") self.connect(parent, SIGNAL("okClicked()"), self.configAccepted) self.connect(parent, SIGNAL("cancelClicked()"), self.configDenied) def showConfigurationInterface(self): dialog = KPageDialog() dialog.setModal(True) dialog.setFaceType(KPageDialog.List) dialog.setButtons( KDialog.ButtonCode(KDialog.Ok | KDialog.Cancel) ) self.createConfigurationInterface(dialog) dialog.exec_() dialog.move(self.popupPosition(dialog.sizeHint())) def rescan(self): self.ScrollWidget.close() self.initContent() self.showPanelDevices() self.showSliders() if not len(self.listAllDevices) : self.notification("Audio devices not found.") def refreshByDevicePanel(self): self.initContent() self.showPanelDevices() self.showConfigurationInterface() if not len(self.listAllDevices) : self.notification("Audio devices not found.") def refreshData(self): self.Settings.sync() self.initContent() self.showPanelDevices() def configAccepted(self): self.stopWaitingVolumeChange() self.selectDevice.refreshPanelDevices(self) self.interfaceSettings.refreshInterfaceSettings() self.colorSelect.refreshInterfaceSettings() self.sizeSelect.refreshInterfaceSettings() self.refresh.emit() def configDenied(self): pass def writeParameters(self): if hasattr(self, 'listAllDevices') : for i in xrange(len(self.listAllDevices)) : try : if self.ao[i].capability != [] : muteStat = self.ao[i].MuteStat if hasattr(self.ao[i], 'MuteStat') else -1 #s = (self.ao[i].mix, self.ao[i].capability, self.ao[i].oldValue, muteStat) #print '\t%s\t%s\n\t%s\t%s' % s data = QStringList() << str(self.ao[i].oldValue[0]) << str(muteStat) self.config().writeEntry(self.ao[i].mix, data) except Exception, x : #print x pass finally : pass self.config().sync() self.notification('Parameters are saved.')