mirror of
https://github.com/naruxde/revpipycontrol.git
synced 2025-11-08 15:43:52 +01:00
Einstellungen vom Programmfenster werden gespeichert
This commit is contained in:
78
revpipycontrol.api
Normal file
78
revpipycontrol.api
Normal file
@@ -0,0 +1,78 @@
|
|||||||
|
revpicheckclient.RevPiCheckClient._autorw?5()
|
||||||
|
revpicheckclient.RevPiCheckClient._createiogroup?5(device, frame, iotype)
|
||||||
|
revpicheckclient.RevPiCheckClient._createwidgets?5()
|
||||||
|
revpicheckclient.RevPiCheckClient._readvaluesdev?5(device, iotype)
|
||||||
|
revpicheckclient.RevPiCheckClient._writevaluesdev?5(device)
|
||||||
|
revpicheckclient.RevPiCheckClient.myapp?7
|
||||||
|
revpicheckclient.RevPiCheckClient.onfrmconf?4(canvas)
|
||||||
|
revpicheckclient.RevPiCheckClient.readvalues?4()
|
||||||
|
revpicheckclient.RevPiCheckClient.root?7
|
||||||
|
revpicheckclient.RevPiCheckClient.toggleauto?4()
|
||||||
|
revpicheckclient.RevPiCheckClient.writevalues?4()
|
||||||
|
revpicheckclient.RevPiCheckClient?1(master, xmlcli)
|
||||||
|
revpilogfile.RevPiLogfile._createwidgets?5()
|
||||||
|
revpilogfile.RevPiLogfile.btn_clearapp?4()
|
||||||
|
revpilogfile.RevPiLogfile.btn_clearplc?4()
|
||||||
|
revpilogfile.RevPiLogfile.get_applines?4()
|
||||||
|
revpilogfile.RevPiLogfile.get_applog?4()
|
||||||
|
revpilogfile.RevPiLogfile.get_plclines?4()
|
||||||
|
revpilogfile.RevPiLogfile.get_plclog?4()
|
||||||
|
revpilogfile.RevPiLogfile?1(master, xmlcli)
|
||||||
|
revpioption.RevPiOption._createwidgets?5()
|
||||||
|
revpioption.RevPiOption._loadappdata?5()
|
||||||
|
revpioption.RevPiOption._setappdata?5()
|
||||||
|
revpioption.RevPiOption.askxmlon?4()
|
||||||
|
revpioption.RevPiOption.xmlmods?4()
|
||||||
|
revpioption.RevPiOption?1(master, xmlcli, xmlmode)
|
||||||
|
revpiplclist.RevPiPlcList._createwidgets?5()
|
||||||
|
revpiplclist.RevPiPlcList._loadappdata?5()
|
||||||
|
revpiplclist.RevPiPlcList._saveappdata?5()
|
||||||
|
revpiplclist.RevPiPlcList.build_listconn?4()
|
||||||
|
revpiplclist.RevPiPlcList.evt_btnadd?4()
|
||||||
|
revpiplclist.RevPiPlcList.evt_btnclose?4()
|
||||||
|
revpiplclist.RevPiPlcList.evt_btnnew?4()
|
||||||
|
revpiplclist.RevPiPlcList.evt_btnremove?4()
|
||||||
|
revpiplclist.RevPiPlcList.evt_btnsave?4()
|
||||||
|
revpiplclist.RevPiPlcList.evt_keypress?4(evt=None)
|
||||||
|
revpiplclist.RevPiPlcList.evt_listconn?4(evt=None)
|
||||||
|
revpiplclist.RevPiPlcList.myapp?7
|
||||||
|
revpiplclist.RevPiPlcList.root?7
|
||||||
|
revpiplclist.RevPiPlcList?1(master)
|
||||||
|
revpiplclist.get_connections?4()
|
||||||
|
revpiplclist.savefile?7
|
||||||
|
revpiprogram.RevPiProgram._createwidgets?5()
|
||||||
|
revpiprogram.RevPiProgram._evt_optdown?5(text="")
|
||||||
|
revpiprogram.RevPiProgram._evt_optup?5(text="")
|
||||||
|
revpiprogram.RevPiProgram._loaddefault?5(full=False)
|
||||||
|
revpiprogram.RevPiProgram._savedefaults?5()
|
||||||
|
revpiprogram.RevPiProgram.check_replacedir?4(rootdir)
|
||||||
|
revpiprogram.RevPiProgram.create_filelist?4(rootdir)
|
||||||
|
revpiprogram.RevPiProgram.getpictoryrsc?4()
|
||||||
|
revpiprogram.RevPiProgram.getprocimg?4()
|
||||||
|
revpiprogram.RevPiProgram.myapp?7
|
||||||
|
revpiprogram.RevPiProgram.plcdownload?4()
|
||||||
|
revpiprogram.RevPiProgram.plcupload?4()
|
||||||
|
revpiprogram.RevPiProgram.root?7
|
||||||
|
revpiprogram.RevPiProgram.setpictoryrsc?4(filename=None)
|
||||||
|
revpiprogram.RevPiProgram?1(master, xmlcli, xmlmode, revpi)
|
||||||
|
revpiprogram.savefile?7
|
||||||
|
revpipycontrol.RevPiPyControl._btnstate?5()
|
||||||
|
revpipycontrol.RevPiPyControl._closeall?5()
|
||||||
|
revpipycontrol.RevPiPyControl._createwidgets?5()
|
||||||
|
revpipycontrol.RevPiPyControl._fillconnbar?5()
|
||||||
|
revpipycontrol.RevPiPyControl._fillmbar?5()
|
||||||
|
revpipycontrol.RevPiPyControl._opt_conn?5(text)
|
||||||
|
revpipycontrol.RevPiPyControl.myapp?7
|
||||||
|
revpipycontrol.RevPiPyControl.plclist?4()
|
||||||
|
revpipycontrol.RevPiPyControl.plclogs?4()
|
||||||
|
revpipycontrol.RevPiPyControl.plcmonitor?4()
|
||||||
|
revpipycontrol.RevPiPyControl.plcoptions?4()
|
||||||
|
revpipycontrol.RevPiPyControl.plcprogram?4()
|
||||||
|
revpipycontrol.RevPiPyControl.plcrestart?4()
|
||||||
|
revpipycontrol.RevPiPyControl.plcstart?4()
|
||||||
|
revpipycontrol.RevPiPyControl.plcstop?4()
|
||||||
|
revpipycontrol.RevPiPyControl.root?7
|
||||||
|
revpipycontrol.RevPiPyControl.servererror?4()
|
||||||
|
revpipycontrol.RevPiPyControl.tmr_plcrunning?4()
|
||||||
|
revpipycontrol.RevPiPyControl?1(master=None)
|
||||||
|
revpipycontrol.addroot?4(filename)
|
||||||
6
revpipycontrol.bas
Normal file
6
revpipycontrol.bas
Normal file
@@ -0,0 +1,6 @@
|
|||||||
|
RevPiCheckClient tkinter.Frame
|
||||||
|
RevPiLogfile tkinter.Frame
|
||||||
|
RevPiOption tkinter.Frame
|
||||||
|
RevPiPlcList tkinter.Frame
|
||||||
|
RevPiProgram tkinter.Frame
|
||||||
|
RevPiPyControl tkinter.Frame
|
||||||
@@ -1,7 +1,7 @@
|
|||||||
<?xml version="1.0" encoding="UTF-8"?>
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
<!DOCTYPE Project SYSTEM "Project-5.1.dtd">
|
<!DOCTYPE Project SYSTEM "Project-5.1.dtd">
|
||||||
<!-- eric project file for project revpipycontrol -->
|
<!-- eric project file for project revpipycontrol -->
|
||||||
<!-- Saved: 2017-03-20, 12:10:47 -->
|
<!-- Saved: 2017-03-23, 10:40:08 -->
|
||||||
<!-- Copyright (C) 2017 Sven Sager, akira@narux.de -->
|
<!-- Copyright (C) 2017 Sven Sager, akira@narux.de -->
|
||||||
<Project version="5.1">
|
<Project version="5.1">
|
||||||
<Language>en_US</Language>
|
<Language>en_US</Language>
|
||||||
@@ -9,7 +9,7 @@
|
|||||||
<ProgLanguage mixed="0">Python3</ProgLanguage>
|
<ProgLanguage mixed="0">Python3</ProgLanguage>
|
||||||
<ProjectType>Console</ProjectType>
|
<ProjectType>Console</ProjectType>
|
||||||
<Description></Description>
|
<Description></Description>
|
||||||
<Version>0.2.7</Version>
|
<Version>0.2.8</Version>
|
||||||
<Author>Sven Sager</Author>
|
<Author>Sven Sager</Author>
|
||||||
<Email>akira@narux.de</Email>
|
<Email>akira@narux.de</Email>
|
||||||
<Eol index="-1"/>
|
<Eol index="-1"/>
|
||||||
@@ -29,6 +29,7 @@
|
|||||||
<Others>
|
<Others>
|
||||||
<Other>data</Other>
|
<Other>data</Other>
|
||||||
<Other>doc</Other>
|
<Other>doc</Other>
|
||||||
|
<Other>revpipycontrol.api</Other>
|
||||||
</Others>
|
</Others>
|
||||||
<MainScript>revpipycontrol/revpipycontrol.py</MainScript>
|
<MainScript>revpipycontrol/revpipycontrol.py</MainScript>
|
||||||
<Vcs>
|
<Vcs>
|
||||||
@@ -148,16 +149,79 @@
|
|||||||
<DocumentationParams>
|
<DocumentationParams>
|
||||||
<dict>
|
<dict>
|
||||||
<key>
|
<key>
|
||||||
<string>ERIC4DOC</string>
|
<string>ERIC4API</string>
|
||||||
</key>
|
</key>
|
||||||
<value>
|
<value>
|
||||||
<dict>
|
<dict>
|
||||||
|
<key>
|
||||||
|
<string>ignoreDirectories</string>
|
||||||
|
</key>
|
||||||
|
<value>
|
||||||
|
<list>
|
||||||
|
<string>data</string>
|
||||||
|
<string>deb</string>
|
||||||
|
<string>dist</string>
|
||||||
|
<string>doc</string>
|
||||||
|
</list>
|
||||||
|
</value>
|
||||||
<key>
|
<key>
|
||||||
<string>ignoreFilePatterns</string>
|
<string>ignoreFilePatterns</string>
|
||||||
</key>
|
</key>
|
||||||
<value>
|
<value>
|
||||||
<list>
|
<list>
|
||||||
<string></string>
|
<string>setup.py</string>
|
||||||
|
</list>
|
||||||
|
</value>
|
||||||
|
<key>
|
||||||
|
<string>includePrivate</string>
|
||||||
|
</key>
|
||||||
|
<value>
|
||||||
|
<bool>True</bool>
|
||||||
|
</value>
|
||||||
|
<key>
|
||||||
|
<string>languages</string>
|
||||||
|
</key>
|
||||||
|
<value>
|
||||||
|
<list>
|
||||||
|
<string>Python3</string>
|
||||||
|
</list>
|
||||||
|
</value>
|
||||||
|
<key>
|
||||||
|
<string>outputFile</string>
|
||||||
|
</key>
|
||||||
|
<value>
|
||||||
|
<string>revpipycontrol.api</string>
|
||||||
|
</value>
|
||||||
|
<key>
|
||||||
|
<string>useRecursion</string>
|
||||||
|
</key>
|
||||||
|
<value>
|
||||||
|
<bool>True</bool>
|
||||||
|
</value>
|
||||||
|
</dict>
|
||||||
|
</value>
|
||||||
|
<key>
|
||||||
|
<string>ERIC4DOC</string>
|
||||||
|
</key>
|
||||||
|
<value>
|
||||||
|
<dict>
|
||||||
|
<key>
|
||||||
|
<string>ignoreDirectories</string>
|
||||||
|
</key>
|
||||||
|
<value>
|
||||||
|
<list>
|
||||||
|
<string>data</string>
|
||||||
|
<string>deb</string>
|
||||||
|
<string>dist</string>
|
||||||
|
<string>doc</string>
|
||||||
|
</list>
|
||||||
|
</value>
|
||||||
|
<key>
|
||||||
|
<string>ignoreFilePatterns</string>
|
||||||
|
</key>
|
||||||
|
<value>
|
||||||
|
<list>
|
||||||
|
<string>setup.py</string>
|
||||||
</list>
|
</list>
|
||||||
</value>
|
</value>
|
||||||
<key>
|
<key>
|
||||||
|
|||||||
@@ -21,6 +21,7 @@ else:
|
|||||||
savefile = os.path.join(homedir, ".revpipyplc", "connections.dat")
|
savefile = os.path.join(homedir, ".revpipyplc", "connections.dat")
|
||||||
|
|
||||||
|
|
||||||
|
# Für andere Module zum Laden der Connections
|
||||||
def get_connections():
|
def get_connections():
|
||||||
if os.path.exists(savefile):
|
if os.path.exists(savefile):
|
||||||
fh = open(savefile, "rb")
|
fh = open(savefile, "rb")
|
||||||
|
|||||||
@@ -7,16 +7,28 @@
|
|||||||
# -*- coding: utf-8 -*-
|
# -*- coding: utf-8 -*-
|
||||||
import gzip
|
import gzip
|
||||||
import os
|
import os
|
||||||
|
import pickle
|
||||||
import tarfile
|
import tarfile
|
||||||
import tkinter
|
import tkinter
|
||||||
import tkinter.filedialog as tkfd
|
import tkinter.filedialog as tkfd
|
||||||
import tkinter.messagebox as tkmsg
|
import tkinter.messagebox as tkmsg
|
||||||
import zipfile
|
import zipfile
|
||||||
|
from os import environ
|
||||||
|
from os import makedirs
|
||||||
from shutil import rmtree
|
from shutil import rmtree
|
||||||
|
from sys import platform
|
||||||
from tempfile import mktemp, mkdtemp
|
from tempfile import mktemp, mkdtemp
|
||||||
from xmlrpc.client import Binary
|
from xmlrpc.client import Binary
|
||||||
|
|
||||||
|
|
||||||
|
# Systemwerte
|
||||||
|
if platform == "linux":
|
||||||
|
homedir = environ["HOME"]
|
||||||
|
else:
|
||||||
|
homedir = environ["APPDATA"]
|
||||||
|
savefile = os.path.join(homedir, ".revpipyplc", "programpath.dat")
|
||||||
|
|
||||||
|
|
||||||
class RevPiProgram(tkinter.Frame):
|
class RevPiProgram(tkinter.Frame):
|
||||||
|
|
||||||
def __init__(self, master, xmlcli, xmlmode, revpi):
|
def __init__(self, master, xmlcli, xmlmode, revpi):
|
||||||
@@ -33,6 +45,9 @@ class RevPiProgram(tkinter.Frame):
|
|||||||
self.xmlmode = xmlmode
|
self.xmlmode = xmlmode
|
||||||
self.xmlstate = "normal" if xmlmode == 3 else "disabled"
|
self.xmlstate = "normal" if xmlmode == 3 else "disabled"
|
||||||
|
|
||||||
|
# Letzte Einstellungen übernehmen
|
||||||
|
self.opt = self._loaddefault()
|
||||||
|
|
||||||
# Fenster bauen
|
# Fenster bauen
|
||||||
self._createwidgets()
|
self._createwidgets()
|
||||||
|
|
||||||
@@ -73,8 +88,10 @@ class RevPiProgram(tkinter.Frame):
|
|||||||
|
|
||||||
self.lst_typedown = ["Dateien", "Zip Archiv", "TGZ Archiv"]
|
self.lst_typedown = ["Dateien", "Zip Archiv", "TGZ Archiv"]
|
||||||
self.lst_typeup = ["Dateien", "Ordner", "Zip Archiv", "TGZ Archiv"]
|
self.lst_typeup = ["Dateien", "Ordner", "Zip Archiv", "TGZ Archiv"]
|
||||||
self.var_typedown.set(self.lst_typedown[0])
|
self.var_picdown.set(self.opt.get("picdown", False))
|
||||||
self.var_typeup.set(self.lst_typeup[0])
|
self.var_picup.set(self.opt.get("picup", False))
|
||||||
|
self.var_typedown.set(self.opt.get("typedown", self.lst_typedown[0]))
|
||||||
|
self.var_typeup.set(self.opt.get("typeup", self.lst_typeup[0]))
|
||||||
|
|
||||||
r = 0
|
r = 0
|
||||||
lbl = tkinter.Label(prog)
|
lbl = tkinter.Label(prog)
|
||||||
@@ -181,20 +198,35 @@ class RevPiProgram(tkinter.Frame):
|
|||||||
else:
|
else:
|
||||||
self.ckb_picup["state"] = "normal"
|
self.ckb_picup["state"] = "normal"
|
||||||
|
|
||||||
def _loaddefault(self):
|
def _loaddefault(self, full=False):
|
||||||
# TODO: letzte Einstellungen laden
|
"""Uebernimmt fuer den Pi die letzen Pfade."""
|
||||||
pass
|
if os.path.exists(savefile):
|
||||||
|
fh = open(savefile, "rb")
|
||||||
|
dict_all = pickle.load(fh)
|
||||||
|
if full:
|
||||||
|
return dict_all
|
||||||
|
else:
|
||||||
|
return dict_all.get(self.revpi, {})
|
||||||
|
return {}
|
||||||
|
|
||||||
def _savedefaults(self):
|
def _savedefaults(self):
|
||||||
# TODO: Einstellungen sichern
|
"""Schreibt fuer den Pi die letzen Pfade."""
|
||||||
pass
|
try:
|
||||||
|
makedirs(os.path.dirname(savefile), exist_ok=True)
|
||||||
|
dict_all = self._loaddefault(full=True)
|
||||||
|
dict_all[self.revpi] = self.opt
|
||||||
|
fh = open(savefile, "wb")
|
||||||
|
pickle.dump(dict_all, fh)
|
||||||
|
self.changes = False
|
||||||
|
except:
|
||||||
|
return False
|
||||||
|
return True
|
||||||
|
|
||||||
def create_filelist(self, rootdir):
|
def create_filelist(self, rootdir):
|
||||||
"""Erstellt eine Dateiliste von einem Verzeichnis.
|
"""Erstellt eine Dateiliste von einem Verzeichnis.
|
||||||
@param rootdir: Verzeichnis fuer das eine Liste erstellt werden soll
|
@param rootdir: Verzeichnis fuer das eine Liste erstellt werden soll
|
||||||
@returns: Dateiliste"""
|
@returns: Dateiliste"""
|
||||||
filelist = []
|
filelist = []
|
||||||
print(rootdir)
|
|
||||||
for tup_dir in os.walk(rootdir):
|
for tup_dir in os.walk(rootdir):
|
||||||
for fname in tup_dir[2]:
|
for fname in tup_dir[2]:
|
||||||
filelist.append(os.path.join(tup_dir[0], fname))
|
filelist.append(os.path.join(tup_dir[0], fname))
|
||||||
@@ -210,7 +242,6 @@ class RevPiProgram(tkinter.Frame):
|
|||||||
|
|
||||||
"""
|
"""
|
||||||
lst_dir = os.listdir(rootdir)
|
lst_dir = os.listdir(rootdir)
|
||||||
print(rootdir)
|
|
||||||
if len(lst_dir) == 1 and \
|
if len(lst_dir) == 1 and \
|
||||||
os.path.isdir(os.path.join(rootdir, lst_dir[0])):
|
os.path.isdir(os.path.join(rootdir, lst_dir[0])):
|
||||||
return (os.path.join(rootdir, lst_dir[0]), None)
|
return (os.path.join(rootdir, lst_dir[0]), None)
|
||||||
@@ -230,6 +261,7 @@ class RevPiProgram(tkinter.Frame):
|
|||||||
mode="wb", parent=self.master,
|
mode="wb", parent=self.master,
|
||||||
confirmoverwrite=True,
|
confirmoverwrite=True,
|
||||||
title="Speichern als...",
|
title="Speichern als...",
|
||||||
|
initialdir=self.opt.get("getpictoryrsc_dir", ""),
|
||||||
initialfile=self.revpi + ".rsc",
|
initialfile=self.revpi + ".rsc",
|
||||||
filetypes=(("piCtory Config", "*.rsc"), ("All Files", "*.*"))
|
filetypes=(("piCtory Config", "*.rsc"), ("All Files", "*.*"))
|
||||||
)
|
)
|
||||||
@@ -248,6 +280,9 @@ class RevPiProgram(tkinter.Frame):
|
|||||||
message="Datei erfolgreich vom Revolution Pi geladen "
|
message="Datei erfolgreich vom Revolution Pi geladen "
|
||||||
"und gespeichert.",
|
"und gespeichert.",
|
||||||
)
|
)
|
||||||
|
# Einstellungen speichern
|
||||||
|
self.opt["getpictoryrsc_dir"] = os.path.dirname(fh.name)
|
||||||
|
self._savedefaults()
|
||||||
finally:
|
finally:
|
||||||
fh.close()
|
fh.close()
|
||||||
|
|
||||||
@@ -256,6 +291,7 @@ class RevPiProgram(tkinter.Frame):
|
|||||||
mode="wb", parent=self.master,
|
mode="wb", parent=self.master,
|
||||||
confirmoverwrite=True,
|
confirmoverwrite=True,
|
||||||
title="Speichern als...",
|
title="Speichern als...",
|
||||||
|
initialdir=self.opt.get("getprocimg_dir", ""),
|
||||||
initialfile=self.revpi + ".img",
|
initialfile=self.revpi + ".img",
|
||||||
filetypes=(("Imagefiles", "*.img"), ("All Files", "*.*"))
|
filetypes=(("Imagefiles", "*.img"), ("All Files", "*.*"))
|
||||||
)
|
)
|
||||||
@@ -274,6 +310,9 @@ class RevPiProgram(tkinter.Frame):
|
|||||||
message="Datei erfolgreich vom Revolution Pi geladen "
|
message="Datei erfolgreich vom Revolution Pi geladen "
|
||||||
"und gespeichert.",
|
"und gespeichert.",
|
||||||
)
|
)
|
||||||
|
# Einstellungen speichern
|
||||||
|
self.opt["getprocimg_dir"] = os.path.dirname(fh.name)
|
||||||
|
self._savedefaults()
|
||||||
finally:
|
finally:
|
||||||
fh.close()
|
fh.close()
|
||||||
|
|
||||||
@@ -282,6 +321,7 @@ class RevPiProgram(tkinter.Frame):
|
|||||||
fh = tkfd.askopenfile(
|
fh = tkfd.askopenfile(
|
||||||
mode="rb", parent=self.master,
|
mode="rb", parent=self.master,
|
||||||
title="piCtory Datei öffnen...",
|
title="piCtory Datei öffnen...",
|
||||||
|
initialdir=self.opt.get("setpictoryrsc_dir", ""),
|
||||||
initialfile=self.revpi + ".rsc",
|
initialfile=self.revpi + ".rsc",
|
||||||
filetypes=(("piCtory Config", "*.rsc"), ("All Files", "*.*"))
|
filetypes=(("piCtory Config", "*.rsc"), ("All Files", "*.*"))
|
||||||
)
|
)
|
||||||
@@ -309,6 +349,10 @@ class RevPiProgram(tkinter.Frame):
|
|||||||
parent=self.master, title="Erfolgreich",
|
parent=self.master, title="Erfolgreich",
|
||||||
message="Die Übertragung der piCtory Konfiguration "
|
message="Die Übertragung der piCtory Konfiguration "
|
||||||
"wurde erfolgreich ausgeführt")
|
"wurde erfolgreich ausgeführt")
|
||||||
|
|
||||||
|
#Einstellungen speichern
|
||||||
|
self.opt["setpictoryrsc_dir"] = os.path.dirname(fh.name)
|
||||||
|
self._savedefaults()
|
||||||
elif ec < 0:
|
elif ec < 0:
|
||||||
tkmsg.showerror(
|
tkmsg.showerror(
|
||||||
parent=self.master, title="Fehler",
|
parent=self.master, title="Fehler",
|
||||||
@@ -331,8 +375,11 @@ class RevPiProgram(tkinter.Frame):
|
|||||||
if tdown == 0:
|
if tdown == 0:
|
||||||
# Ordner
|
# Ordner
|
||||||
dirselect = tkfd.askdirectory(
|
dirselect = tkfd.askdirectory(
|
||||||
parent=self.master, title="Verzeichnis zum Ablegen",
|
parent=self.master,
|
||||||
mustexist=False, initialdir=self.revpi)
|
title="Verzeichnis zum Ablegen",
|
||||||
|
mustexist=False,
|
||||||
|
initialdir=self.opt.get("plcdownload_dir", self.revpi)
|
||||||
|
)
|
||||||
|
|
||||||
if type(dirselect) == str and dirselect != "":
|
if type(dirselect) == str and dirselect != "":
|
||||||
fh = open(mktemp(), "wb")
|
fh = open(mktemp(), "wb")
|
||||||
@@ -343,6 +390,7 @@ class RevPiProgram(tkinter.Frame):
|
|||||||
mode="wb", parent=self.master,
|
mode="wb", parent=self.master,
|
||||||
confirmoverwrite=True,
|
confirmoverwrite=True,
|
||||||
title="Speichern als...",
|
title="Speichern als...",
|
||||||
|
initialdir=self.opt.get("plcdownload_file", ""),
|
||||||
initialfile=self.revpi + ".zip",
|
initialfile=self.revpi + ".zip",
|
||||||
filetypes=(("Zip Archiv", "*.zip"), ("All Files", "*.*"))
|
filetypes=(("Zip Archiv", "*.zip"), ("All Files", "*.*"))
|
||||||
)
|
)
|
||||||
@@ -353,6 +401,7 @@ class RevPiProgram(tkinter.Frame):
|
|||||||
mode="wb", parent=self.master,
|
mode="wb", parent=self.master,
|
||||||
confirmoverwrite=True,
|
confirmoverwrite=True,
|
||||||
title="Speichern als...",
|
title="Speichern als...",
|
||||||
|
initialdir=self.opt.get("plcdownload_file", ""),
|
||||||
initialfile=self.revpi + ".tar.gz",
|
initialfile=self.revpi + ".tar.gz",
|
||||||
filetypes=(("Tar Archiv", "*.tar.gz"), ("All Files", "*.*"))
|
filetypes=(("Tar Archiv", "*.tar.gz"), ("All Files", "*.*"))
|
||||||
)
|
)
|
||||||
@@ -383,6 +432,11 @@ class RevPiProgram(tkinter.Frame):
|
|||||||
fh_pack.extract(taritem, dirselect)
|
fh_pack.extract(taritem, dirselect)
|
||||||
|
|
||||||
fh_pack.close()
|
fh_pack.close()
|
||||||
|
self.opt["plcdownload_dir"] = dirselect
|
||||||
|
else:
|
||||||
|
self.opt["plcdownload_file"] = os.path.dirname(fh.name)
|
||||||
|
self.opt["typedown"] = self.var_typedown.get()
|
||||||
|
self.opt["picdown"] = self.var_picdown.get()
|
||||||
|
|
||||||
except:
|
except:
|
||||||
raise
|
raise
|
||||||
@@ -397,6 +451,9 @@ class RevPiProgram(tkinter.Frame):
|
|||||||
message="Datei erfolgreich vom Revolution Pi geladen "
|
message="Datei erfolgreich vom Revolution Pi geladen "
|
||||||
"und gespeichert.",
|
"und gespeichert.",
|
||||||
)
|
)
|
||||||
|
|
||||||
|
# Einstellungen speichern
|
||||||
|
self._savedefaults()
|
||||||
finally:
|
finally:
|
||||||
fh.close()
|
fh.close()
|
||||||
|
|
||||||
@@ -405,12 +462,15 @@ class RevPiProgram(tkinter.Frame):
|
|||||||
dirselect = ""
|
dirselect = ""
|
||||||
dirtmp = None
|
dirtmp = None
|
||||||
filelist = []
|
filelist = []
|
||||||
|
fileselect = None
|
||||||
rscfile = None
|
rscfile = None
|
||||||
|
|
||||||
if tup == 0:
|
if tup == 0:
|
||||||
# Datei
|
# Datei
|
||||||
fileselect = tkfd.askopenfilenames(
|
fileselect = tkfd.askopenfilenames(
|
||||||
parent=self.master, title="Python Programm übertragen...",
|
parent=self.master,
|
||||||
|
title="Python Programm übertragen...",
|
||||||
|
initialdir=self.opt.get("plcupload_dir", ""),
|
||||||
filetypes=(("Python", "*.py"), ("All Files", "*.*"))
|
filetypes=(("Python", "*.py"), ("All Files", "*.*"))
|
||||||
)
|
)
|
||||||
if type(fileselect) == tuple and len(fileselect) > 0:
|
if type(fileselect) == tuple and len(fileselect) > 0:
|
||||||
@@ -420,16 +480,20 @@ class RevPiProgram(tkinter.Frame):
|
|||||||
elif tup == 1:
|
elif tup == 1:
|
||||||
# Ordner
|
# Ordner
|
||||||
dirselect = tkfd.askdirectory(
|
dirselect = tkfd.askdirectory(
|
||||||
parent=self.master, title="Verzeichnis zum Hochladen",
|
parent=self.master,
|
||||||
mustexist=True, initialdir=self.revpi)
|
title="Verzeichnis zum Hochladen",
|
||||||
|
mustexist=True,
|
||||||
|
initialdir=self.opt.get("plcupload_dir", self.revpi)
|
||||||
|
)
|
||||||
if type(dirselect) == str and dirselect != "":
|
if type(dirselect) == str and dirselect != "":
|
||||||
filelist = self.create_filelist(dirselect)
|
filelist = self.create_filelist(dirselect)
|
||||||
|
|
||||||
elif tup == 2:
|
elif tup == 2:
|
||||||
# Zip
|
# Zip
|
||||||
fileselect = tkfd.askopenfilename(
|
fileselect = tkfd.askopenfilename(
|
||||||
parent=self.master, title="Zip-Archive übertragen...",
|
parent=self.master,
|
||||||
|
title="Zip-Archive übertragen...",
|
||||||
|
initialdir=self.opt.get("plcupload_file", ""),
|
||||||
initialfile=self.revpi + ".zip",
|
initialfile=self.revpi + ".zip",
|
||||||
filetypes=(("Zip Archiv", "*.zip"), ("All Files", "*.*"))
|
filetypes=(("Zip Archiv", "*.zip"), ("All Files", "*.*"))
|
||||||
)
|
)
|
||||||
@@ -453,7 +517,9 @@ class RevPiProgram(tkinter.Frame):
|
|||||||
elif tup == 3:
|
elif tup == 3:
|
||||||
# TarGz
|
# TarGz
|
||||||
fileselect = tkfd.askopenfilename(
|
fileselect = tkfd.askopenfilename(
|
||||||
parent=self.master, title="TarGz-Archiv übertragen...",
|
parent=self.master,
|
||||||
|
title="TarGz-Archiv übertragen...",
|
||||||
|
initialdir=self.opt.get("plcupload_file", ""),
|
||||||
initialfile=self.revpi + ".tar.gz",
|
initialfile=self.revpi + ".tar.gz",
|
||||||
filetypes=(("Tar Archiv", "*.tar.gz"), ("All Files", "*.*"))
|
filetypes=(("Tar Archiv", "*.tar.gz"), ("All Files", "*.*"))
|
||||||
)
|
)
|
||||||
@@ -531,6 +597,18 @@ class RevPiProgram(tkinter.Frame):
|
|||||||
message="Es wurde im Archiv keine piCtory "
|
message="Es wurde im Archiv keine piCtory "
|
||||||
"Konfiguration gefunden")
|
"Konfiguration gefunden")
|
||||||
|
|
||||||
|
# Einstellungen speichern
|
||||||
|
if tup == 0:
|
||||||
|
self.opt["plcupload_dir"] = os.path.dirname(fileselect[0])
|
||||||
|
elif tup == 1:
|
||||||
|
self.opt["plcupload_dir"] = dirselect
|
||||||
|
else:
|
||||||
|
self.opt["plcupload_file"] = os.path.dirname(fileselect)
|
||||||
|
|
||||||
|
self.opt["typeup"] = self.var_typeup.get()
|
||||||
|
self.opt["picup"] = self.var_picup.get()
|
||||||
|
self._savedefaults()
|
||||||
|
|
||||||
elif ec == -1:
|
elif ec == -1:
|
||||||
tkmsg.showerror(
|
tkmsg.showerror(
|
||||||
parent=self.master, title="Fehler",
|
parent=self.master, title="Fehler",
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
#!/usr/bin/python3
|
#!/usr/bin/python3
|
||||||
#
|
#
|
||||||
# RevPiPyControl
|
# RevPiPyControl
|
||||||
# Version: 0.2.7
|
# Version: 0.2.8
|
||||||
#
|
#
|
||||||
# Webpage: https://revpimodio.org/revpipyplc/
|
# Webpage: https://revpimodio.org/revpipyplc/
|
||||||
# (c) Sven Sager, License: LGPLv3
|
# (c) Sven Sager, License: LGPLv3
|
||||||
|
|||||||
2
setup.py
2
setup.py
@@ -23,7 +23,7 @@ globsetup = {
|
|||||||
"author_email": "akira@narux.de",
|
"author_email": "akira@narux.de",
|
||||||
"url": "https://revpimodio.org/revpipyplc/",
|
"url": "https://revpimodio.org/revpipyplc/",
|
||||||
"license": "LGPLv3",
|
"license": "LGPLv3",
|
||||||
"version": "0.2.7",
|
"version": "0.2.8",
|
||||||
|
|
||||||
"name": "revpipycontrol",
|
"name": "revpipycontrol",
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user