diff --git a/panels/print.py b/panels/print.py index 6391ece1..ed6df69e 100644 --- a/panels/print.py +++ b/panels/print.py @@ -37,6 +37,9 @@ class PrintPanel(ScreenPanel): self.directories = {} self.labels['directories'] = {} self.labels['files'] = {} + self.time_24 = self._config.get_main_config().getboolean("24htime", True) + logging.info(f"24h time is {self.time_24}") + sbox = Gtk.Box(spacing=0) sbox.set_vexpand(False) for i, (name, val) in enumerate(self.sort_items.items(), start=1): @@ -120,11 +123,11 @@ class PrintPanel(ScreenPanel): curdir = os.path.join(*d[:i + 1]) if curdir != "gcodes" and fileinfo['modified'] > self.filelist[curdir]['modified']: self.filelist[curdir]['modified'] = fileinfo['modified'] - self.labels['directories'][curdir]['info'].set_markup( - '' + _("Modified") - + f' {datetime.fromtimestamp(fileinfo["modified"]):%Y-%m-%d %H:%M}' - ) - + if self.time_24: + time = f': {datetime.fromtimestamp(fileinfo["modified"]):%Y-%m-%d %H:%M}' + else: + time = f': {datetime.fromtimestamp(fileinfo["modified"]):%Y-%m-%d %I:%M %p}' + self.labels['directories'][curdir]['info'].set_markup(_("Modified") + time) self.filelist[directory]['files'].append(filename) if filepath not in self.files: @@ -146,6 +149,7 @@ class PrintPanel(ScreenPanel): def _create_row(self, fullpath, filename=None): name = Gtk.Label() + name.get_style_context().add_class("print-filename") if filename: name.set_markup(f'{os.path.splitext(filename)[0].replace("_", " ")}') else: @@ -157,6 +161,7 @@ class PrintPanel(ScreenPanel): info = Gtk.Label() info.set_halign(Gtk.Align.START) + info.get_style_context().add_class("print-info") labels = Gtk.Box(orientation=Gtk.Orientation.VERTICAL) labels.add(name) @@ -338,14 +343,16 @@ class PrintPanel(ScreenPanel): fileinfo = self._screen.files.get_file_info(filename) if fileinfo is None: return - info = '' + _("Uploaded") + f': {datetime.fromtimestamp(fileinfo["modified"]):%Y-%m-%d %H:%M}\n' + info = _("Uploaded") + if self.time_24: + info += f': {datetime.fromtimestamp(fileinfo["modified"]):%Y-%m-%d %H:%M}\n' + else: + info += f': {datetime.fromtimestamp(fileinfo["modified"]):%Y-%m-%d %I:%M %p}\n' if "size" in fileinfo: - info += _("Size") + f': {self.format_size(fileinfo["size"])}\n' + info += _("Size") + f': {self.format_size(fileinfo["size"])}\n' if "estimated_time" in fileinfo: - info += _("Print Time") + f': {self.format_time(fileinfo["estimated_time"])}' - info += "" - + info += _("Print Time") + f': {self.format_time(fileinfo["estimated_time"])}' return info def reload_files(self, widget=None): diff --git a/styles/base.css b/styles/base.css index 1b17a683..5b87d277 100644 --- a/styles/base.css +++ b/styles/base.css @@ -414,6 +414,16 @@ trough { font-size: 1.25em; } +.print-filename { + font-size: 1.1em; + margin-bottom: 0.2em; + +} + +.print-info { + font-size: 0.95em; +} + .tempbutton_top { border: .15em solid white; border-bottom: 0;