Skip to content

Commit

Permalink
Merge pull request #262 from jeanslack/column_width
Browse files Browse the repository at this point in the history
column width storing
  • Loading branch information
jeanslack committed Feb 8, 2024
2 parents 2eee314 + f7b7f7e commit a74092c
Show file tree
Hide file tree
Showing 12 changed files with 104 additions and 45 deletions.
10 changes: 9 additions & 1 deletion CHANGELOG
Expand Up @@ -7,7 +7,7 @@ License: GPL3
Change Log:

+------------------------------------+
Tue, 07 Feb 2024 V.5.0.5
Tue, 08 Feb 2024 V.5.0.5

* Fixed `ValueError: could not convert string to float: 'N/A'` given by the
`get_milliseconds()` function.
Expand All @@ -17,6 +17,14 @@ Tue, 07 Feb 2024 V.5.0.5
rounded to time second values.
* Replace `milliseconds2clock` and `milliseconds2clocksec` to
new `integer_to_time` function.
* [Presets Manager] Saves the width of the profile columns when you close
the app (see #260 and #113 issues).
* [Queued Files] Saves the width of the file columns when you close
the app (see #260 and #113 issues).
* [YouTube Downloader] Saves the width of the format code columns when you
close the app (see #260 and #113 issues).
* Fixed small bug in preferences dialog causing FFmpeg binaries to be set
incorrectly (self.settings['ffprobe_cmd'] > self.settings['ffplay_cmd']) .


+------------------------------------+
Expand Down
4 changes: 1 addition & 3 deletions TODO
Expand Up @@ -21,7 +21,7 @@ URGENCY: high
URGENCY: medium
----------------
- If you plan to refactor code and make it compatible only for wx.Python>=4.1.1:
- then erase `TestListCtrl` class on `youtubedl_ui.py` file.
- then erase `TestListCtrl` class on `formatcode.py` file.
- Also check all code that starts with `wx.version()` keywords.
- Erase these block codes along any py-files:

Expand All @@ -37,5 +37,3 @@ URGENCY: medium
URGENCY: low (New implementations)
-------------
- [PRESETS MANAGER] The profile requires additional input (-i FILE -i FILE ...)
- @johannesdedoper would like a function to save some UI settings, see #113 .

11 changes: 9 additions & 2 deletions debian/changelog
Expand Up @@ -8,8 +8,15 @@ videomass (5.0.5-1) UNRELEASED; urgency=medium
rounded to time second values.
* Replace `milliseconds2clock` and `milliseconds2clocksec` to
new `integer_to_time` function.

-- Gianluca Pernigotto <jeanlucperni@gmail.com> Wed, 07 Feb 2024 11:30:00 +0200
* [Presets Manager] Saves the width of the profile columns when you close
the app (see #260 and #113 issues).
* [Queued Files] Saves the width of the file columns when you close
the app (see #260 and #113 issues).
* [YouTube Downloader] Saves the width of the format code columns when you
close the app (see #260 and #113 issues).
* Fixed small bug in preferences dialog causing FFmpeg binaries to be set
incorrectly self.settings['ffprobe_cmd'] > self.settings['ffplay_cmd']) .
-- Gianluca Pernigotto <jeanlucperni@gmail.com> Thu, 08 Feb 2024 00:15:00 +0200

videomass (5.0.4-1) UNRELEASED; urgency=high

Expand Down
4 changes: 2 additions & 2 deletions videomass/vdms_dialogs/preferences.py
Expand Up @@ -6,7 +6,7 @@
Author: Gianluca Pernigotto <jeanlucperni@gmail.com>
Copyleft - 2024 Gianluca Pernigotto <jeanlucperni@gmail.com>
license: GPL3
Rev: July.17.2023
Rev: Feb.08.2024
Code checker: flake8, pylint
This file is part of Videomass.
Expand Down Expand Up @@ -865,7 +865,7 @@ def exeFFplay(self, event):
self.txtctrl_ffplay.Clear()
getpath = self.appdata['getpath'](status[1])
self.txtctrl_ffplay.write(getpath)
self.settings['ffprobe_cmd'] = getpath
self.settings['ffplay_cmd'] = getpath
# --------------------------------------------------------------------#

def open_path_ffplay(self, event):
Expand Down
16 changes: 15 additions & 1 deletion videomass/vdms_main/main_frame.py
Expand Up @@ -6,7 +6,7 @@
Author: Gianluca Pernigotto <jeanlucperni@gmail.com>
Copyleft - 2024 Gianluca Pernigotto <jeanlucperni@gmail.com>
license: GPL3
Rev: Feb.13.2023
Rev: Feb.07.2024
Code checker: flake8, pylint
This file is part of Videomass.
Expand Down Expand Up @@ -366,6 +366,20 @@ def on_close(self, event):
sett = confmanager.read_options()
sett['main_window_size'] = list(self.GetSize())
sett['main_window_pos'] = list(self.GetPosition())
prstcolwidth = [self.PrstsPanel.lctrl.GetColumnWidth(0),
self.PrstsPanel.lctrl.GetColumnWidth(1),
self.PrstsPanel.lctrl.GetColumnWidth(2),
self.PrstsPanel.lctrl.GetColumnWidth(3),
]
sett['prstmng_column_width'] = prstcolwidth
filedropcolwidth = [self.fileDnDTarget.flCtrl.GetColumnWidth(0),
self.fileDnDTarget.flCtrl.GetColumnWidth(1),
self.fileDnDTarget.flCtrl.GetColumnWidth(2),
self.fileDnDTarget.flCtrl.GetColumnWidth(3),
self.fileDnDTarget.flCtrl.GetColumnWidth(4),
self.fileDnDTarget.flCtrl.GetColumnWidth(5),
]
sett['filedrop_column_width'] = filedropcolwidth
confmanager.write_options(**sett)
self.destroy_orphaned_window()
self.Destroy()
Expand Down
23 changes: 9 additions & 14 deletions videomass/vdms_panels/filedrop.py
Expand Up @@ -6,7 +6,7 @@
Author: Gianluca Pernigotto <jeanlucperni@gmail.com>
Copyleft - 2024 Gianluca Pernigotto <jeanlucperni@gmail.com>
license: GPL3
Rev: June.20.2023
Rev: Feb.07.2024
Code checker: flake8, pylint
This file is part of Videomass.
Expand Down Expand Up @@ -121,19 +121,6 @@ def __init__(self, parent):
style=wx.LC_REPORT
| wx.LC_SINGLE_SEL,
)
self.populate()
# ----------------------------------------------------------------------#

def populate(self):
"""
populate the default columns
"""
self.InsertColumn(0, '#', width=30)
self.InsertColumn(1, _('File Name'), width=200)
self.InsertColumn(2, _('Duration'), width=200)
self.InsertColumn(3, _('Media type'), width=200)
self.InsertColumn(4, _('Size'), width=150)
self.InsertColumn(5, _('Output file name'), width=200)
# ----------------------------------------------------------------------#

def dropUpdate(self, path, newname=None):
Expand Down Expand Up @@ -274,6 +261,14 @@ def __init__(self, parent, *args):
# Establish the listctrl as a drop target:
file_drop_target = FileDrop(self.flCtrl)
self.flCtrl.SetDropTarget(file_drop_target) # Make drop target.
# populate columns
colw = appdata['filedrop_column_width']
self.flCtrl.InsertColumn(0, '#', width=colw[0])
self.flCtrl.InsertColumn(1, _('File Name'), width=colw[1])
self.flCtrl.InsertColumn(2, _('Duration'), width=colw[2])
self.flCtrl.InsertColumn(3, _('Media type'), width=colw[3])
self.flCtrl.InsertColumn(4, _('Size'), width=colw[4])
self.flCtrl.InsertColumn(5, _('Output file name'), width=colw[5])
# create widgets
infomsg = _("Drag one or more files below")
self.lbl_info = wx.StaticText(self, wx.ID_ANY, label=infomsg)
Expand Down
2 changes: 2 additions & 0 deletions videomass/vdms_panels/long_processing_task.py
Expand Up @@ -244,6 +244,8 @@ def update_display(self, output, duration, status):

if msec > duration:
self.barprog.SetValue(duration)
elif msec == 0:
self.barprog.SetValue(self.barprog.GetValue())
else:
self.barprog.SetValue(msec)

Expand Down
27 changes: 18 additions & 9 deletions videomass/vdms_panels/presets_manager.py
Expand Up @@ -7,7 +7,7 @@
Author: Gianluca Pernigotto <jeanlucperni@gmail.com>
Copyleft - 2024 Gianluca Pernigotto <jeanlucperni@gmail.com>
license: GPL3
Rev: Gen.22.2024
Rev: Feb.07.2024
Code checker: flake8, pylint
This file is part of Videomass.
Expand Down Expand Up @@ -311,7 +311,7 @@ def __init__(self, parent, appdata, icons):

# ---------------------------- defaults
self.cmbx_prst.SetSelection(0),
self.set_listctrl()
self.set_listctrl(self.appdata['prstmng_column_width'])
# ----------------------------------------------------------------------

def update_preset_state(self):
Expand Down Expand Up @@ -368,7 +368,9 @@ def reset_list(self, reset_cmbx=False):
"""
Clear all data and re-load new one. Used by selecting
new preset and add/edit/delete profiles events.
Note, If you have methods to call related to `self.lctrl`,
do so before calling `ClearAll()` method which deletes
the pre-set references making the data no longer available.
"""
if reset_cmbx:
prst = sorted([os.path.splitext(x)[0] for x in
Expand All @@ -378,24 +380,31 @@ def reset_list(self, reset_cmbx=False):
self.cmbx_prst.AppendItems(prst)
self.cmbx_prst.SetSelection(0)

# get column widths now before calling ClearAll()
colw = [self.lctrl.GetColumnWidth(0),
self.lctrl.GetColumnWidth(1),
self.lctrl.GetColumnWidth(2),
self.lctrl.GetColumnWidth(3),
]
self.lctrl.ClearAll()
self.txt_1cmd.SetValue("")
self.txt_2cmd.SetValue("")

if self.array:
del self.array[0:6]
self.set_listctrl()

self.set_listctrl(colw)
# ----------------------------------------------------------------#

def set_listctrl(self):
def set_listctrl(self, colw):
"""
Populates Presets list with JSON data from *.prst files.
See `presets_manager_prop.py`
"""
self.lctrl.InsertColumn(0, _('Name'), width=250)
self.lctrl.InsertColumn(1, _('Description'), width=350)
self.lctrl.InsertColumn(2, _('Output Format'), width=200)
self.lctrl.InsertColumn(3, _('Supported Format List'), width=220)
self.lctrl.InsertColumn(0, _('Name'), width=colw[0])
self.lctrl.InsertColumn(1, _('Description'), width=colw[1])
self.lctrl.InsertColumn(2, _('Output Format'), width=colw[2])
self.lctrl.InsertColumn(3, _('Supported Format List'), width=colw[3])

path = os.path.join(f'{self.user_prst}',
f'{self.cmbx_prst.GetValue()}.prst'
Expand Down
17 changes: 15 additions & 2 deletions videomass/vdms_sys/settings_manager.py
Expand Up @@ -6,7 +6,7 @@
Author: Gianluca Pernigotto <jeanlucperni@gmail.com>
Copyleft - 2024 Gianluca Pernigotto <jeanlucperni@gmail.com>
license: GPL3
Rev: July.07.2023
Rev: Feb.07.2024
Code checker: flake8, pylint
This file is part of Videomass.
Expand Down Expand Up @@ -156,8 +156,17 @@ class ConfigManager:
args used by external downloader in yt-dlp. Default is None
List should be passed using aria2c ["-j", "1", "-x", "1", "-s", "1"]
prstmng_column_width (list of int)
column width in the Preset Manager panel.
filedrop_column_width (list of int)
column width in the File Drop panel.
fcode_column_width (list of int)
column width in the format code panel (ytdownloader).
"""
VERSION = 6.2
VERSION = 6.3
DEFAULT_OPTIONS = {"confversion": VERSION,
"outputfile": f"{os.path.expanduser('~')}",
"outputfile_samedir": False,
Expand Down Expand Up @@ -202,6 +211,10 @@ class ConfigManager:
},
"external_downloader": None,
"external_downloader_args": None,
"prstmng_column_width": [250, 350, 200, 220],
"filedrop_column_width": [30, 200, 200, 200, 150, 200],
"fcode_column_width": [120, 60, 200, 80, 160,
110, 80, 110, 100],
}

def __init__(self, filename, makeportable=None):
Expand Down
1 change: 1 addition & 0 deletions videomass/vdms_utils/utils.py
Expand Up @@ -139,6 +139,7 @@ def get_volume_data(filename, detect: list,
volumedata.append(volume)

return tuple(volumedata)
# ------------------------------------------------------------------------


def format_bytes(num):
Expand Down
21 changes: 11 additions & 10 deletions videomass/vdms_ytdlp/formatcode.py
Expand Up @@ -6,7 +6,7 @@
Author: Gianluca Pernigotto <jeanlucperni@gmail.com>
Copyleft - 2024 Gianluca Pernigotto <jeanlucperni@gmail.com>
license: GPL3
Rev: March.19.2023
Rev: Feb.07.2024
Code checker: flake8, pylint
This file is part of Videomass.
Expand Down Expand Up @@ -124,15 +124,16 @@ def __init__(self, parent, format_dict):
)
if not self.oldwx:
self.fcode.EnableCheckBoxes(enable=True)
self.fcode.InsertColumn(0, (_('Format Code')), width=120)
self.fcode.InsertColumn(1, (_('Url')), width=60)
self.fcode.InsertColumn(2, (_('Title')), width=200)
self.fcode.InsertColumn(3, (_('Extension')), width=80)
self.fcode.InsertColumn(4, (_('Resolution')), width=160)
self.fcode.InsertColumn(5, (_('Video Codec')), width=110)
self.fcode.InsertColumn(6, (_('fps')), width=80)
self.fcode.InsertColumn(7, (_('Audio Codec')), width=110)
self.fcode.InsertColumn(8, (_('Size')), width=100)
colw = FormatCode.appdata['fcode_column_width']
self.fcode.InsertColumn(0, (_('Format Code')), width=colw[0])
self.fcode.InsertColumn(1, (_('Url')), width=colw[1])
self.fcode.InsertColumn(2, (_('Title')), width=colw[2])
self.fcode.InsertColumn(3, (_('Extension')), width=colw[3])
self.fcode.InsertColumn(4, (_('Resolution')), width=colw[4])
self.fcode.InsertColumn(5, (_('Video Codec')), width=colw[5])
self.fcode.InsertColumn(6, (_('fps')), width=colw[6])
self.fcode.InsertColumn(7, (_('Audio Codec')), width=colw[7])
self.fcode.InsertColumn(8, (_('Size')), width=colw[8])

sizer_base.Add(self.fcode, 1, wx.ALL | wx.EXPAND, 5)
sizeropt = wx.BoxSizer(wx.HORIZONTAL)
Expand Down
13 changes: 12 additions & 1 deletion videomass/vdms_ytdlp/main_ytdlp.py
Expand Up @@ -6,7 +6,7 @@
Author: Gianluca Pernigotto <jeanlucperni@gmail.com>
Copyleft - 2024 Gianluca Pernigotto <jeanlucperni@gmail.com>
license: GPL3
Rev: July.07.2023
Rev: Feb.07.2024
Code checker: flake8, pylint
This file is part of Videomass.
Expand Down Expand Up @@ -247,6 +247,17 @@ def on_exit(self, event, warn=True):
sett['include_ID_name'] = self.ytDownloader.ckbx_id.GetValue()
sett['restrict_fname'] = self.ytDownloader.ckbx_limitfn.GetValue()
sett['subtitles_options'] = self.ytDownloader.opt["SUBS"]
fcodecolwidth = [self.ytDownloader.panel_cod.fcode.GetColumnWidth(0),
self.ytDownloader.panel_cod.fcode.GetColumnWidth(1),
self.ytDownloader.panel_cod.fcode.GetColumnWidth(2),
self.ytDownloader.panel_cod.fcode.GetColumnWidth(3),
self.ytDownloader.panel_cod.fcode.GetColumnWidth(4),
self.ytDownloader.panel_cod.fcode.GetColumnWidth(5),
self.ytDownloader.panel_cod.fcode.GetColumnWidth(6),
self.ytDownloader.panel_cod.fcode.GetColumnWidth(7),
self.ytDownloader.panel_cod.fcode.GetColumnWidth(8),
]
sett['fcode_column_width'] = fcodecolwidth
confmanager.write_options(**sett)
self.destroy_orphaned_window()
self.Destroy()
Expand Down

0 comments on commit a74092c

Please sign in to comment.