Changing version to v0.1 with potential git version, changing type display request function to displayType and displayTypeMultiple

This commit is contained in:
Adsooi 2021-08-14 16:13:14 +02:00
parent 4a9f2f5828
commit 7cc126db00
Signed by: Ad5001
GPG key ID: 7251B1AF90B960F9
13 changed files with 76 additions and 157 deletions

View file

@ -15,8 +15,29 @@
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <https://www.gnu.org/licenses/>.
"""
from shutil import which
__VERSION__ = "0.0.1.dev0"
__VERSION__ = "0.1"
is_release = False
# Check if development version, if so get the date of the latest git patch
# and append it to the version string.
if which('git') is not None and not is_release:
from os.path import realpath, join, dirname, exists
from subprocess import check_output
from datetime import datetime
# Command to check date of latest git commit
cmd = ['git', 'log', '--format=%ci', '-n 1']
cwd = realpath(join(dirname(__file__), '..')) # Root AccountFree directory.
if exists(join(cwd, '.git')):
date_str = check_output(cmd, cwd=cwd).decode('utf-8').split(' ')[0]
try:
date = datetime.fromisoformat(date_str)
__VERSION__ += '.dev0+git' + date.strftime('%Y%m%d')
except ValueError:
# Date cannot be parsed, not git root?
pass
if __name__ == "__main__":
from .logarithmplotter import run

View file

@ -34,7 +34,7 @@ pwd = os.getcwd()
def get_linux_theme():
des = {
"KDE": "Flat",
"KDE": "org.kde.desktop",
"gnome": "default",
"lxqt": "fusion",
"mate": "fusion",

View file

@ -1,131 +1,9 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<svg
xmlns:dc="http://purl.org/dc/elements/1.1/"
xmlns:cc="http://creativecommons.org/ns#"
xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
xmlns:svg="http://www.w3.org/2000/svg"
xmlns="http://www.w3.org/2000/svg"
xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
width="24.0px"
height="24.0px"
viewBox="0 0 24.0 24.0"
version="1.1"
id="SVGRoot"
sodipodi:docname="logplotter.svg"
inkscape:version="1.0.1 (3bc2e813f5, 2021-09-07)">
<title
id="title836">LogarithmPlotter Icon v1.0</title>
<defs
id="defs833" />
<sodipodi:namedview
id="base"
pagecolor="#ffffff"
bordercolor="#666666"
borderopacity="1.0"
inkscape:pageopacity="0.0"
inkscape:pageshadow="2"
inkscape:zoom="22.627417"
inkscape:cx="23.950814"
inkscape:cy="5.6122612"
inkscape:document-units="px"
inkscape:current-layer="layer1"
inkscape:document-rotation="0"
showgrid="true"
inkscape:window-width="1920"
inkscape:window-height="1011"
inkscape:window-x="0"
inkscape:window-y="0"
inkscape:window-maximized="1">
<inkscape:grid
type="xygrid"
id="grid1403" />
</sodipodi:namedview>
<metadata
id="metadata836">
<rdf:RDF>
<cc:Work
rdf:about="">
<dc:format>image/svg+xml</dc:format>
<dc:type
rdf:resource="http://purl.org/dc/dcmitype/StillImage" />
<dc:title>LogarithmPlotter Icon v1.0</dc:title>
<cc:license
rdf:resource="http://creativecommons.org/licenses/by-nc-sa/4.0/" />
<dc:date>2021</dc:date>
<dc:creator>
<cc:Agent>
<dc:title>Ad5001</dc:title>
</cc:Agent>
</dc:creator>
<dc:rights>
<cc:Agent>
<dc:title>(c) Ad5001 2021 - All rights reserved</dc:title>
</cc:Agent>
</dc:rights>
</cc:Work>
<cc:License
rdf:about="http://creativecommons.org/licenses/by-nc-sa/4.0/">
<cc:permits
rdf:resource="http://creativecommons.org/ns#Reproduction" />
<cc:permits
rdf:resource="http://creativecommons.org/ns#Distribution" />
<cc:requires
rdf:resource="http://creativecommons.org/ns#Notice" />
<cc:requires
rdf:resource="http://creativecommons.org/ns#Attribution" />
<cc:prohibits
rdf:resource="http://creativecommons.org/ns#CommercialUse" />
<cc:permits
rdf:resource="http://creativecommons.org/ns#DerivativeWorks" />
<cc:requires
rdf:resource="http://creativecommons.org/ns#ShareAlike" />
</cc:License>
</rdf:RDF>
</metadata>
<g
inkscape:groupmode="layer"
id="layer2"
inkscape:label="Bg">
<rect
style="fill:#ffffff;fill-opacity:1;fill-rule:evenodd;stroke:none;stroke-width:0;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1"
id="rect1546"
width="24"
height="24"
x="0"
y="0"
ry="3" />
</g>
<g
inkscape:label="Calque 1"
inkscape:groupmode="layer"
id="layer1">
<rect
style="fill:#000000;fill-rule:evenodd;stroke-width:19.304;stroke-opacity:0"
id="rect1410"
width="22"
height="2"
x="1"
y="19" />
<rect
style="fill:#000000;fill-rule:evenodd;stroke-width:19.3041;stroke-opacity:0"
id="rect1412"
width="2"
height="22"
x="9"
y="1" />
<path
style="fill:none;fill-rule:evenodd;stroke:#ff0000;stroke-width:1.95063;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1"
id="path1529"
sodipodi:type="arc"
sodipodi:cx="1"
sodipodi:cy="1"
sodipodi:rx="20.024685"
sodipodi:ry="18.024683"
sodipodi:start="0"
sodipodi:end="1.5707963"
sodipodi:arc-type="arc"
d="M 21.024685,1 A 20.024685,18.024683 0 0 1 1,19.024683"
sodipodi:open="true" />
</g>
<svg id="SVGRoot" width="48" height="48" version="1.1" viewBox="0 0 48 48" xmlns="http://www.w3.org/2000/svg">
<title>LogarithmPlotter Icon v1.0</title>
<g fill-rule="evenodd" stroke-width="2">
<rect width="48" height="48" ry="6" fill="#fff"/>
<rect x="2" y="38" width="44" height="4" stroke-opacity="0"/>
<rect x="18" y="2" width="4" height="44" stroke-opacity="0"/>
</g>
<path d="M 42.05,2 A 40.05,36.05 0 0 1 2,38.05" fill="none" stroke="#f00" stroke-width="3.9012"/>
</svg>

Before

Width:  |  Height:  |  Size: 4 KiB

After

Width:  |  Height:  |  Size: 488 B

Before After
Before After

View file

@ -46,7 +46,7 @@ Column {
visible: Objects.types[modelData].createable()
height: visible ? implicitHeight : 0
display: AbstractButton.TextUnderIcon
icon.name: modelData
icon.name: Objects.types[modelData].displayType()
icon.width: 24
icon.height: 24
icon.color: sysPalette.windowText

View file

@ -60,13 +60,13 @@ ListView {
}
ToolTip.visible: hovered
ToolTip.text: checked ? `Hide all ${Objects.types[objType].typeMultiple()}` : `Show all ${Objects.types[objType].typeMultiple()}`
ToolTip.text: checked ? `Hide all ${Objects.types[objType].displayTypeMultiple()}` : `Show all ${Objects.types[objType].displayTypeMultiple()}`
}
Label {
id: typeHeaderText
verticalAlignment: TextInput.AlignVCenter
text: Objects.types[objType].typeMultiple() + ":"
text: Objects.types[objType].displayTypeMultiple() + ":"
font.pixelSize: 20
}
}

View file

@ -26,6 +26,8 @@ var history = null
var HistoryLib = null
function getNewName(allowedLetters) {
// Allows to get a new name, based on the allowed letters,
// as well as adding a sub number when needs be.
var newid = 0
var ret
do {
@ -40,11 +42,18 @@ function getNewName(allowedLetters) {
class DrawableObject {
// Class to extend for every type of object that
// can be drawn on the canvas.
// Base name of the object. Needs to be constant over time.
static type(){return 'Unknown'}
// (Potentially translated) name of the object to be shown to the user.
static displayType(){return 'Unknown'}
// Label used for the list on the ObjectsList sidebar.
static typeMultiple(){return 'Unknown'}
static displayTypeMultiple(){return 'Unknowns'}
// Whether this object can be created by the user
// or are instanciated by other objects.
// or are instantiated by other objects.
static createable() {return true}
// Properties are set with key as property name and
// value as it's type name (e.g 'Expression', 'string'...),
@ -117,7 +126,9 @@ class ExecutableObject extends DrawableObject {
class Point extends DrawableObject {
static type(){return 'Point'}
static typeMultiple(){return 'Points'}
static displayType(){return 'Point'}
static displayTypeMultiple(){return 'Points'}
static properties() {return {
'x': 'Expression',
'y': 'Expression',
@ -200,7 +211,8 @@ class Point extends DrawableObject {
class Function extends ExecutableObject {
static type(){return 'Function'}
static typeMultiple(){return 'Functions'}
static displayType(){return 'Function'}
static displayTypeMultiple(){return 'Functions'}
static properties() {return {
'expression': 'Expression',
'definitionDomain': 'Domain',
@ -353,7 +365,8 @@ class Function extends ExecutableObject {
class GainBode extends ExecutableObject {
static type(){return 'Gain Bode'}
static typeMultiple(){return 'Gains Bode'}
static displayType(){return 'Bode Magnitude'}
static displayTypeMultiple(){return 'Bode Magnitudes'}
static properties() {return {
'om_0': new P.ObjectType('Point'),
'pass': new P.Enum('high', 'low'),
@ -493,7 +506,8 @@ class GainBode extends ExecutableObject {
class SommeGainsBode extends DrawableObject {
static type(){return 'Somme gains Bode'}
static typeMultiple(){return 'Somme gains Bode'}
static displayType(){return 'Bode Magnitudes Sum'}
static displayTypeMultiple(){return 'Bode Magnitudes Sum'}
static createable() {return false}
static properties() {return {
'labelPosition': new P.Enum('above', 'below', 'left', 'right', 'above-left', 'above-right', 'below-left', 'below-right'),
@ -637,7 +651,8 @@ class SommeGainsBode extends DrawableObject {
class PhaseBode extends ExecutableObject {
static type(){return 'Phase Bode'}
static typeMultiple(){return 'Phases Bode'}
static displayType(){return 'Bode Phase'}
static displayTypeMultiple(){return 'Bode Phases'}
static properties() {return {
'om_0': new P.ObjectType('Point'),
'phase': 'Expression',
@ -767,7 +782,8 @@ class PhaseBode extends ExecutableObject {
class SommePhasesBode extends ExecutableObject {
static type(){return 'Somme phases Bode'}
static typeMultiple(){return 'Somme phases Bode'}
static displayType(){return 'Bode Phases Sum'}
static displayTypeMultiple(){return 'Bode Phases Sum'}
static createable() {return false}
static properties() {return {
'labelPosition': new P.Enum('above', 'below', 'left', 'right', 'above-left', 'above-right', 'below-left', 'below-right'),
@ -895,7 +911,8 @@ class SommePhasesBode extends ExecutableObject {
class XCursor extends DrawableObject {
static type(){return 'X Cursor'}
static typeMultiple(){return 'X Cursors'}
static displayType(){return 'X Cursor'}
static displayTypeMultiple(){return 'X Cursors'}
static properties() {
return {
'x': 'Expression',
@ -1026,7 +1043,8 @@ class XCursor extends DrawableObject {
class Sequence extends ExecutableObject {
static type(){return 'Sequence'}
static typeMultiple(){return 'Sequences'}
static displayType(){return 'Sequence'}
static displayTypeMultiple(){return 'Sequences'}
static properties() {return {
'drawPoints': 'boolean',
'drawDashedLines': 'boolean',
@ -1141,7 +1159,8 @@ class Sequence extends ExecutableObject {
class RepartitionFunction extends ExecutableObject {
static type(){return 'Repartition'}
static typeMultiple(){return 'Repartitions'}
static displayType(){return 'Repartition'}
static displayTypeMultiple(){return 'Repartition functions'}
static properties() {return {
'beginIncluded': 'boolean',
'drawLineEnds': 'boolean',
@ -1290,7 +1309,8 @@ class RepartitionFunction extends ExecutableObject {
class Text extends DrawableObject {
static type(){return 'Text'}
static typeMultiple(){return 'Texts'}
static displayType(){return 'Text'}
static displayTypeMultiple(){return 'Texts'}
static properties() {return {
'x': 'Expression',
'y': 'Expression',