Commit d5e82ca9 authored by Boudewijn Rempt's avatar Boudewijn Rempt

Run autopep8 again

parent 97e6aace
# -*- coding: utf-8 -*-
import info
class subinfo( info.infoclass ):
def setTargets( self ):
self.targets[ '3.2.2' ] = 'http://www.fftw.org/fftw-3.2.2.tar.gz'
self.targetDigests[ '3.2.2' ] = 'd43b799eedfb9408f62f9f056f5e8a645618467b'
self.targetInstSrc[ '3.2.2' ] = "fftw-3.2.2"
self.patchToApply[ '3.2.2' ] = [ ( 'fftw-3.2.2-20111221.diff', 1 ),
( 'fftw-3.2.2-20130818.diff', 1 ) ]
class subinfo(info.infoclass):
def setTargets(self):
self.targets['3.2.2'] = 'http://www.fftw.org/fftw-3.2.2.tar.gz'
self.targetDigests['3.2.2'] = 'd43b799eedfb9408f62f9f056f5e8a645618467b'
self.targetInstSrc['3.2.2'] = "fftw-3.2.2"
self.patchToApply['3.2.2'] = [('fftw-3.2.2-20111221.diff', 1),
('fftw-3.2.2-20130818.diff', 1)]
self.shortDescription = "a C subroutine library for computing the discrete Fourier transform (DFT)"
self.defaultTarget = '3.2.2'
def setDependencies( self ):
self.buildDependencies[ 'virtual/base' ] = 'default'
def setDependencies(self):
self.buildDependencies['virtual/base'] = 'default'
from Package.CMakePackageBase import *
class Package( CMakePackageBase ):
def __init__( self ):
CMakePackageBase.__init__( self )
class Package(CMakePackageBase):
def __init__(self):
CMakePackageBase.__init__(self)
self.supportsNinja = False
self.subinfo.options.configure.defines = "-DFFTW_SINGLE=ON -DFFTW_DOUBLE=OFF -DBUILD_BENCHMARKS=OFF"
......@@ -12,7 +12,7 @@ print("pyqt_version_str:%s" % PyQt5.Qt.PYQT_VERSION_STR)
pyqt_version_tag = ""
in_t = False
for item in PyQt5.Qt.PYQT_CONFIGURATION["sip_flags"].split(' '):
if item=="-t":
if item == "-t":
in_t = True
elif in_t:
if item.startswith("Qt_5"):
......
# By Simon Edwards <simon@simonzone.com>
# This file is in the public domain.
import py_compile, sys
import py_compile
import sys
sys.exit(py_compile.main())
......@@ -35,33 +35,33 @@ from PyQt5.QtWidgets import qApp
variant_converter = {
"QVariantList": lambda v: v.toList(v),
"QVariantMap": lambda v: toPyObject(v),
"QPoint": lambda v: v.toPoint(),
"str": lambda v: v.toString(),
"int": lambda v: v.toInt()[0],
"double": lambda v: v.toDouble()[0],
"char": lambda v: v.toChar(),
"QByteArray": lambda v: v.toByteArray(),
"QPoint": lambda v: v.toPoint(),
"QPointF": lambda v: v.toPointF(),
"QSize": lambda v: v.toSize(),
"QLine": lambda v: v.toLine(),
"QStringList": lambda v: v.toStringList(),
"QTime": lambda v: v.toTime(),
"QDateTime": lambda v: v.toDateTime(),
"QDate": lambda v: v.toDate(),
"QLocale": lambda v: v.toLocale(),
"QUrl": lambda v: v.toUrl(),
"QRect": lambda v: v.toRect(),
"QBrush": lambda v: QBrush(v),
"QFont": lambda v: QFont(v),
"QPalette": lambda v: QPalette(v),
"QPixmap": lambda v: QPixmap(v),
"QImage": lambda v: QImage(v),
"bool": lambda v: v.toBool(),
"QObject*": lambda v: wrap_variant_object(v),
"QWidget*": lambda v: wrap_variant_object(v),
"ActionMap": lambda v: int(v.count())
"QVariantMap": lambda v: toPyObject(v),
"QPoint": lambda v: v.toPoint(),
"str": lambda v: v.toString(),
"int": lambda v: v.toInt()[0],
"double": lambda v: v.toDouble()[0],
"char": lambda v: v.toChar(),
"QByteArray": lambda v: v.toByteArray(),
"QPoint": lambda v: v.toPoint(),
"QPointF": lambda v: v.toPointF(),
"QSize": lambda v: v.toSize(),
"QLine": lambda v: v.toLine(),
"QStringList": lambda v: v.toStringList(),
"QTime": lambda v: v.toTime(),
"QDateTime": lambda v: v.toDateTime(),
"QDate": lambda v: v.toDate(),
"QLocale": lambda v: v.toLocale(),
"QUrl": lambda v: v.toUrl(),
"QRect": lambda v: v.toRect(),
"QBrush": lambda v: QBrush(v),
"QFont": lambda v: QFont(v),
"QPalette": lambda v: QPalette(v),
"QPixmap": lambda v: QPixmap(v),
"QImage": lambda v: QImage(v),
"bool": lambda v: v.toBool(),
"QObject*": lambda v: wrap_variant_object(v),
"QWidget*": lambda v: wrap_variant_object(v),
"ActionMap": lambda v: int(v.count())
}
......@@ -302,7 +302,7 @@ class PyQtProperty(object):
self.read_only = not meta_property.isWritable()
self.__doc__ = "%s is a %s%s" % (
self.name, meta_property.typeName(),
self.read_only and " (read-only)" or ""
self.read_only and " (read-only)" or ""
)
def get(self, obj):
......@@ -329,7 +329,7 @@ class PyQtMethod(object):
self.__doc__ = "%s(%s)%s" % (
self.name, params,
self.returnType and (" -> %s" % self.returnType) or ""
self.returnType and (" -> %s" % self.returnType) or ""
)
def instancemethod(self):
......
......@@ -327,68 +327,68 @@ class QtQmlInterpreter(object):
js_words = [
'break',
'for',
'throw',
'case',
'function',
'try',
'catch',
'if',
'typeof',
'continue',
'in',
'var',
'default',
'instanceof',
'void',
'delete',
'new',
'undefined',
'do',
'return',
'while',
'else',
'switch',
'with',
'finally',
'this',
'NaN',
'Infinity',
'undefined',
'print',
'parseInt',
'parseFloat',
'isNaN',
'isFinite',
'decodeURI',
'decodeURIComponent',
'encodeURI',
'encodeURIComponent',
'escape',
'unescape',
'version',
'gc',
'Object',
'Function',
'Number',
'Boolean',
'String',
'Date',
'Array',
'RegExp',
'Error',
'EvalError',
'RangeError',
'ReferenceError',
'SyntaxError',
'TypeError',
'URIError',
'eval',
'Math',
'Enumeration',
'Variant',
'QObject',
'QMetaObject']
'for',
'throw',
'case',
'function',
'try',
'catch',
'if',
'typeof',
'continue',
'in',
'var',
'default',
'instanceof',
'void',
'delete',
'new',
'undefined',
'do',
'return',
'while',
'else',
'switch',
'with',
'finally',
'this',
'NaN',
'Infinity',
'undefined',
'print',
'parseInt',
'parseFloat',
'isNaN',
'isFinite',
'decodeURI',
'decodeURIComponent',
'encodeURI',
'encodeURIComponent',
'escape',
'unescape',
'version',
'gc',
'Object',
'Function',
'Number',
'Boolean',
'String',
'Date',
'Array',
'RegExp',
'Error',
'EvalError',
'RangeError',
'ReferenceError',
'SyntaxError',
'TypeError',
'URIError',
'eval',
'Math',
'Enumeration',
'Variant',
'QObject',
'QMetaObject']
class QtQmlCompleter(object):
......
......@@ -146,8 +146,8 @@ class DockWidgetTitleBar(QWidget):
self.collapseButton.size().height() + self.pinButton.size().height()),
QSize(
self.geometry().width() - (fw * 2),
self.geometry().height() - (fw * 2) -
mw - self.collapseButton.size().height() - self.pinButton.size().height()))
self.geometry().height() - (fw * 2) -
mw - self.collapseButton.size().height() - self.pinButton.size().height()))
titleOpt.title = q.windowTitle()
titleOpt.closable = hasFeature(q, QDockWidget.DockWidgetClosable)
titleOpt.floatable = hasFeature(q, QDockWidget.DockWidgetFloatable)
......@@ -163,8 +163,8 @@ class DockWidgetTitleBar(QWidget):
self.collapseButton.size().width() + self.pinButton.size().width(), fw),
QSize(
self.geometry().width() - (fw * 2) -
mw - self.collapseButton.size().width() - self.pinButton.size().width(),
self.geometry().height() - (fw * 2)))
mw - self.collapseButton.size().width() - self.pinButton.size().width(),
self.geometry().height() - (fw * 2)))
titleOpt.title = q.windowTitle()
titleOpt.closable = hasFeature(q, QDockWidget.DockWidgetClosable)
titleOpt.floatable = hasFeature(q, QDockWidget.DockWidgetFloatable)
......@@ -182,7 +182,7 @@ class DockWidgetTitleBar(QWidget):
QPoint(fh, 40), # self.geometry().height() - (fh * 3)),
QSize(
self.geometry().width() - (fh * 2),
fh * 2))
fh * 2))
opt.title = q.windowTitle()
opt.closable = hasFeature(q, QDockWidget.DockWidgetClosable)
opt.floatable = hasFeature(q, QDockWidget.DockWidgetFloatable)
......@@ -217,7 +217,7 @@ class DockWidgetTitleBar(QWidget):
QPoint(fw, fw),
QSize(
self.geometry().width() - (fw * 2),
self.geometry().height() - (fw * 2)))
self.geometry().height() - (fw * 2)))
opt.title = q.windowTitle()
opt.closable = hasFeature(q, QDockWidget.DockWidgetClosable)
opt.floatable = hasFeature(q, QDockWidget.DockWidgetFloatable)
......
......@@ -127,7 +127,7 @@ class PythonHighlighter(QtGui.QSyntaxHighlighter):
self.rules = []
self.rules += map(lambda s: (QtCore.QRegExp(r"\b" + s + r"\b"),
self.keywordFormat), self.keywords)
self.keywordFormat), self.keywords)
self.rules.append((QtCore.QRegExp(r"\b[A-Za-z_]+\(.*\)"), self.callableFormat))
self.rules.append((QtCore.QRegExp(r"\b__[a-z]+__\b"), self.magicFormat))
......@@ -172,7 +172,7 @@ class QtQmlHighlighter(PythonHighlighter):
self.rules = []
self.rules += map(lambda s: (QtCore.QRegExp(r"\b" + s + r"\b"),
self.keywordFormat), self.keywords)
self.keywordFormat), self.keywords)
self.rules.append((QtCore.QRegExp(r"\b[A-Za-z_]+\(.*\)"), self.callableFormat))
# self.rules.append((QtCore.QRegExp(r"\b__[a-z]+__\b"), self.magicFormat))
......
......@@ -334,7 +334,7 @@ class EditorSidebar(QWidget):
y = view.contentOffset().y()
pageBottom = max(
view.height(),
view.verticalScrollBar().value() + view.viewport().height())
view.verticalScrollBar().value() + view.viewport().height())
fm = self.fm
w = self.width() - 8
while block.isValid():
......
......@@ -65,9 +65,11 @@ qt_resource_struct = b"\
\x00\x00\x00\x10\x00\x00\x00\x00\x00\x01\x00\x00\x00\x00\
"
def qInitResources():
QtCore.qRegisterResourceData(0x01, qt_resource_struct, qt_resource_name, qt_resource_data)
def qCleanupResources():
QtCore.qUnregisterResourceData(0x01, qt_resource_struct, qt_resource_name, qt_resource_data)
......
......@@ -101,9 +101,9 @@ class UIColorSpace(object):
def confirmButton(self):
selectedPaths = [item.text() for item in self.widgetDocuments.selectedItems()]
selectedDocuments = [document for document in self.documentsList for path in selectedPaths if path==document.fileName()]
selectedDocuments = [document for document in self.documentsList for path in selectedPaths if path == document.fileName()]
self.msgBox = QMessageBox(self.mainDialog)
self.msgBox = QMessageBox(self.mainDialog)
if selectedDocuments:
self.convertColorSpace(selectedDocuments)
self.msgBox.setText("The selected documents has been converted.")
......@@ -111,7 +111,6 @@ class UIColorSpace(object):
self.msgBox.setText("Select at least one document.")
self.msgBox.exec_()
def convertColorSpace(self, documents):
for document in documents:
document.setColorSpace(self.colorModelComboBox.currentText(),
......
from PyQt5.QtWidgets import (QWidget, QSpinBox, QHBoxLayout,
QVBoxLayout, QFormLayout)
class CanvasSizeTool(QWidget):
def __init__(self, mainDialog, parent=None):
......
......@@ -2,6 +2,7 @@ from PyQt5.QtWidgets import (QWidget, QSpinBox, QHBoxLayout,
QVBoxLayout, QFormLayout)
import math
class RotateTool(QWidget):
def __init__(self, mainDialog, parent=None):
......
from PyQt5.QtWidgets import (QWidget, QSpinBox, QHBoxLayout,
QVBoxLayout, QFormLayout, QComboBox)
class ScaleTool(QWidget):
def __init__(self, mainDialog, parent=None):
......
......@@ -60,7 +60,7 @@ class UIDocumentTools(object):
modules = []
for classPath in toolsModule.ToolClasses:
_module, _klass = classPath.rsplit('.', maxsplit=1)
_module, _klass = classPath.rsplit('.', maxsplit=1)
modules.append(dict(module='{0}.{1}'.format(modulePath, _module),
klass=_klass))
......@@ -83,9 +83,9 @@ class UIDocumentTools(object):
def confirmButton(self):
selectedPaths = [item.text() for item in self.widgetDocuments.selectedItems()]
selectedDocuments = [document for document in self.documentsList for path in selectedPaths if path==document.fileName()]
selectedDocuments = [document for document in self.documentsList for path in selectedPaths if path == document.fileName()]
self.msgBox = QMessageBox(self.mainDialog)
self.msgBox = QMessageBox(self.mainDialog)
if selectedDocuments:
widget = self.tabTools.currentWidget()
widget.adjust(selectedDocuments)
......
......@@ -33,7 +33,6 @@ class UIExportLayers(object):
self.yResSpinBox = QSpinBox()
self.formatsComboBox = QComboBox()
self.buttonBox = QDialogButtonBox(QDialogButtonBox.Ok | QDialogButtonBox.Cancel)
self.kritaInstance = krita.Krita.instance()
......@@ -106,9 +105,9 @@ class UIExportLayers(object):
def confirmButton(self):
selectedPaths = [item.text() for item in self.widgetDocuments.selectedItems()]
selectedDocuments = [document for document in self.documentsList for path in selectedPaths if path==document.fileName()]
selectedDocuments = [document for document in self.documentsList for path in selectedPaths if path == document.fileName()]
self.msgBox = QMessageBox(self.mainDialog)
self.msgBox = QMessageBox(self.mainDialog)
if not selectedDocuments:
self.msgBox.setText("Select one document.")
elif not self.directoryTextField.text():
......@@ -144,7 +143,7 @@ class UIExportLayers(object):
if node.type() == 'grouplayer':
newDir = parentDir + '/' + node.name()
self.mkdir(newDir)
elif not self.exportFilterLayersCheckBox.isChecked() and 'filter' in node.type():
elif not self.exportFilterLayersCheckBox.isChecked() and 'filter' in node.type():
continue
elif self.ignoreInvisibleLayersCheckBox.isChecked() and not node.visible():
continue
......
from PyQt5.QtWidgets import QComboBox
import krita
class FilterComboBox(QComboBox):
def __init__(self, uiFilterManager, parent=None):
......
......@@ -26,7 +26,7 @@ class FilterManagerTreeModel(QAbstractItemModel):
else:
parentItem = self.rootItem
#It's a FilterManagerTreeItem
# It's a FilterManagerTreeItem
childItem = parentItem.child(row)
if childItem:
return self.createIndex(row, column, childItem)
......
# let's make a module
# let's make a module
from .lastdocumentsdocker import *
......@@ -6,21 +6,21 @@ from lastdocumentsdocker import lastdocumentslistmodel
class LastDocumentsDocker(krita.DockWidget):
def __init__(self):
super(LastDocumentsDocker, self).__init__()
super(LastDocumentsDocker, self).__init__()
self.baseWidget = QWidget()
self.layout = QVBoxLayout()
self.listView = QListView()
self.baseWidget = QWidget()
self.layout = QVBoxLayout()
self.listView = QListView()
self.listView.setFlow(QListView.LeftToRight)
self.listView.setFlow(QListView.LeftToRight)
self.layout.addWidget(self.listView)
self.layout.addWidget(self.listView)
self.baseWidget.setLayout(self.layout)
self.setWidget(self.baseWidget)
self.baseWidget.setLayout(self.layout)
self.setWidget(self.baseWidget)
self.listView.setModel(lastdocumentslistmodel.LastDocumentsListModel())
self.setWindowTitle("Last Documents Docker")
self.listView.setModel(lastdocumentslistmodel.LastDocumentsListModel())
self.setWindowTitle("Last Documents Docker")
def canvasChanged(self, canvas):
pass
......
# let's make a module
# let's make a module
from .palette_docker import *
......@@ -14,7 +14,7 @@ from . import palette_exporter_gimppalette, palette_exporter_inkscapeSVG, palett
class Palette_Docker(DockWidget):
# Init the docker
# Init the docker
def __init__(self):
super().__init__()
......@@ -220,7 +220,7 @@ class Palette_Docker(DockWidget):
def slot_export_to_inkscape_svg(self):
palette_exporter_inkscapeSVG.inkscapeSVGExporter(self.cmb_palettes.currentText())
def slot_sort_colors(self):
colorSorter = palette_sortColors.sortColors(self.cmb_palettes.currentText())
self.paletteView.setPalette(colorSorter.palette())
......
......@@ -13,6 +13,7 @@ from krita import *
class sortColors:
def __init__(self, name):
# We want people to select a palette...
allPalettes = Application.resources("palette")
......@@ -27,40 +28,40 @@ class sortColors:
self.sort_color_by_name(groupName)
def sort_color_by_name(self, groupName):
l={}
l = {}
colorCount = self.currentPalette.colorsCountGroup(groupName)
for i in range(colorCount-1, -1, -1):
for i in range(colorCount - 1, -1, -1):
entry = self.currentPalette.colorSetEntryFromGroup((i), groupName)
l[entry.name+str(i)] = entry
l[entry.name + str(i)] = entry
self.currentPalette.removeEntry((i), groupName)
for s in sorted(l):
self.currentPalette.addEntry(l[s], groupName)
def sort_color_by_id(self, groupName):
l={}
l = {}
colorCount = self.currentPalette.colorsCountGroup(groupName)
for i in range(colorCount-1, -1, -1):
for i in range(colorCount - 1, -1, -1):
entry = self.currentPalette.colorSetEntryFromGroup((i), groupName)
l[entry.id+" "+str(i)] = entry
l[entry.id + " " + str(i)] = entry
self.currentPalette.removeEntry((i), groupName)
for s in sorted(l):
self.currentPalette.addEntry(l[s], groupName)
def sort_by_value(self, groupName):
l={}
l = {}
colorCount = self.currentPalette.colorsCountGroup(groupName)
for i in range(colorCount-1, -1, -1):
for i in range(colorCount - 1, -1, -1):
entry = self.currentPalette.colorSetEntryFromGroup((i), groupName)
color = self.currentPalette.colorForEntry(entry)
color.setColorSpace("RGBA", "U8", "sRGB built-in")
l[color.components()[0]+color.components()[1]+color.components()[2]] = entry
l[color.components()[0] + color.components()[1] + color.components()[2]] = entry
self.currentPalette.removeEntry((i), groupName)
for s in sorted(l):
self.currentPalette.addEntry(l[s], groupName)
def sort_by_hue(self, stepsize, groupName):
pass
......
# let's make a module
# let's make a module
from .quick_settings_docker import *
......@@ -14,7 +14,7 @@ from krita import *
class QuickSettingsDocker(DockWidget):
# Init the docker
# Init the docker
def __init__(self):
super().__init__()
......
# let's make a module
# let's make a module
from .scriptdocker import *
......@@ -7,21 +7,21 @@ import krita
class ScriptDocker(krita.DockWidget):
def __init__(self):
super(ScriptDocker, self).__init__()
super(ScriptDocker, self).__init__()
self.baseWidget = QWidget()
self.layout = QVBoxLayout()
self.scriptsLayout = QFormLayout()
self.addButton = QPushButton("Add Script")
self.actions = []
self.baseWidget = QWidget()
self.layout = QVBoxLayout()
self.scriptsLayout = QFormLayout()
self.addButton = QPushButton("Add Script")
self.actions = []
self.layout.addLayout(self.scriptsLayout)
self.layout.addWidget(self.addButton)
self.baseWidget.setLayout(self.layout)
self.setWidget(self.baseWidget)
self.layout.addLayout(self.scriptsLayout)
self.layout.addWidget(self.addButton)
self.baseWidget.setLayout(self.layout)
self.setWidget(self.baseWidget)
self.setWindowTitle("Script Docker")
self.addButton.clicked.connect(self.addNewRow)
self.setWindowTitle("Script Docker")
self.addButton.clicked.connect(self.addNewRow)
def canvasChanged(self, canvas):
pass
......
......@@ -14,7 +14,7 @@ class ClearAction(QAction):
self.setText('Clear')
# path to the icon
#self.setIcon(QIcon(':/icons/clear.svg'))
# self.setIcon(QIcon(':/icons/clear.svg'))
def clear(self):
self.toolbar.outputtextedit.clear()
......@@ -50,7 +50,7 @@ class UITenBrushes(object):
button.presetChooser = self.presetChooser
if self.tentbrushes.actions[index] and self.tentbrushes.actions[index].preset and self.tentbrushes.actions[index].preset in allPresets:
p = allPresets[self.tentbrushes.actions[index].preset];
p = allPresets[self.tentbrushes.actions[index].preset]
button.preset = p.name()
button.setIcon(QIcon(QPixmap.fromImage(p.image())))
......
......@@ -23,19 +23,19 @@ class TestAction(unittest.TestCase):
def testEqualOperator(self):
new_action = self.instance
self.assertEqual(new_action==self.instance, True)
self.assertEqual(new_action == self.instance, True)