Giter Club home page Giter Club logo

Comments (13)

fwn0 avatar fwn0 commented on September 28, 2024 1

See this here:
jacquesh/foo_openlyrics#177

from georgia-reborn.

regorxxx avatar regorxxx commented on September 28, 2024

Once I get the basics, we can go fancy with a popup showing the current rows and asking which row to edit, etc.

from georgia-reborn.

TT-ReBORN avatar TT-ReBORN commented on September 28, 2024
  1. It's in gr-callbacks.js -> metadata grid will be rebuild from function on_metadb_changed(handle_list, fromhook) {

     	str.grid = [];
     	for (let k = 0; k < metadataGrid.length; k++) {
     		let val = $(metadataGrid[k].val);
     		if (val && metadataGrid[k].label) {
     			if (metadataGrid[k].age) {
     				val = $('$date(' + val + ')'); // Never show time
     				const age = calcAgeDateString(val);
     				if (age) {
     					val += ` (${age})`;
     				}
     			}
     			str.grid.push({
     				age: metadataGrid[k].age,
     				label: metadataGrid[k].label,
     				val
     			});
     		}
     	}
    

And there is also a function clearUIVariables() { which clears all, used for example on_playback_stop or in initMain()

  1. No but you were right on track, the setThemeSettings() function is to save ( with parameter true ) or load ( with no parameter ) all current using SMP panel properties to the config file BUT NOT ALL are linked to the config file.
    If you open the config file ( georgia-reborn-config.jsonc ) each section has a NOTE: in the comment header that starts with:
    // * Note: These settings will
    Almost all settings are saved but some not:
    "title_format_strings": {
    "themeStyleCustom": {
    "themeCustomFont": {
    "metadataGrid": [
    "settings": {
    These are not saved and only for manual edits, that means user need to manually open the config file and modify them themselves. All others settings will be saved automatically to the config file via top menu Options > Settings > Theme configuration > Save settings to config file -> setThemeSettings(true)

The configuration file is defined via gr-configuration.js with settings from
gr-defaults.js ( const defaultMetadataGrid = [ )
and gr-settings.js ( Line 1180 ).

There is also this in gr-settings:
config.addConfigurationObject(gridSchema, prefs.metadataGrid); // Can't Object.assign here to add new fields. Add new fields in the upgrade section of migrateCheck

function migrateCheck(version, storedVersion) {
	/**
	 * Adds or Replaces value in the grid with updated string from defaults
	 * @param {MetadataGridEntry[]} grid
	 * @param {string} label Label of the value to add or replace
	 * @param {number} position 0-based index of place to insert new value if existing entry not found
	 */
	const replaceGridEntry = (grid, label, position) => {
		const entryIdx = grid.findIndex(gridEntry => gridEntry && gridEntry.label.toLowerCase() === label.toLowerCase());
		const newVal = defaultMetadataGrid[defaultMetadataGrid.findIndex(e => e && e.label.toLowerCase() === label.toLowerCase())];
		if (entryIdx >= 0) {
			grid[entryIdx] = newVal;
		} else {
			grid.splice(position, 0, newVal);
		}
	};

	if (version !== storedVersion) {
		const configFile = config.readConfiguration();
		/** @type {MetadataGridEntry[]} */
		const grid = configFile.metadataGrid;

		// This function clears default values which have changed
		switch (storedVersion) {
			case '2.0.3':
			default:
				break;
		}
	}
	pref.version = currentVersion;	// Always update the version panel property
}

That would be it. Mordred is using the migrateCheck function for updates, that means when he releases a new update on Github it will be triggered and it should update also the config file. When a new version is released, there will be a hyperlink in the lowerbar. This will link to the releases page on Github. Never tried it myself because I don't have the public release yet on Github ;)

I have stripped it down, but original it looks like this:
https://github.com/kbuffington/Georgia/blob/11d434e6e0882810a5cff7522c395c71557b85a2/js/settings.js#L200

Hope that helps and thanks for your help!

-Tom

from georgia-reborn.

regorxxx avatar regorxxx commented on September 28, 2024

Uhm... 1) solved. I refactored code.

image
So on on_metadb_changed is reused with lp value.
image
And the same on the menu, not needing to process all again.
image

The second took me some time, since I kept using the method without the file reflecting the changes XD (and no error being thrown). Not sure why Mordred did not add an update method for arrays anyway.

So fixed that... just in case this is not the last time another array config gets the same treatment. gr-configuration.js
image
And throws a popup in case you fuck up mixing config value types.
image

details_grid_02_11_2022.zip

from georgia-reborn.

TT-ReBORN avatar TT-ReBORN commented on September 28, 2024

Good work and thanks @regorxxx, tried it out and it works as it should =)
Sorry I didn't warn you about how the configuration system works ;)

But we should add a guard if the user types invalid stuff ( delete all and type random stuff in the input ) in the pattern:

Error: Spider Monkey Panel v1.6.2-dev+7c0928bf ({04620F16-1878-47A1-8EFE-0CE0B99566CC}: Georgia-ReBORN v2.3.0 by TT)
newVal.filter is not a function

File: gr-menu.js
Line: 1797, Column: 34
Stack trace:
  detailsOptions/<@gr-menu.js:1797:34
  [email protected]:1537:23
  [email protected]:87:7
  append_albumCover_context_menu_to/<@Control_ContextMenu.js:565:7
  execute_menu@Control_ContextMenu.js:285:8
  execute_menu@Control_ContextMenu.js:199:17
  execute@Control_ContextMenu.js:419:15
  [email protected]:2679:9

I'm refactoring the top menu button code atm, because otherwise other devs would lose their mind how frustrating
that shit is ;)

-Tom

from georgia-reborn.

regorxxx avatar regorxxx commented on September 28, 2024

My bad, obviously try/catch parsing to JSON is not enough, will add more checks and polisishing. Was just for you to test it.

from georgia-reborn.

TT-ReBORN avatar TT-ReBORN commented on September 28, 2024

Yep I know, just wanted to let you know :)

from georgia-reborn.

regorxxx avatar regorxxx commented on September 28, 2024

details_grid_04_11_2022.zip

  • Checks for valid json.
  • Checks for proper val type.
  • Checks for empty input (interprets that as [], so removes rows).
  • Checks every row has a label and value property.
  • Ask the user before deleting all rows, in case that's an error.

So there it is. Unless I missed something, you have to try to break it on purpose, but the same can be done with the config file so...

from georgia-reborn.

TT-ReBORN avatar TT-ReBORN commented on September 28, 2024

Thanks, tested and it's working!

from georgia-reborn.

TT-ReBORN avatar TT-ReBORN commented on September 28, 2024

@regorxxx,

uploaded WIP Beta 10c for us, contains all your additions.
Only some small name changes, linted your code and refactored a one liner so ESLint doesn't complain...
You should just replace all your javascript files because there were more changes I needed to do when refactored
the top menu code...

Also check latest changelog in the zip file for more information.

I think I'm gonna switch to ESLyric and put the Lyric Show 3 Panel to rest, here is the same with ESLyric:
Here is the zip.

-Tom

from georgia-reborn.

regorxxx avatar regorxxx commented on September 28, 2024

Why don't you use foo_openlyrics Lyrics? (just curiosity)
https://github.com/jacquesh/foo_openlyrics

from georgia-reborn.

TT-ReBORN avatar TT-ReBORN commented on September 28, 2024

@regorxxx,
just released Beta 10c, wanted to let you know we will postpone this for Beta 10d and write it then in the changelog
and make it official.

from georgia-reborn.

TT-ReBORN avatar TT-ReBORN commented on September 28, 2024

Will be available in Beta 11, I've implemented a custom menu for the metadata grid and one other surprise.

from georgia-reborn.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.