Merge branch 'pr/2606' into maintenance
This commit is contained in:
commit
cd3acfb384
4 files changed
+14
-5
No files matched your search
@@ -24,7 +24,7 @@ __copyright__ = "Copyright (C) 2014 The OctoPrint Project - Released under terms
|
||||
import re
|
||||
|
||||
from octoprint.settings import settings
|
||||
from octoprint.util import deprecated
|
||||
from octoprint.util import deprecated, natural_key
|
||||
from octoprint.filemanager import FileDestinations
|
||||
|
||||
|
||||
@@ -68,8 +68,8 @@ class PrinterInterface(object):
|
||||
"""
|
||||
import octoprint.util.comm as comm
|
||||
return {
|
||||
"ports": comm.serialList(),
|
||||
"baudrates": comm.baudrateList(),
|
||||
"ports": sorted(comm.serialList(), key=natural_key),
|
||||
"baudrates": sorted(comm.baudrateList(), reverse=True),
|
||||
"portPreference": settings().get(["serial", "port"]),
|
||||
"baudratePreference": settings().getInt(["serial", "baudrate"]),
|
||||
"autoconnect": settings().getBoolean(["serial", "autoconnect"])
|
||||
|
||||
@@ -78,8 +78,8 @@ def _get_options():
|
||||
default_profile = printerProfileManager.get_default()
|
||||
|
||||
options = dict(
|
||||
ports=sorted(connection_options["ports"]),
|
||||
baudrates=sorted(connection_options["baudrates"], reverse=True),
|
||||
ports=connection_options["ports"],
|
||||
baudrates=connection_options["baudrates"],
|
||||
printerProfiles=[dict(id=printer_profile["id"], name=printer_profile["name"] if "name" in printer_profile else printer_profile["id"]) for printer_profile in profile_options.values() if "id" in printer_profile],
|
||||
portPreference=connection_options["portPreference"],
|
||||
baudratePreference=connection_options["baudratePreference"],
|
||||
|
||||
@@ -151,6 +151,10 @@ $(function() {
|
||||
}
|
||||
};
|
||||
|
||||
self.onEventSettingsUpdated = function() {
|
||||
self.requestData();
|
||||
}
|
||||
|
||||
self.onStartup = function() {
|
||||
var connectionTab = $("#connection");
|
||||
connectionTab.on("show", function() {
|
||||
|
||||
@@ -1586,3 +1586,8 @@ class CaseInsensitiveSet(collections.Set):
|
||||
|
||||
def __len__(self):
|
||||
return len(self.data)
|
||||
|
||||
|
||||
# originally from https://stackoverflow.com/a/5967539
|
||||
def natural_key(text):
|
||||
return [ int(c) if c.isdigit() else c for c in re.split("(\d+)", text) ]
|
||||
Reference in new issue
Block a user