Sat, 01 Dec 2018 19:07:01 +0100
ProjectFormsBrowser: started implementing support for rcc compiler options
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/DTDs/Project-6.4.dtd Sat Dec 01 19:07:01 2018 +0100 @@ -0,0 +1,188 @@ +<!-- This is the DTD for eric's project file version 6.3 --> + +<!-- This is a copy of the Basic DTD --> +<!ELEMENT int (#PCDATA)> +<!ELEMENT long (#PCDATA)> +<!ELEMENT float (#PCDATA)> +<!ELEMENT complex (#PCDATA)> +<!ELEMENT bool (#PCDATA)> +<!ELEMENT string (#PCDATA)> +<!ELEMENT bytes (#PCDATA)> +<!ELEMENT bytearray (#PCDATA)> +<!ELEMENT none EMPTY> + +<!ELEMENT pickle (#PCDATA)> +<!ATTLIST pickle + method CDATA #REQUIRED + encoding CDATA #REQUIRED> + +<!ELEMENT key (int | long | float | complex | string | bytes)> +<!ELEMENT value (int | long | float | complex | bool | string | bytes | + bytearray | none | dict | tuple | list | set | frozenset | pickle)> + +<!ELEMENT dict (key, value)*> + +<!ELEMENT tuple (int | long | float | complex | bool | string | bytes | + bytearray | none | dict | tuple | list | set | frozenset | pickle)*> + +<!ELEMENT list (int | long | float | complex | bool | string | bytes | + bytearray | none | dict | tuple | list | set | frozenset | pickle)*> + +<!ELEMENT set (int | long | float | complex | bool | string | bytes | + bytearray | none | dict | tuple | list | set | frozenset | pickle)*> + +<!ELEMENT frozenset (int | long | float | complex | bool | string | bytes | + bytearray | none | dict | tuple | list | set | frozenset | pickle)*> +<!-- End of the Basic DTD --> + +<!ELEMENT ProgLanguage (#PCDATA)> +<!ATTLIST ProgLanguage + mixed CDATA #REQUIRED> + +<!ELEMENT ProjectType (#PCDATA)> + +<!ELEMENT Description (#PCDATA)> + +<!ELEMENT Version (#PCDATA)> + +<!ELEMENT Author (#PCDATA)> + +<!ELEMENT Email (#PCDATA)> + +<!ELEMENT TranslationPattern (#PCDATA)> + +<!ELEMENT TranslationsBinPath (#PCDATA)> + +<!ELEMENT Source (#PCDATA)> + +<!ELEMENT Sources (Source*)> + +<!ELEMENT Form (#PCDATA)> + +<!ELEMENT Forms (Form*)> + +<!ELEMENT Translation (#PCDATA)> + +<!ELEMENT Translations (Translation*)> + +<!ELEMENT TranslationException (#PCDATA)> + +<!ELEMENT TranslationExceptions (TranslationException*)> + +<!ELEMENT Resource (#PCDATA)> + +<!ELEMENT Resources (Resource*)> + +<!ELEMENT Interface (#PCDATA)> + +<!ELEMENT Interfaces (Interface*)> + +<!ELEMENT Protocol (#PCDATA)> + +<!ELEMENT Protocols (Protocol*)> + +<!ELEMENT Other (#PCDATA)> + +<!ELEMENT Others (Other*)> + +<!ELEMENT MainScript (#PCDATA)> + +<!ELEMENT VcsType (#PCDATA)> +<!ELEMENT VcsOptions (dict)> +<!ELEMENT VcsOtherData (dict)> + +<!ELEMENT Vcs (VcsType?, + VcsOptions?, + VcsOtherData?)> + +<!ELEMENT FiletypeAssociation EMPTY> +<!ATTLIST FiletypeAssociation + pattern CDATA #REQUIRED + type CDATA #REQUIRED> + +<!ELEMENT FiletypeAssociations (FiletypeAssociation*)> + +<!ELEMENT LexerAssociation EMPTY> +<!ATTLIST LexerAssociation + pattern CDATA #REQUIRED + lexer CDATA #REQUIRED> + +<!ELEMENT LexerAssociations (LexerAssociation*)> + +<!ELEMENT MakeParameters (dict)> + +<!ELEMENT Make (MakeParameters?)> + +<!ELEMENT IdlCompiler (IdlCompilerParameters?)> + +<!ELEMENT UicCompiler (UicCompilerParameters?)> + +<!ELEMENT RccCompiler (RccCompilerParameters?)> + +<!ELEMENT ProjectTypeSpecificData (dict)> + +<!ELEMENT ProjectTypeSpecific (ProjectTypeSpecific?)> + +<!ELEMENT DocumentationParams (dict)> + +<!ELEMENT Documentation (DocumentationParams?)> + +<!ELEMENT PackagersParams (dict)> + +<!ELEMENT Packagers (PackagersParams?)> + +<!ELEMENT CheckersParams (dict)> + +<!ELEMENT Checkers (CheckersParams?)> + +<!ELEMENT OtherToolsParams (dict)> + +<!ELEMENT OtherTools (OtherToolsParams?)> + +<!ELEMENT Language (#PCDATA)> + +<!ELEMENT ProjectWordList (#PCDATA)> + +<!ELEMENT ProjectExcludeList (#PCDATA)> + +<!ELEMENT Hash (#PCDATA)> + +<!ELEMENT Eol EMPTY> +<!ATTLIST Eol + index CDATA #REQUIRED> + +<!ELEMENT Project (Language, + ProjectWordList?, + ProjectExcludeList?, + Hash, + ProgLanguage, + ProjectType, + Description?, + Version?, + Author?, + Email?, + TranslationPattern?, + TranslationsBinPath?, + Eol?, + Sources, + Forms, + Translations, + TranslationExceptions?, + Resources, + Interfaces, + Others, + MainScript?, + Vcs, + FiletypeAssociations, + LexerAssociations?, + Make?, + IdlCompiler?, + UicCompiler?, + RccCompiler?, + ProjectTypeSpecific?, + Documentation?, + Packagers?, + Checkers?, + OtherTools?)> +<!ATTLIST Project + version CDATA #REQUIRED>
--- a/E5XML/Config.py Sat Dec 01 11:39:28 2018 +0100 +++ b/E5XML/Config.py Sat Dec 01 19:07:01 2018 +0100 @@ -11,7 +11,8 @@ multiProjectFileFormatVersion = "5.1" # version numbers of the project file -projectFileFormatVersion = "6.3" +projectFileFormatVersion = "6.4" +projectFileFormatVersionUic = "6.3" projectFileFormatVersionIdl = "6.2" projectFileFormatVersionMake = "6.1" projectFileFormatVersionProto = "6.0"
--- a/E5XML/ProjectReader.py Sat Dec 01 11:39:28 2018 +0100 +++ b/E5XML/ProjectReader.py Sat Dec 01 19:07:01 2018 +0100 @@ -19,7 +19,9 @@ """ Class for reading an XML project file. """ - supportedVersions = ["4.6", "5.0", "5.1", "6.0", "6.1", "6.2", "6.3"] + supportedVersions = ["4.6", + "5.0", "5.1", + "6.0", "6.1", "6.2", "6.3", "6.4"] def __init__(self, device, project): """ @@ -121,6 +123,9 @@ elif self.name() == "UicCompiler": self.__readBasicDataField( "UicCompiler", "UicCompilerParameters", "UICPARAMS") + elif self.name() == "RccCompiler": + self.__readBasicDataField( + "RccCompiler", "RccCompilerParameters", "RCCPARAMS") elif self.name() == "ProjectTypeSpecific": self.__readBasicDataField( "ProjectTypeSpecific", "ProjectTypeSpecificData",
--- a/E5XML/ProjectWriter.py Sat Dec 01 11:39:28 2018 +0100 +++ b/E5XML/ProjectWriter.py Sat Dec 01 19:07:01 2018 +0100 @@ -14,9 +14,9 @@ from E5Gui.E5Application import e5App from .XMLStreamWriterBase import XMLStreamWriterBase -from .Config import projectFileFormatVersion, projectFileFormatVersionIdl, \ - projectFileFormatVersionMake, projectFileFormatVersionProto, \ - projectFileFormatVersionAlt +from .Config import projectFileFormatVersion, projectFileFormatVersionUic, \ + projectFileFormatVersionIdl, projectFileFormatVersionMake, \ + projectFileFormatVersionProto, projectFileFormatVersionAlt import Preferences import Utilities @@ -45,8 +45,10 @@ XMLStreamWriterBase.writeXML(self) project = e5App().getObject("Project") - if not project.hasDefaultUicCompilerParameters(): + if not project.hasDefaultRccCompilerParameters(): fileFormatVersion = projectFileFormatVersion + elif not project.hasDefaultUicCompilerParameters(): + fileFormatVersion = projectFileFormatVersionUic elif not project.hasDefaultIdlCompilerParameters(): fileFormatVersion = projectFileFormatVersionIdl elif not project.hasDefaultMakeParameters(): @@ -241,6 +243,12 @@ self.writeBasics("UicCompilerParameters", self.pdata["UICPARAMS"]) self.writeEndElement() + # do the 'rcc' parameters + if not e5App().getObject("Project").hasDefaultRccCompilerParameters(): + self.writeStartElement("RccCompiler") + self.writeBasics("RccCompilerParameters", self.pdata["RCCPARAMS"]) + self.writeEndElement() + # do the extra project data stuff if len(self.pdata["PROJECTTYPESPECIFICDATA"]): self.writeStartElement("ProjectTypeSpecific")
--- a/Project/Project.py Sat Dec 01 11:39:28 2018 +0100 +++ b/Project/Project.py Sat Dec 01 19:07:01 2018 +0100 @@ -500,6 +500,12 @@ "Package": "", "RcSuffix": "", }, + "RCCPARAMS":{ + "CompressionThreshold": 70, # default value + "CompressLevel": 0, # use zlib default + "CompressionDisable": False, + "PathPrefix": "", + }, "EOL": -1, } @@ -5670,7 +5676,7 @@ self.__makeProcess = None ######################################################################### - ## Below are methods implementing the some 'IDL' support functions + ## Below are methods implementing some 'IDL' support functions ######################################################################### def hasDefaultIdlCompilerParameters(self): @@ -5688,7 +5694,7 @@ } ######################################################################### - ## Below are methods implementing the some 'UIC' support functions + ## Below are methods implementing some 'UIC' support functions ######################################################################### def hasDefaultUicCompilerParameters(self): @@ -5703,3 +5709,32 @@ "Package": "", "RcSuffix": "", } + + ######################################################################### + ## Below are methods implementing some 'RCC' support functions + ######################################################################### + + def hasDefaultRccCompilerParameters(self): + """ + Public method to test, if the project contains the default rcc compiler + parameters. + + @return flag indicating default parameter set + @rtype bool + """ + return self.pdata["RCCPARAMS"] == \ + self.getDefaultRccCompilerParameters() + + def getDefaultRccCompilerParameters(self): + """ + Public method to get the default rcc compiler parameters. + + @return dictionary containing the default rcc compiler parameters + @rtype dict + """ + return { + "CompressionThreshold": 70, # default value + "CompressLevel": 0, # use zlib default + "CompressionDisable": False, + "PathPrefix": "", + }
--- a/Project/ProjectResourcesBrowser.py Sat Dec 01 11:39:28 2018 +0100 +++ b/Project/ProjectResourcesBrowser.py Sat Dec 01 19:07:01 2018 +0100 @@ -92,6 +92,10 @@ self.tr('Compile all resources'), self.__compileAllResources) self.menu.addSeparator() + self.menu.addAction( + self.tr('Configure rcc Compiler'), + self.__configureRccCompiler) + self.menu.addSeparator() else: if self.hooks["compileResource"] is not None: self.menu.addAction( @@ -154,6 +158,10 @@ self.__compileAllResources) self.backMenu.addSeparator() self.backMenu.addAction( + self.tr('Configure rcc Compiler'), + self.__configureRccCompiler) + self.backMenu.addSeparator() + self.backMenu.addAction( self.tr('New resource...'), self.__newResource) else: if self.hooks["compileAllResources"] is not None: @@ -191,6 +199,10 @@ self.tr('Compile resources'), self.__compileSelectedResources) self.multiMenu.addSeparator() + self.multiMenu.addAction( + self.tr('Configure rcc Compiler'), + self.__configureRccCompiler) + self.multiMenu.addSeparator() else: if self.hooks["compileSelectedResources"] is not None: act = self.multiMenu.addAction( @@ -223,6 +235,10 @@ self.tr('Compile all resources'), self.__compileAllResources) self.dirMenu.addSeparator() + self.dirMenu.addAction( + self.tr('Configure rcc Compiler'), + self.__configureRccCompiler) + self.dirMenu.addSeparator() else: if self.hooks["compileAllResources"] is not None: self.dirMenu.addAction( @@ -264,6 +280,10 @@ self.tr('Compile all resources'), self.__compileAllResources) self.dirMultiMenu.addSeparator() + self.dirMultiMenu.addAction( + self.tr('Configure rcc Compiler'), + self.__configureRccCompiler) + self.dirMultiMenu.addSeparator() else: if self.hooks["compileAllResources"] is not None: self.dirMultiMenu.addAction( @@ -667,6 +687,23 @@ args.append("-py3") else: return None + defaultParameters = self.project.getDefaultRccCompilerParameters() + rccParameters = self.project.pdata["RCCPARAMS"] + if rccParameters["CompressionThreshold"] != \ + defaultParameters["CompressionThreshold"]: + args.append("-threshold") + args.append(str(rccParameters["CompressionThreshold"])) + if rccParameters["CompressLevel"] != \ + defaultParameters["CompressLevel"]: + args.append("-compress") + args.append(str(rccParameters["CompressLevel"])) + if rccParameters["CompressionDisable"] != \ + defaultParameters["CompressionDisable"]: + args.append("-no-compress") + if rccParameters["PathPrefix"] != \ + defaultParameters["PathPrefix"]: + args.append("-root") + args.append(rccParameters["PathPrefix"]) elif self.project.getProjectLanguage() == "Ruby": if self.project.getProjectType() == "Qt4": self.rccCompiler = 'rbrcc' @@ -907,6 +944,30 @@ """ ProjectBaseBrowser.handlePreferencesChanged(self) + def __configureRccCompiler(self): + """ + Private slot to configure some non-common rcc compiler options. + """ + from .RccCompilerOptionsDialog import RccCompilerOptionsDialog + + params = self.project.pdata["RCCPARAMS"] + + dlg = RccCompilerOptionsDialog(params) + if dlg.exec_() == QDialog.Accepted: + threshold, compression, noCompression, root = dlg.getData() + if threshold != params["CompressionThreshold"]: + params["CompressionThreshold"] = threshold + self.project.setDirty(True) + if compression != params["CompressLevel"]: + params["CompressLevel"] = compression + self.project.setDirty(True) + if noCompression != params["CompressionDisable"]: + params["CompressionDisable"] = noCompression + self.project.setDirty(True) + if root != params["PathPrefix"]: + params["PathPrefix"] = root + self.project.setDirty(True) + ########################################################################### ## Support for hooks below ###########################################################################
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/Project/RccCompilerOptionsDialog.py Sat Dec 01 19:07:01 2018 +0100 @@ -0,0 +1,54 @@ +# -*- coding: utf-8 -*- + +# Copyright (c) 2018 Detlev Offenbach <detlev@die-offenbachs.de> +# + +""" +Module implementing a dialog to enter some non-common rcc compiler options. +""" + +from __future__ import unicode_literals + +from PyQt5.QtWidgets import QDialog + +from .Ui_RccCompilerOptionsDialog import Ui_RccCompilerOptionsDialog + + +class RccCompilerOptionsDialog(QDialog, Ui_RccCompilerOptionsDialog): + """ + Class implementing a dialog to enter some non-common rcc compiler options. + """ + def __init__(self, compilerOptions, parent=None): + """ + Constructor + + @param compilerOptions dictionary containing the rcc compiler options + @type dict + @param parent reference to the parent widget + @type QWidget + """ + super(RccCompilerOptionsDialog, self).__init__(parent) + self.setupUi(self) + + self.thresholdSpinBox.setValue(compilerOptions["CompressionThreshold"]) + self.compressionSpinBox.setValue(compilerOptions["CompressLevel"]) + self.disableCheckBox.setChecked(compilerOptions["CompressionDisable"]) + self.rootEdit.setText(compilerOptions["PathPrefix"]) + + msh = self.minimumSizeHint() + self.resize(max(self.width(), msh.width()), msh.height()) + def getData(self): + """ + Public method to get the entered data. + + @return tuple containing the compression threshold, compression level, + flag indicating to disable compression and the resource access path + prefix + @rtype tuple of (int, int, bool, str) + """ + return ( + self.thresholdSpinBox.value(), + self.compressionSpinBox.value(), + self.disableCheckBox.isChecked(), + self.rootEdit.text().strip(), + )
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/Project/RccCompilerOptionsDialog.ui Sat Dec 01 19:07:01 2018 +0100 @@ -0,0 +1,188 @@ +<?xml version="1.0" encoding="UTF-8"?> +<ui version="4.0"> + <class>RccCompilerOptionsDialog</class> + <widget class="QDialog" name="RccCompilerOptionsDialog"> + <property name="geometry"> + <rect> + <x>0</x> + <y>0</y> + <width>500</width> + <height>219</height> + </rect> + </property> + <property name="windowTitle"> + <string>rcc Compiler Options</string> + </property> + <property name="sizeGripEnabled"> + <bool>true</bool> + </property> + <layout class="QVBoxLayout" name="verticalLayout"> + <item> + <widget class="QGroupBox" name="groupBox"> + <property name="title"> + <string>Compression Parameters</string> + </property> + <layout class="QGridLayout" name="gridLayout"> + <item row="0" column="0"> + <widget class="QLabel" name="label_2"> + <property name="text"> + <string>Threshold:</string> + </property> + </widget> + </item> + <item row="0" column="1"> + <widget class="QSpinBox" name="thresholdSpinBox"> + <property name="toolTip"> + <string>Select the compression threshold (default: 70%)</string> + </property> + <property name="alignment"> + <set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set> + </property> + <property name="specialValueText"> + <string/> + </property> + <property name="suffix"> + <string>%</string> + </property> + <property name="minimum"> + <number>0</number> + </property> + <property name="maximum"> + <number>100</number> + </property> + <property name="singleStep"> + <number>5</number> + </property> + <property name="value"> + <number>70</number> + </property> + </widget> + </item> + <item row="0" column="2"> + <spacer name="horizontalSpacer"> + <property name="orientation"> + <enum>Qt::Horizontal</enum> + </property> + <property name="sizeHint" stdset="0"> + <size> + <width>253</width> + <height>20</height> + </size> + </property> + </spacer> + </item> + <item row="1" column="0"> + <widget class="QLabel" name="label_3"> + <property name="text"> + <string>Compression Level:</string> + </property> + </widget> + </item> + <item row="1" column="1"> + <widget class="QSpinBox" name="compressionSpinBox"> + <property name="toolTip"> + <string>Select the compression level (default: use zlib default value)</string> + </property> + <property name="alignment"> + <set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set> + </property> + <property name="specialValueText"> + <string>default</string> + </property> + <property name="minimum"> + <number>0</number> + </property> + <property name="maximum"> + <number>9</number> + </property> + </widget> + </item> + <item row="2" column="0" colspan="2"> + <widget class="QCheckBox" name="disableCheckBox"> + <property name="text"> + <string>Disable Compression</string> + </property> + </widget> + </item> + </layout> + </widget> + </item> + <item> + <layout class="QHBoxLayout" name="horizontalLayout"> + <item> + <widget class="QLabel" name="label"> + <property name="text"> + <string>Access Path Prefix:</string> + </property> + </widget> + </item> + <item> + <widget class="E5ClearableLineEdit" name="rootEdit"> + <property name="toolTip"> + <string>Enter the prefix for the resource access path</string> + </property> + </widget> + </item> + </layout> + </item> + <item> + <widget class="QDialogButtonBox" name="buttonBox"> + <property name="orientation"> + <enum>Qt::Horizontal</enum> + </property> + <property name="standardButtons"> + <set>QDialogButtonBox::Cancel|QDialogButtonBox::Ok</set> + </property> + </widget> + </item> + </layout> + </widget> + <customwidgets> + <customwidget> + <class>E5ClearableLineEdit</class> + <extends>QLineEdit</extends> + <header>E5Gui/E5LineEdit.h</header> + </customwidget> + </customwidgets> + <tabstops> + <tabstop>thresholdSpinBox</tabstop> + <tabstop>compressionSpinBox</tabstop> + <tabstop>disableCheckBox</tabstop> + <tabstop>rootEdit</tabstop> + </tabstops> + <resources/> + <connections> + <connection> + <sender>buttonBox</sender> + <signal>accepted()</signal> + <receiver>RccCompilerOptionsDialog</receiver> + <slot>accept()</slot> + <hints> + <hint type="sourcelabel"> + <x>248</x> + <y>254</y> + </hint> + <hint type="destinationlabel"> + <x>157</x> + <y>274</y> + </hint> + </hints> + </connection> + <connection> + <sender>buttonBox</sender> + <signal>rejected()</signal> + <receiver>RccCompilerOptionsDialog</receiver> + <slot>reject()</slot> + <hints> + <hint type="sourcelabel"> + <x>316</x> + <y>260</y> + </hint> + <hint type="destinationlabel"> + <x>286</x> + <y>274</y> + </hint> + </hints> + </connection> + </connections> +</ui>
--- a/eric6.e4p Sat Dec 01 11:39:28 2018 +0100 +++ b/eric6.e4p Sat Dec 01 19:07:01 2018 +0100 @@ -939,6 +939,7 @@ <Source>Project/ProjectTranslationsBrowser.py</Source> <Source>Project/PropertiesDialog.py</Source> <Source>Project/QuickFindFileDialog.py</Source> + <Source>Project/RccCompilerOptionsDialog.py</Source> <Source>Project/SpellingPropertiesDialog.py</Source> <Source>Project/TranslationPropertiesDialog.py</Source> <Source>Project/UicCompilerOptionsDialog.py</Source> @@ -2067,7 +2068,6 @@ <Form>Preferences/ToolGroupConfigurationDialog.ui</Form> <Form>Preferences/ViewProfileSidebarsDialog.ui</Form> <Form>Preferences/ViewProfileToolboxesDialog.ui</Form> - <Form>Project/UicCompilerOptionsDialog.ui</Form> <Form>Project/AddDirectoryDialog.ui</Form> <Form>Project/AddFileDialog.ui</Form> <Form>Project/AddFoundFilesDialog.ui</Form> @@ -2083,8 +2083,10 @@ <Form>Project/NewPythonPackageDialog.ui</Form> <Form>Project/PropertiesDialog.ui</Form> <Form>Project/QuickFindFile.ui</Form> + <Form>Project/RccCompilerOptionsDialog.ui</Form> <Form>Project/SpellingPropertiesDialog.ui</Form> <Form>Project/TranslationPropertiesDialog.ui</Form> + <Form>Project/UicCompilerOptionsDialog.ui</Form> <Form>Project/UserPropertiesDialog.ui</Form> <Form>PyUnit/UnittestDialog.ui</Form> <Form>PyUnit/UnittestStacktraceDialog.ui</Form> @@ -2227,14 +2229,14 @@ </Resources> <Others> <Other>.hgignore</Other> + <Other>APIs/Python/zope-2.10.7.api</Other> + <Other>APIs/Python/zope-2.11.2.api</Other> + <Other>APIs/Python/zope-3.3.1.api</Other> <Other>APIs/Python3/PyQt4.bas</Other> <Other>APIs/Python3/PyQt5.bas</Other> <Other>APIs/Python3/QScintilla2.bas</Other> <Other>APIs/Python3/eric6.api</Other> <Other>APIs/Python3/eric6.bas</Other> - <Other>APIs/Python/zope-2.10.7.api</Other> - <Other>APIs/Python/zope-2.11.2.api</Other> - <Other>APIs/Python/zope-3.3.1.api</Other> <Other>APIs/QSS/qss.api</Other> <Other>APIs/Ruby/Ruby-1.8.7.api</Other> <Other>APIs/Ruby/Ruby-1.8.7.bas</Other>