✨ Add option to turn off internal filename (#3783)

Closes #3636
This commit is contained in:
Charlie Powell authored and GitHub committed 2020-10-26 15:14:12 +01:00
1 parent 60a40d55b6
commit b12e5a6e00
7 files changed
+33 -1

No files matched your search

+4
View File
@@ -124,6 +124,10 @@ appearance or to modify the order and presence of the various UI components:
# acrylic for its frame ;)
colorTransparent: false
# Show the internal filename in the files sidebar, if necessary
# UI change only
showInternalFilename: true
# Configures the order and availability of the UI components
components:
+6
View File
@@ -114,6 +114,7 @@ def getSettings():
"showFahrenheitAlso": s.getBoolean(["appearance", "showFahrenheitAlso"]),
"fuzzyTimes": s.getBoolean(["appearance", "fuzzyTimes"]),
"closeModalsWithClick": s.getBoolean(["appearance", "closeModalsWithClick"]),
"showInternalFilename": s.getBoolean(["appearance", "showInternalFilename"]),
},
"printer": {
"defaultExtrusionLength": s.getInt(
@@ -509,6 +510,11 @@ def _saveSettings(data):
["appearance", "closeModalsWithClick"],
data["appearance"]["closeModalsWithClick"],
)
if "showInternalFilename" in data["appearance"]:
s.setBoolean(
["appearance", "showInternalFilename"],
data["appearance"]["showInternalFilename"],
)
if "printer" in data:
if "defaultExtrusionLength" in data["printer"]:
+1
View File
@@ -304,6 +304,7 @@ default_settings = {
"showFahrenheitAlso": False,
"fuzzyTimes": True,
"closeModalsWithClick": True,
"showInternalFilename": True,
"components": {
"order": {
"navbar": [
@@ -10,6 +10,8 @@ $(function () {
self.access = parameters[5];
self.filesListVisible = ko.observable(true);
self.showInternalFilename = ko.observable(true);
self.isErrorOrClosed = ko.observable(undefined);
self.isOperational = ko.observable(undefined);
self.isPrinting = ko.observable(undefined);
@@ -1578,6 +1580,16 @@ $(function () {
self._dragNDropTarget = e.target;
self._dragNDropLastOver = Date.now();
};
self.onEventSettingsUpdated = function () {
self.showInternalFilename(
self.settingsViewModel.settings.appearance.showInternalFilename()
);
};
self.onBeforeBinding = function () {
self.showInternalFilename(
self.settingsViewModel.settings.appearance.showInternalFilename()
);
};
}
OCTOPRINT_VIEWMODELS.push({
@@ -144,6 +144,7 @@ $(function () {
self.appearance_showFahrenheitAlso = ko.observable(undefined);
self.appearance_fuzzyTimes = ko.observable(undefined);
self.appearance_closeModalsWithClick = ko.observable(undefined);
self.appearance_showInternalFilename = ko.observable(undefined);
self.printer_defaultExtrusionLength = ko.observable(undefined);
@@ -64,6 +64,13 @@
</label>
</div>
</div>
<div class="control-group">
<div class="controls">
<label class="checkbox">
<input type="checkbox" data-bind="checked: appearance_showInternalFilename" id="settings-appearanceShowInternalFilename"> {{ _('Show internal filename in the files sidebar (if available)') }}
</label>
</div>
</div>
</form>
<div id="settings_appearance_managelanguagesdialog" class="modal hide fade">
+2 -1
View File
@@ -17,7 +17,8 @@
<script type="text/html" id="files_template_machinecode">
<div class="btn btn-mini toggleAdditionalData pull-right" data-bind="click: function() { if ($root.enableAdditionalData($data)) { $root.toggleAdditionalData($data); } else { return; } }, css: { disabled: !$root.enableAdditionalData($data) }" title="{{ _('Additional data')|edq }}"><i class="fas fa-chevron-down"></i></div>
<div class="title clickable" data-bind="click: function() { if ($root.enableSelect($data)) { $root.loadFile($data, false); } else { return; } }, css: $root.getSuccessClass($data), style: { 'font-weight': $root.listHelper.isSelected($data) ? 'bold' : 'normal' }, text: display"></div>
<div class="internal" data-bind="visible: display && name != display">{{ _('Internal') }}: <span data-bind="text: name"></span></div>
<div class="internal" data-bind="visible: display && name != display && $root.showInternalFilename">{{ _('Internal') }}: <span data-bind="text: name"></span>
<span data-bind="text: $root.showInternalFilename"></span> </div>
<div class="uploaded">{{ _('Uploaded') }}: <span data-bind="text: formatTimeAgo(date), attr: {title: formatDate(date)}"></span></div>
<div class="size">{{ _('Size') }}: <span data-bind="text: formatSize(size)"></span></div>
<div class="additionalInfo hide" data-bind="html: $root.getAdditionalData($data)"></div>