Skip to content

Commit

Permalink
improve unmapped settings workflow
Browse files Browse the repository at this point in the history
  • Loading branch information
Kriechi committed Jan 11, 2021
1 parent 5cd5f42 commit 77bf3df
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 16 deletions.
29 changes: 15 additions & 14 deletions DuetRRFPlugin.py
Original file line number Diff line number Diff line change
Expand Up @@ -70,21 +70,22 @@ def _showUnmappedSettingsMessage(self):
"→ click on 'Connect Duet RepRapFirmware'\n"
"\n"
"You can can delete unmapped settings of unknown printers via:\n"
"→ Extensions menu → DuetRRF → Delete unmapped settings\n"
"\n"
"You have unmapped settings for unknown printers:\n"
"→ Extensions menu → DuetRRF → Delete unmapped settings"
)
for printer_id, data in self._found_unmapped.items():
t = " {}:\n".format(printer_id)
if "url" in data and data["url"].strip():
t += "→ URL: {}\n".format(data["url"])
if "duet_password" in data and data["duet_password"].strip():
t += "→ Duet password: {}\n".format(data["duet_password"])
if "http_username" in data and data["http_username"].strip():
t += "→ HTTP Basic username: {}\n".format(data["http_username"])
if "http_password" in data and data["http_password"].strip():
t += "→ HTTP Basic password: {}\n".format(data["http_password"])
msg += t
if self._found_unmapped:
msg += "\n\n"
msg += "You have unmapped settings for unknown printers:\n"
for printer_id, data in self._found_unmapped.items():
t = " {}:\n".format(printer_id)
if "url" in data and data["url"].strip():
t += "→ URL: {}\n".format(data["url"])
if "duet_password" in data and data["duet_password"].strip():
t += "→ Duet password: {}\n".format(data["duet_password"])
if "http_username" in data and data["http_username"].strip():
t += "→ HTTP Basic username: {}\n".format(data["http_username"])
if "http_password" in data and data["http_password"].strip():
t += "→ HTTP Basic password: {}\n".format(data["http_password"])
msg += t

message = Message(
msg,
Expand Down
6 changes: 4 additions & 2 deletions DuetRRFSettings.py
Original file line number Diff line number Diff line change
Expand Up @@ -38,8 +38,10 @@ def save_config(url, duet_password, http_user, http_password):
p.setValue(DUETRRF_SETTINGS, json.dumps(s))
return s

def delete_config():
s, printer_id = _load_prefs()
def delete_config(printer_id=None):
s, active_printer_id = _load_prefs()
if not printer_id:
printer_id = active_printer_id
if printer_id in s:
del s[printer_id]
application = CuraApplication.getInstance()
Expand Down

0 comments on commit 77bf3df

Please sign in to comment.