Skip to main content

Notice

Please note that most of the software linked on this forum is likely to be safe to use. If you are unsure, feel free to ask in the relevant topics, or send a private message to an administrator or moderator. To help curb the problems of false positives, or in the event that you do find actual malware, you can contribute through the article linked here.
Topic: Spider Monkey Panel (foo_spider_monkey_panel) (Read 341858 times) previous topic - next topic
0 Members and 4 Guests are viewing this topic.

Re: Spider Monkey Panel (foo_spider_monkey_panel)

Reply #975
Thanks! I could merge your toogle (even if it's a duplicate functionality, you have already done it... so why not) and/or dropdown list with mine.

Not so sure about the latter, since I also plan to add custom menus -using the already shared menu framework- within the option panel and the list could be essentially the same (the button theme will be different though).
Spoiler (click to show/hide)

Apart from that, it works with schemas as is and already allows saving/loading vars from a properties object. It's mostly done, I only have to think if input boxes should use full column width and what happens if the text within a tab is bigger than the column width (I was thinking about pushing the other columns to another tab automatically to free space).
In these examples, at the second image, I forced 4 columns although only 3 would work fine according to the total width of its elements. 4th column would be pushed to another tab. Although some attention must be put when creating the schema, it makes no sense to fill a tab with too many things if the "standard" panel is meant to be small. Thus the schema should contain columns considering the minimum acceptable panel size.
Spoiler (click to show/hide)

Btw, check the images for the scripts @TheQwertiest on the zip. The buttons bar is meant to be used at top, but bars are themed according to windows colors. I have installed it in a dark themed foobar without main bars to simulate it, YMMV.
Spoiler (click to show/hide)

Re: Spider Monkey Panel (foo_spider_monkey_panel)

Reply #976
Version: 1.5.1
Link: https://github.com/TheQwertiest/foo_spider_monkey_panel/releases/tag/v1.5.1
Changelog:
Hotfix for v1.5.0 (see changelog above)
Spoiler (click to show/hide)
Detailed description of API changes: https://theqwertiest.github.io/foo_spider_monkey_panel/docs/script_documentation/api_changes/#v151

Re: Spider Monkey Panel (foo_spider_monkey_panel)

Reply #977
Some progress. Tabs with too big columns for the given window size are split into new tabs still following the schema. (have not merged the lists and toggle control yet)

Code: [Select]
// Create panel and add properties or data object with the values
const options = new _window({width: window.Width, height: window.Height, tabWidth: 'full', UI: 'material', properties: getPropertiesPairs(properties)});
options.addTab({title: 'Option 1', columns: 4, data: [
[
{title: 'Title 1', subTitle: 'Subtitle 1', values: [{name: 'This is a value This is ', pId: 'val1', pIdx: 1}, {name: 'Another value:', value: 'This is my text This is a value check 2 scripts\\SMP\\xxx-scripts\\helpers\\JSinputbox.js is is a value This is a'}]},
{subTitle: 'Subtitle 2', values: [{name: 'This is a value check 1:', value: true}]},
{values: [{name: 'Choose color:', value: 0xFFEAE4D1, mode: 'colorPicker'}]}
],
[ // If data doesn't have a pId or pIdx (associated to the previous properties object) then the value must be passed along the schema
{title: 'Title 2', subTitle: 'Subtitle 1', values: [{name: 'This is a value:', value: 20}, {name: 'Another value:', value: 30}]},
{title: 'Title 3', subTitle: 'Subtitle 2', values: [{name: 'This is a value check 2:', value: true, mode: 'checkGroup'}, {name: 'This is a value check 3:', value: false, mode: 'checkGroup'}]}
],
[
{title: 'Title 4', subTitle: 'Subtitle 1', values: [{name: 'This is a value:', value: ['Value 1', 'Value 2', 'Value 3']}]}
]
]});
options.addTab({title: 'Option 2', columns: 3, data: [
[
{title: 'Title 1', subTitle: 'Subtitle 1', values: [{name: 'This is a value:', value: 10}, {name: 'Another value:', value: 20}]},
{title: 'Title 2', subTitle: 'Subtitle 2', values: [{name: 'This is a value check 1:', value: true}]}
],
[
{title: 'Title 3', subTitle: 'Subtitle 1', values: [{name: 'This is a value:', value: 20}, {name: 'Another value:', value: 30}]},
{title: 'Title 4', subTitle: 'Subtitle 2', values: [{name: 'This is a value check 2:', value: false}]}
],
[
{title: 'Title 5', subTitle: 'Subtitle 1', values: [{name: 'This is a value:', value: 20}, {name: 'Another value:', value: 30}]},
{title: 'Title 6', subTitle: 'Subtitle 2', values: [{name: 'This is a value check 3:', value: false}, {name: 'This is a value check 4:', value: false}]}
]
]});
options.addTab({title: 'Option 3', columns: 1});
options.addTab({title: 'Option 4', columns: 2});
options.addTab({title: 'Option 5', columns: 3});
options.fitData(); // Fits the schema at start (is also done automatically on resize)

// Menus to swap panels
var menu = new _menu();
menu.newEntry({entryText: 'Show Options', func: () => {options.properties.bOptions[1] = true; overwriteProperties(options.properties); options.properties = getPropertiesPairs(properties); window.Repaint(true);}});
menu.newEntry({entryText: 'Show Main', func: () => {options.properties.bOptions[1] = false; overwriteProperties(options.properties); window.Repaint(true);}});

Spoiler (click to show/hide)

Tab titles would be cut to 3-4 letters if there is not enough width, and a tooltip would show fhe full name. Still deciding if the save/load part should be done manually (I do it when opening/closing the panel via menus), or via callbacks called by the options panel whenever a value changes, etc..

Re: Spider Monkey Panel (foo_spider_monkey_panel)

Reply #978
Hey @TheQwertiest ,

unfortunately we need another hotfix, I have an annoying problem with SMP 1.5.1.

Often when you close foobar it will not make a clean exit and gets stuck in the process. In the taskbar you can see foobar2000.exe
is still running in the background and the only way is to kill it. On next foobar start, you'll get the crash popup warning.
You can reproduce it when you open foobar, close it, open foobar, play some songs, close it again etc...
After some tries, it will happen but not always...

I didn't have any problems with v.1.5.0 or v.1.4.1, this happens only with v.1.5.1. Some changes from 1.5.0 to 1.5.1 are producing
this hang up...

-TT



Re: Spider Monkey Panel (foo_spider_monkey_panel)

Reply #980
I have encountered a similar situation. Also, right-clicking on the song file and selecting "Open containing folder" occasionally brought up a dialog box for the slow script to run, but now it doesn't, and I can't take a screenshot
https://1drv.ms/u/s!AnFvs7Iqm0IraTdlGovhwJOU1DY?e=ARvwh2
unfortunately we need another hotfix, I have an annoying problem with SMP 1.5.1.
Often when you close foobar it will not make a clean exit and gets stuck in the process. In the taskbar you can see foobar2000.exe
is still running in the background and the only way is to kill it. On next foobar start, you'll get the crash popup warning.
You can reproduce it when you open foobar, close it, open foobar, play some songs, close it again etc...
After some tries, it will happen but not always...


Re: Spider Monkey Panel (foo_spider_monkey_panel)

Reply #982
Include function relative paths evaluating to the "included" script path instead of the main one is an intentional behavior?

Have a main one ...\foobar2000\scripts\SMP\xxx-scripts\options.js':
Code: [Select]
include('helpers\\window_xxx.js');
include('helpers\\helpers_xxx_properties.js');
include('helpers\\menu_xxx.js');

The first helper file at (' ...\foobar2000\scripts\SMP\xxx-scripts\helpers') 'has:
Code: [Select]
include('helpers\\helpers_xxx_UI.js');
include('helpers\\window_xxx_input.js');
include('helpers\\menu_xxx.js');
include('helpers\\buttons_panel_xxx.js');

Since the helper is called by the main one, I was expecting paths resolving to '..\foobar2000\scripts\SMP\xxx-scripts\helpers\...' but instead they look for '...\foobar2000\scripts\SMP\xxx-scripts\helpers\helpers\...'.

Quote
`${current_script_path}/${path}`, if the script is not a top-level `in-memory` script.
Note the documentation talks about script path (instead of current file path).

Re: Spider Monkey Panel (foo_spider_monkey_panel)

Reply #983
@regor , yup, that's the intended behaviour. Docs are valid: `current_script_path` is `a path to the file containing the script from which the `include()` method was called`.

Re: Spider Monkey Panel (foo_spider_monkey_panel)

Reply #984
@TT @always.beta , I've made some changes that should fix your issue (once dev build is finished building).

Re: Spider Monkey Panel (foo_spider_monkey_panel)

Reply #985
@TT @always.beta , I've made some changes that should fix your issue (once dev build is finished building).
What was the issue?


 

Re: Spider Monkey Panel (foo_spider_monkey_panel)

Reply #987
Window framework + built in options
Have provided an example file (options.js) to work with it. Feel free to test it before I release it on github
Allows to embed any arbitrary window object too within a tab, so multiple options panels may be added.
Data values may be autosaved/autoloaded, passed as properties or as json.
Spoiler (click to show/hide)

Obviously this is just a beta, don't use without caution.
(the tick at the checkbox problem is already noticed)

Re: Spider Monkey Panel (foo_spider_monkey_panel)

Reply #988
@regor , yup, that's the intended behaviour. Docs are valid: `current_script_path` is `a path to the file containing the script from which the `include()` method was called`.
Ok! Have one more question.. I'm trying to replace all include calls with relative paths so scripts can be put on any place instead of an specific path. That works, even using '..\\'.

But have not found a way to read text files or images using relative paths, so those are necessarily harcoded to an specific path. And scripts using images or text files are required to either be installed on a path or as a package.

I understand that enabling relative paths at ReadTextFile, etc. would require a rewriting. But do I miss an alternative method? Is there some way to retrieve the path of the current file (or main panel script) to add it to all those paths? (for ex. at Window.ScriptInfo)

Re: Spider Monkey Panel (foo_spider_monkey_panel)

Reply #989
on_output_device_changed and the dsp counterpart are not called when the respective lists change but the active item has not changed, is that intended (*)? (in other words, there is no way to know if the device list changes at some point without using intervals)
Just noticed while using myself the device auto-switch.

(*) Different behavior since the actual methods to get the dsp and devices don't output just the active items, but the entire list.

Re: Spider Monkey Panel (foo_spider_monkey_panel)

Reply #990
Believe it or not, it's much less effort to translate what fb2k does in C++ to JavaScript untouched (where reasonable). Intercepting what fb2k does and applying weird logic just to annoy people does sound like fun but not even I would go that far. :p

Also, you might check the docs from time to time...

https://theqwertiest.github.io/foo_spider_monkey_panel/assets/generated_files/docs/html/module-callbacks.html#~on_dsp_preset_changed

I guess there is no note attached to on_output_device_changed because I never had removable devices when testing it.

Re: Spider Monkey Panel (foo_spider_monkey_panel)

Reply #991
applying weird logic just to annoy people does sound like fun
Indeed, now I actually want to do smth like that xD

Re: Spider Monkey Panel (foo_spider_monkey_panel)

Reply #992
Also, you might check the docs from time to time...

https://theqwertiest.github.io/foo_spider_monkey_panel/assets/generated_files/docs/html/module-callbacks.html#~on_dsp_preset_changed

I guess there is no note attached to on_output_device_changed because I never had removable devices when testing it.
... precisely I was asking because I did not understand the rationale behind it (?) Can not care less about what's fun or not.

It's weird that the only method to get the currently used device outputs the entire list which you have to process, and the only callback to notify device changes works only with the current device (so you have to resort to interval functions to check for changes). If they are just a translation of the c++ counterparts or doing it differently would be harder, that's ok.... it's still weird.

Quote
I guess there is no note attached to on_output_device_changed because I never had removable devices when testing it
That's the point of headphones and bluetooth devices, they are removable.

Quote
I understand that enabling relative paths at ReadTextFile, etc. would require a rewriting. But do I miss an alternative method? Is there some way to retrieve the path of the current file (or main panel script) to add it to all those paths? (for ex. at Window.ScriptInfo)
@TheQwertiest


Re: Spider Monkey Panel (foo_spider_monkey_panel)

Reply #994
win 7.

Loading a read only file and editing and trying to save the script crashes foobar.

The same happens for hidden files.

Spoiler (click to show/hide)

Re: Spider Monkey Panel (foo_spider_monkey_panel)

Reply #995
Ok! Have one more question.. I'm trying to replace all include calls with relative paths so scripts can be put on any place instead of an specific path. That works, even using '..\\'.

But have not found a way to read text files or images using relative paths, so those are necessarily harcoded to an specific path. And scripts using images or text files are required to either be installed on a path or as a package.

I understand that enabling relative paths at ReadTextFile, etc. would require a rewriting. But do I miss an alternative method? Is there some way to retrieve the path of the current file (or main panel script) to add it to all those paths? (for ex. at Window.ScriptInfo)

There is no alternative method for in-memory or file scripts. Heck, that was actually the main reason why I've started working on packages in the first place =)

Re: Spider Monkey Panel (foo_spider_monkey_panel)

Reply #996
They are not a replacement for all use cases. Specially for scripts which can load multiple files on demand from paths, or have optional add-ons (and are meant to be added/removed by the user, contrary to the way packages work). For ex. presets files, like the ones used at Playlist Tools are totally impossible with packages (or I would have to split saving files at multiple places) (*).

Relative paths are still useful for those cases, and not having to force a pre-defined absolute path (for images, text files, etc.) would be great, which could be done exposing the current panel script path in some way. It's fine if you think otherwise, absolute paths can still be used for those cases... is just that I see room for improvement there, since "script including" is already relative path friendly.

(*) The button bar, automatically loading any button file from a folder is another example. Since packages are meant to be installed and done... I don't see people adding extra files at a later point to the package folder manually, defeating the initial purpose of packages.

Re: Spider Monkey Panel (foo_spider_monkey_panel)

Reply #997
Minor fix for data folder, now created if it doesn't exist.

@TheQwertiest   not sure if you saw this:
https://hydrogenaud.io/index.php?topic=121277.msg1000545#msg1000545

Re: Spider Monkey Panel (foo_spider_monkey_panel)

Reply #998
Relative paths are still useful for those cases, and not having to force a pre-defined absolute path (for images, text files, etc.) would be great, which could be done exposing the current panel script path in some way. It's fine if you think otherwise, absolute paths can still be used for those cases... is just that I see room for improvement there, since "script including" is already relative path friendly.
Script including only become relative path friendly after initial load at the 1.5 release (you can see the changelist here). Seems like the best solution would be to provide a method that retrieves the current path of the file the code is being executed from, and then there's no need to get messy with all the other file/image functions. Obviously if you're doing this in memory, you're out of luck completely though.

Re: Spider Monkey Panel (foo_spider_monkey_panel)

Reply #999
Relative paths are still useful for those cases, and not having to force a pre-defined absolute path (for images, text files, etc.) would be great, which could be done exposing the current panel script path in some way. It's fine if you think otherwise, absolute paths can still be used for those cases... is just that I see room for improvement there, since "script including" is already relative path friendly.
Script including only become relative path friendly after initial load at the 1.5 release (you can see the changelist here). Seems like the best solution would be to provide a method that retrieves the current path of the file the code is being executed from, and then there's no need to get messy with all the other file/image functions. Obviously if you're doing this in memory, you're out of luck completely though.

That was exactly my suggestion. For ex a new property could be added to the already existing Window.ScriptInfo data with that path. In memory script's path would simply be null or '' and done.