Skip to content

Commit

Permalink
Fixed date formatter setting
Browse files Browse the repository at this point in the history
- The one thing I don't test and of course it broke
- Changed README a bit
- Added `--remove-output` to nuitka options
  • Loading branch information
Square789 committed Mar 17, 2022
1 parent 5386c63 commit 5ecb001
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 10 deletions.
2 changes: 1 addition & 1 deletion README.md
Expand Up @@ -29,7 +29,7 @@ python script that runs
`from demomgr.main_app import MainApp; MainApp()`.

### Installation instructions (exe):
There is an experimental [nuitka](https://nuitka.net/) build of Demomgr available in the "Releases" section, only for 64bit Windows.
There is an experimental [nuitka](https://nuitka.net/) build of Demomgr available in the "Releases" section for Windows.
Extract it to a good place for programs to be and run the contained `demomgr.exe`.

### Getting started:
Expand Down
9 changes: 3 additions & 6 deletions demomgr/helpers.py
Expand Up @@ -14,15 +14,12 @@
_CONVPREF_CENTER = 8


def build_date_formatter(cfg):
def build_date_formatter(fmt):
"""
Creates a date formatter method that takes an UNIX timestamp and
converts it to what's dictated by "date_fmt" in the supplied cfg
dict, value not bound to cfg as long as it's immutable.
converts it to what's dictated by the given `fmt`.
"""
# i sure hope that docstring is correct
dfmt = cfg.date_format
return lambda ts: datetime.datetime.fromtimestamp(ts).strftime(dfmt)
return lambda ts: datetime.datetime.fromtimestamp(ts).strftime(fmt)

def convertunit(inp, ext = "B"):
"""
Expand Down
6 changes: 3 additions & 3 deletions demomgr/main_app.py
Expand Up @@ -23,7 +23,7 @@
from demomgr.threadgroup import ThreadGroup, THREADGROUPSIG
from demomgr.threads import THREADSIG, ThreadFilter, ThreadReadFolder, ReadDemoMetaThread

__version__ = "1.9.0"
__version__ = "1.9.1"
__author__ = "Square789"

class DemoOp():
Expand Down Expand Up @@ -200,7 +200,7 @@ def _setupgui(self):
"dblclick_cmd": lambda _: self._managebookmarks()},
{"name": "Creation time", "col_id": "col_ctime", "sort": True,
"weight": round(0.9 * mfl.WEIGHT),
"formatter": build_date_formatter(self.cfg)},
"formatter": build_date_formatter(self.cfg.date_format)},
{"name": "Size", "col_id": "col_filesize", "sort": True,
"weight": round(0.42 * mfl.WEIGHT), "formatter": convertunit}
),
Expand Down Expand Up @@ -373,7 +373,7 @@ def _opensettings(self):
# what a hardcoded piece of garbage, there must be better ways
if self.cfg.date_format != dialog.result.data["date_format"]:
self.listbox.config_column(
"col_ctime", formatter = build_date_formatter(dialog.result.data)
"col_ctime", formatter = build_date_formatter(dialog.result.data["date_format"])
)
self.cfg.update(**dialog.result.data)
self.reloadgui()
Expand Down
1 change: 1 addition & 0 deletions setup_nuitka.py
Expand Up @@ -81,6 +81,7 @@ def main():
"--follow-imports",
"--plugin-enable=tk-inter",
f"--output-dir={build_dir}",
"--remove-output",
run_py,
))

Expand Down

0 comments on commit 5ecb001

Please sign in to comment.