Changeset View
Changeset View
Standalone View
Standalone View
plugins/python/assignprofiledialog/assignprofiledialog.py
1 | ''' | 1 | # This script is licensed CC 0 1.0, so that you can learn from it. | ||
---|---|---|---|---|---|
2 | This script is licensed CC 0 1.0, so that you can learn from it. | | |||
3 | 2 | | |||
4 | ------ CC 0 1.0 --------------- | 3 | # ------ CC 0 1.0 --------------- | ||
5 | 4 | | |||
6 | The person who associated a work with this deed has dedicated the work to the public domain by waiving all of his or her rights to the work worldwide under copyright law, including all related and neighboring rights, to the extent allowed by law. | 5 | # The person who associated a work with this deed has dedicated the | ||
6 | # work to the public domain by waiving all of his or her rights to the | ||||
7 | # work worldwide under copyright law, including all related and | ||||
8 | # neighboring rights, to the extent allowed by law. | ||||
7 | 9 | | |||
8 | You can copy, modify, distribute and perform the work, even for commercial purposes, all without asking permission. | 10 | # You can copy, modify, distribute and perform the work, even for | ||
11 | # commercial purposes, all without asking permission. | ||||
12 | | ||||
13 | # https://creativecommons.org/publicdomain/zero/1.0/legalcode | ||||
9 | 14 | | |||
10 | https://creativecommons.org/publicdomain/zero/1.0/legalcode | | |||
11 | ''' | | |||
12 | from PyQt5.QtCore import Qt | 15 | from PyQt5.QtCore import Qt | ||
13 | from PyQt5.QtWidgets import (QDialogButtonBox, QDialog, | 16 | from PyQt5.QtWidgets import (QDialogButtonBox, QDialog, | ||
14 | QMessageBox, QComboBox, QVBoxLayout) | 17 | QMessageBox, QComboBox, QVBoxLayout) | ||
Context not available. | |||||
23 | def assignProfile(self): | 26 | def assignProfile(self): | ||
24 | doc = Application.activeDocument() | 27 | doc = Application.activeDocument() | ||
25 | if doc is None: | 28 | if doc is None: | ||
26 | QMessageBox.information(Application.activeWindow().qwindow(), i18n("Assign Profile"), i18n("There is no active document.")) | 29 | QMessageBox.information( | ||
30 | Application.activeWindow().qwindow(), | ||||
31 | i18n("Assign Profile"), | ||||
32 | i18n("There is no active document.")) | ||||
27 | return | 33 | return | ||
28 | 34 | | |||
29 | self.dialog = QDialog(Application.activeWindow().qwindow()) | 35 | self.dialog = QDialog(Application.activeWindow().qwindow()) | ||
30 | 36 | | |||
31 | self.cmbProfile = QComboBox(self.dialog) | 37 | self.cmbProfile = QComboBox(self.dialog) | ||
32 | for profile in sorted(Application.profiles(doc.colorModel(), doc.colorDepth())): | 38 | for profile in sorted( | ||
39 | Application.profiles(doc.colorModel(), doc.colorDepth())): | ||||
33 | self.cmbProfile.addItem(profile) | 40 | self.cmbProfile.addItem(profile) | ||
34 | 41 | | |||
35 | vbox = QVBoxLayout(self.dialog) | 42 | vbox = QVBoxLayout(self.dialog) | ||
36 | vbox.addWidget(self.cmbProfile) | 43 | vbox.addWidget(self.cmbProfile) | ||
37 | self.buttonBox = QDialogButtonBox(self.dialog) | 44 | self.buttonBox = QDialogButtonBox(self.dialog) | ||
38 | self.buttonBox.setOrientation(Qt.Horizontal) | 45 | self.buttonBox.setOrientation(Qt.Horizontal) | ||
39 | self.buttonBox.setStandardButtons(QDialogButtonBox.Ok | QDialogButtonBox.Cancel) | 46 | self.buttonBox.setStandardButtons( | ||
47 | QDialogButtonBox.Ok | QDialogButtonBox.Cancel) | ||||
40 | self.buttonBox.accepted.connect(self.dialog.accept) | 48 | self.buttonBox.accepted.connect(self.dialog.accept) | ||
41 | self.buttonBox.accepted.connect(self.accept) | 49 | self.buttonBox.accepted.connect(self.accept) | ||
42 | self.buttonBox.rejected.connect(self.dialog.reject) | 50 | self.buttonBox.rejected.connect(self.dialog.reject) | ||
Context not available. | |||||
53 | pass | 61 | pass | ||
54 | 62 | | |||
55 | def createActions(self, window): | 63 | def createActions(self, window): | ||
56 | action = window.createAction("assing_profile_to_image", i18n("Assign Profile to Image")) | 64 | action = window.createAction("assing_profile_to_image", | ||
65 | i18n("Assign Profile to Image")) | ||||
57 | action.triggered.connect(self.assignProfile) | 66 | action.triggered.connect(self.assignProfile) | ||
58 | | ||||
59 | | ||||
60 | Scripter.addExtension(AssignProfileDialog(Application)) | | |||
Context not available. |