diff options
author | Slávek Banko <[email protected]> | 2023-01-22 02:02:13 +0100 |
---|---|---|
committer | Slávek Banko <[email protected]> | 2023-01-22 02:02:13 +0100 |
commit | 86480e58eafc1fa3486e03155ed34e02b4595a24 (patch) | |
tree | 0e8f64c4003ea558e946b7a3347688904b451635 /chalk/plugins/viewplugins/scripting | |
parent | 135d005014a1e85295af4e379f026a361537ae5f (diff) | |
download | koffice-86480e58eafc1fa3486e03155ed34e02b4595a24.tar.gz koffice-86480e58eafc1fa3486e03155ed34e02b4595a24.zip |
Drop python2 support in scripts.
Signed-off-by: Slávek Banko <[email protected]>
Diffstat (limited to 'chalk/plugins/viewplugins/scripting')
-rw-r--r-- | chalk/plugins/viewplugins/scripting/samples/python/invert.py | 4 | ||||
-rw-r--r-- | chalk/plugins/viewplugins/scripting/samples/python/reshapehisto.py | 20 |
2 files changed, 12 insertions, 12 deletions
diff --git a/chalk/plugins/viewplugins/scripting/samples/python/invert.py b/chalk/plugins/viewplugins/scripting/samples/python/invert.py index 7a642760..91df6d9d 100644 --- a/chalk/plugins/viewplugins/scripting/samples/python/invert.py +++ b/chalk/plugins/viewplugins/scripting/samples/python/invert.py @@ -33,7 +33,7 @@ class Inverter: script.setProgressTotalSteps(width * height) layer.beginPainting("invert") it = layer.createRectIterator( 0, 0, width, height ) - print "kikoo\n" + print("kikoo\n") finesh = it.isDone() while (not finesh) : p = it.getRGBA() @@ -42,7 +42,7 @@ class Inverter: p[2] = 255 - p[2] it.setRGBA(p) script.incProgress() - finesh = it.next() + finesh = next(it) layer.endPainting() Inverter() diff --git a/chalk/plugins/viewplugins/scripting/samples/python/reshapehisto.py b/chalk/plugins/viewplugins/scripting/samples/python/reshapehisto.py index 4ef66965..a4ce7842 100644 --- a/chalk/plugins/viewplugins/scripting/samples/python/reshapehisto.py +++ b/chalk/plugins/viewplugins/scripting/samples/python/reshapehisto.py @@ -42,10 +42,10 @@ def computeDiff(histo, histoTarget): count = 1 while( count < 255 ) : derivdiff.append((diff[count+1] - diff[count - 1])/2.0) - print count - print " " - print derivdiff[count] - print " " + print(count) + print(" ") + print(derivdiff[count]) + print(" ") count += 1 derivdiff.append(diff[255] - diff[254] ) return diff @@ -53,7 +53,7 @@ def computeDiff(histo, histoTarget): try: import krosschalkcore except: - raise "Import of the ChalkCore module failed." + raise Exception("Import of the ChalkCore module failed.") #histoTarget = [ 0.0, 0.01226531745085, 0.024528789662323, 0.0367885716726463, 0.049042819075215, 0.0612896882960706, 0.0735273368712555, 0.0857539237239997, 0.0979676094416996, 0.110166556552646, 0.122348929802458, 0.13451289643019, 0.146656626444054, 0.158778292896733, 0.170876072160234, 0.18294814420024, 0.194992692849922, 0.207007906083172, 0.218991976287209, 0.230943100534525, 0.242859480854121, 0.254739324502003, 0.266580844230888, 0.278382258559083, 0.290141792038499, 0.301857675521758, 0.313528146428344, 0.325151449009778, 0.336725834613756, 0.348249561947225, 0.359720897338346, 0.371138114997318, 0.38249949727601, 0.393803334926368, 0.405047927357568, 0.416231582891849, 0.427352619019025, 0.4384093626496, 0.449400150366478, 0.460323328675215, 0.471177254252771, 0.481960294194744, 0.492670826261026, 0.50330723911986, 0.513867932590253, 0.524351317882718, 0.534755817838293, 0.545079867165813, 0.555321912677404, 0.565480413522147, 0.575553841417885, 0.585540680881154, 0.595439429455167, 0.605248597935856, 0.614966710595909, 0.624592305406788, 0.634123934258679, 0.643560163178352, 0.652899572544893, 0.662140757303275, 0.671282327175744, 0.680322906870975, 0.689261136290974, 0.698095670735701, 0.706825181105366, 0.715448354100387, 0.723963892418968, 0.732370514952268, 0.740666956977137, 0.748851970346384, 0.756924323676554, 0.764882802533185, 0.772726209613504, 0.780453364926561, 0.788063105970749, 0.795554287908693, 0.802925783739486, 0.810176484468239, 0.817305299272921, 0.824311155668464, 0.83119299966812, 0.837949795942015, 0.84458052797292, 0.851084198209167, 0.857459828214736, 0.863706458816447, 0.869823150248263, 0.875808982292675, 0.881663054419139, 0.887384485919556, 0.892972416040772, 0.898426004114068, 0.903744429681637, 0.908926892620016, 0.913972613260457, 0.918880832506229, 0.923650811946811, 0.928281833968988, 0.93277320186481, 0.937124239936404, 0.941334293597632, 0.945402729472569, 0.949328935490789, 0.953112320979447, 0.956752316752142, 0.960248375194552, 0.963599970346811, 0.966806597982642, 0.969867775685214, 0.972783042919718, 0.97555196110265, 0.978174113667795, 0.980649106128898, 0.982976566139007, 0.985156143546496, 0.987187510447739, 0.989070361236445, 0.990804412649628, 0.99238940381023, 0.993825096266363, 0.995111274027184, 0.99624774359539, 0.997234333996328, 0.998070896803715, 0.998757306161974, 0.99929345880516, 0.999679274072503, 0.999914693920536, 0.999999682931835, 0.99993422832034, 0.999718339933283, 0.999352050249705, 0.998835414375572, 0.998168510035481, 0.997351437560967, 0.996384319875413, 0.995267302475555, 0.994000553409588, 0.992584263251893, 0.991018645074359, 0.989303934414332, 0.987440389239176, 0.985428289907469, 0.983267939126818, 0.980959661908326, 0.978503805517689, 0.975900739422957, 0.973150855238948, 0.970254566668332, 0.967212309439392, 0.964024541240472, 0.960691741651122, 0.957214412069943, 0.953593075639162, 0.949828277165924, 0.945920583040329, 0.941870581150226, 0.937678880792763, 0.933346112582728, 0.928872928357675, 0.924260001079857, 0.919508024734984, 0.914617714227821, 0.909589805274631, 0.90442505429249, 0.899124238285494, 0.89368815472786, 0.888117621443952, 0.882413476485242, 0.876576578004235, 0.870607804125365, 0.86450805281288, 0.858278241735758, 0.851919308129644, 0.845432208655849, 0.83881791925743, 0.832077435012361, 0.825211769983833, 0.818221957067693, 0.811109047837053, 0.803874112384084, 0.796518239159033, 0.789042534806467, 0.781448123998789, 0.773736149267035, 0.76590777082899, 0.757964166414642, 0.749906531088995, 0.741736077072283, 0.733454033557598, 0.725061646525966, 0.716560178558895, 0.707950908648432, 0.699235132004742, 0.690414159861254, 0.681489319277395, 0.672461952938941, 0.663333418956019, 0.654105090658787, 0.644778356390828, 0.635354619300277, 0.625835297128734, 0.616221821997965, 0.606515640194456, 0.596718211951823, 0.586831011231134, 0.576855525499155, 0.566793255504575, 0.556645715052225, 0.546414430775338, 0.536100941905873, 0.525706800042952, 0.515233568919429, 0.504682824166636, 0.49405615307734, 0.483355154366944, 0.472581437932973, 0.461736624612871, 0.450822345940161, 0.439840243898986, 0.428791970677089, 0.417679188417244, 0.406503568967204, 0.39526679362818, 0.383970552901897, 0.372616546236274, 0.361206481769749, 0.349742076074299, 0.338225053897198, 0.326657147901536, 0.315040098405551, 0.303375653120808, 0.291665566889271, 0.279911601419294, 0.268115525020586, 0.256279112338177, 0.244404144085436, 0.232492406776176, 0.220545692455878, 0.208565798432095, 0.196554527004056, 0.184513685191523, 0.172445084462932, 0.160350540462877, 0.148231872738948, 0.136090904468, 0.123929462181863, 0.111749375492553, 0.0995524768170189, 0.0873406011014653, 0.0751155855452987, 0.0628792693247314, 0.0506334933160884, 0.0383800998188613, 0.0261209322785436, 0.0138578350092972 ] @@ -71,10 +71,10 @@ height = layer.getHeight() countreshaping = 0 while countreshaping < 1: histo = layer.createHistogram("RGB8HISTO",0) - print "################################### histogram reshaping ##################################################" + print("################################### histogram reshaping ##################################################") if histo == 0: - raise "Uncompatible histogram\n" - print "Max : " + str( histo.getMax() ) + " Min : " + str( histo.getMin() ) + raise Exception("Uncompatible histogram") + print("Max : " + str( histo.getMax() ) + " Min : " + str( histo.getMin() )) #Compute the area of the target histogram aireHistoTarget = 0.0 @@ -133,7 +133,7 @@ while countreshaping < 1: count += 1 it = layer.createRectIterator( 0, 0, width, height ) - print "kikoo : " + str(countreshaping) + print("kikoo : " + str(countreshaping)) while (not it.isDone()) : r = it.getRed() g = it.getGreen() @@ -145,7 +145,7 @@ while countreshaping < 1: it.setRed(tabler[r]) it.setGreen(tableg[g]) it.setBlue(tableb[b]) - it.next() + next(it) #histo.setChannel(0) #diff = [ ] |