mirror of
				https://github.com/flynx/ImageGrid.git
				synced 2025-10-31 03:10:07 +00:00 
			
		
		
		
	experementing...
Signed-off-by: Alex A. Naanou <alex.nanou@gmail.com>
This commit is contained in:
		
							parent
							
								
									c978cdd0a4
								
							
						
					
					
						commit
						0932a2ca8e
					
				| @ -33,6 +33,15 @@ var base = require('features/base') | |||||||
| // 		- make index
 | // 		- make index
 | ||||||
| // 		- merge
 | // 		- merge
 | ||||||
| // 		- clone
 | // 		- clone
 | ||||||
|  | //
 | ||||||
|  | // XXX a different approach to this would be an "external" cli controller
 | ||||||
|  | // 		script that would contain only cli code and load the ImageGrid
 | ||||||
|  | // 		only in the handler...
 | ||||||
|  | // 			+ would be allot faster to load.
 | ||||||
|  | // 			+ more flexible as we can load more than one instance...
 | ||||||
|  | // 		This could still be done via features, just load the cli feature
 | ||||||
|  | // 		alone at first and then either create new instances or setup 
 | ||||||
|  | // 		additional features as needed...
 | ||||||
| 
 | 
 | ||||||
| var CLI =  | var CLI =  | ||||||
| module.CLI = core.ImageGridFeatures.Feature({ | module.CLI = core.ImageGridFeatures.Feature({ | ||||||
| @ -40,7 +49,7 @@ module.CLI = core.ImageGridFeatures.Feature({ | |||||||
| 	doc: '', | 	doc: '', | ||||||
| 
 | 
 | ||||||
| 	tag: 'commandline', | 	tag: 'commandline', | ||||||
| 	depends: ['base'], | 	depends: ['lifecycle'], | ||||||
| 
 | 
 | ||||||
| 	isApplicable: function(){  | 	isApplicable: function(){  | ||||||
| 		return this.runtime == 'node' || this.runtime == 'nw' }, | 		return this.runtime == 'node' || this.runtime == 'nw' }, | ||||||
| @ -48,6 +57,7 @@ module.CLI = core.ImageGridFeatures.Feature({ | |||||||
| 	handlers: [ | 	handlers: [ | ||||||
| 		['start', | 		['start', | ||||||
| 			function(){ | 			function(){ | ||||||
|  | 				var that = this | ||||||
| 				// get the arguments...
 | 				// get the arguments...
 | ||||||
| 				if(this.runtime == 'nw'){ | 				if(this.runtime == 'nw'){ | ||||||
| 					var argv = requirejs('nw.gui').App.argv | 					var argv = requirejs('nw.gui').App.argv | ||||||
| @ -70,31 +80,59 @@ module.CLI = core.ImageGridFeatures.Feature({ | |||||||
| 
 | 
 | ||||||
| 					// list features...
 | 					// list features...
 | ||||||
| 					// XXX make this a core action... (???)
 | 					// XXX make this a core action... (???)
 | ||||||
| 					.option('--list-features', 'list loaded features', function(){ | 					.option('lf, --list-features', 'list loaded features', function(){ | ||||||
| 						// excluded...
 | 						// excluded...
 | ||||||
| 						this.features.excluded.length > 0  | 						that.features.excluded.length > 0  | ||||||
| 							&& console.warn('Features excluded (%d):\n   ', | 							&& console.warn('Features excluded (%d):\n   ', | ||||||
| 								this.features.excluded.length,  | 								that.features.excluded.length,  | ||||||
| 								this.features.excluded.join('\n    ')) | 								that.features.excluded.join('\n    ')) | ||||||
| 
 | 
 | ||||||
| 						// not applicable...
 | 						// not applicable...
 | ||||||
| 						console.log('Features not applicable (%d):\n   ',  | 						that.features.unapplicable.length > 0  | ||||||
| 							this.features.unapplicable.length,  | 							&& console.log('Features not applicable (%d):\n   ',  | ||||||
| 							this.features.unapplicable.join('\n    ')) | 								that.features.unapplicable.length,  | ||||||
|  | 								that.features.unapplicable.join('\n    ')) | ||||||
| 
 | 
 | ||||||
| 						// loaded...
 | 						// loaded...
 | ||||||
| 						console.log('Features loaded (%d):\n   ', | 						console.log('Features loaded (%d):\n   ', | ||||||
| 							this.features.features.length,  | 							that.features.features.length,  | ||||||
| 							this.features.features.join('\n    ')) | 							that.features.features.join('\n    ')) | ||||||
|  | 					}) | ||||||
|  | 					.option('laf, --list-available-features', 'list available features', function(){ | ||||||
|  | 						var f = core.ImageGridFeatures.features | ||||||
|  | 						console.log('Features available (%d):\n   ', | ||||||
|  | 							f.length,  | ||||||
|  | 							f.join('\n    ')) | ||||||
| 					}) | 					}) | ||||||
| 
 | 
 | ||||||
| 					// list actions...
 | 					// list actions...
 | ||||||
| 					// XXX this is a bit pointless as single actions are
 | 					// XXX this is a bit pointless as single actions are
 | ||||||
| 					// 		meaningless when no state is stored...
 | 					// 		meaningless when no state is stored...
 | ||||||
| 					.option('--list-actions', 'list loaded actions', function(){ | 					.option('la, --list-actions', 'list loaded actions', function(){ | ||||||
| 						console.log('Actions loaded (%d):\n   ',  | 						console.log('Actions loaded (%d):\n   ',  | ||||||
| 							this.length,  | 							that.length,  | ||||||
| 							Object.keys(this.getDoc()).join('\n    ')) | 							Object.keys(that.getDoc()).join('\n    ')) | ||||||
|  | 					}) | ||||||
|  | 
 | ||||||
|  | 					// XXX experimental....
 | ||||||
|  | 					// 		to see this in action use:
 | ||||||
|  | 					// 			ig lf sm lf
 | ||||||
|  | 					// 		...this will print the list of features before
 | ||||||
|  | 					// 		and after setup...
 | ||||||
|  | 					.option('sm, --setup-minimal', 'setup minimap features', function(){ | ||||||
|  | 						// load features we might need...
 | ||||||
|  | 						// XXX require js loads these at the root...
 | ||||||
|  | 						var location = require('features/location') | ||||||
|  | 						var history = require('features/history') | ||||||
|  | 						var app = require('features/app') | ||||||
|  | 						var marks = require('features/ui-marks') | ||||||
|  | 						var filesystem = require('features/filesystem') | ||||||
|  | 						var experimental = require('features/experimental') | ||||||
|  | 
 | ||||||
|  | 						// extend the current instance to a minimal non-ui
 | ||||||
|  | 						// state...
 | ||||||
|  | 						core.ImageGridFeatures | ||||||
|  | 							.setup(that, ['viewer-minimal']) | ||||||
| 					}) | 					}) | ||||||
| 
 | 
 | ||||||
| 					// XXX the problem with this is that it still tires 
 | 					// XXX the problem with this is that it still tires 
 | ||||||
|  | |||||||
| @ -158,6 +158,7 @@ module.LifeCycle = ImageGridFeatures.Feature({ | |||||||
| 	doc: '', | 	doc: '', | ||||||
| 
 | 
 | ||||||
| 	tag: 'lifecycle', | 	tag: 'lifecycle', | ||||||
|  | 	priority: 'high', | ||||||
| 
 | 
 | ||||||
| 	actions: LifeCycleActions, | 	actions: LifeCycleActions, | ||||||
| }) | }) | ||||||
|  | |||||||
| @ -27,8 +27,13 @@ var core = require('features/core') | |||||||
| 
 | 
 | ||||||
| core.ImageGridFeatures.Feature('viewer-commandline', [ | core.ImageGridFeatures.Feature('viewer-commandline', [ | ||||||
| 	'lifecycle', | 	'lifecycle', | ||||||
| 	'base-full', |  | ||||||
| 	'commandline', | 	'commandline', | ||||||
|  | ]) | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
|  | core.ImageGridFeatures.Feature('viewer-minimal', [ | ||||||
|  | 	'lifecycle', | ||||||
|  | 	'base-full', | ||||||
| 
 | 
 | ||||||
| 	'image-marks', | 	'image-marks', | ||||||
| 	'image-bookmarks', | 	'image-bookmarks', | ||||||
| @ -38,10 +43,9 @@ core.ImageGridFeatures.Feature('viewer-commandline', [ | |||||||
| ]) | ]) | ||||||
| 
 | 
 | ||||||
| 
 | 
 | ||||||
| 
 |  | ||||||
| 
 |  | ||||||
| core.ImageGridFeatures.Feature('viewer-testing', [ | core.ImageGridFeatures.Feature('viewer-testing', [ | ||||||
| 	'viewer-commandline', | 	'viewer-commandline', | ||||||
|  | 	'viewer-minimal', | ||||||
| 
 | 
 | ||||||
| 	'ui', | 	'ui', | ||||||
| 
 | 
 | ||||||
| @ -113,6 +117,7 @@ core.ImageGridFeatures.Feature('viewer-testing', [ | |||||||
| 	'system-journal', | 	'system-journal', | ||||||
| ]) | ]) | ||||||
| 
 | 
 | ||||||
|  | /* | ||||||
| core.ImageGridFeatures.Feature('viewer-minimal', [ | core.ImageGridFeatures.Feature('viewer-minimal', [ | ||||||
| 	'base', | 	'base', | ||||||
| 	'ui', | 	'ui', | ||||||
| @ -124,6 +129,7 @@ core.ImageGridFeatures.Feature('viewer-minimal', [ | |||||||
| 		//'ui-current-image-indicator-hide-on-screen-nav',
 | 		//'ui-current-image-indicator-hide-on-screen-nav',
 | ||||||
| 	'ui-action-tree', | 	'ui-action-tree', | ||||||
| ]) | ]) | ||||||
|  | */ | ||||||
| 
 | 
 | ||||||
| 
 | 
 | ||||||
| 
 | 
 | ||||||
|  | |||||||
| @ -25,13 +25,7 @@ require = requirejs | |||||||
| // XXX need to automate this...
 | // XXX need to automate this...
 | ||||||
| var core = require('features/core') | var core = require('features/core') | ||||||
| var base = require('features/base') | var base = require('features/base') | ||||||
| var location = require('features/location') |  | ||||||
| var history = require('features/history') |  | ||||||
| var app = require('features/app') |  | ||||||
| var marks = require('features/ui-marks') |  | ||||||
| var filesystem = require('features/filesystem') |  | ||||||
| var cli = require('features/cli') | var cli = require('features/cli') | ||||||
| var experimental = require('features/experimental') |  | ||||||
| 
 | 
 | ||||||
| var meta = require('features/meta') | var meta = require('features/meta') | ||||||
| 
 | 
 | ||||||
|  | |||||||
| @ -235,6 +235,16 @@ module.FeatureSet = { | |||||||
| 	// if true, .setup(..) will report things it's doing... 
 | 	// if true, .setup(..) will report things it's doing... 
 | ||||||
| 	__verbose__: null, | 	__verbose__: null, | ||||||
| 
 | 
 | ||||||
|  | 	// List of registered features...
 | ||||||
|  | 	get features(){ | ||||||
|  | 		var that = this | ||||||
|  | 		return Object.keys(this) | ||||||
|  | 			.filter(function(e){  | ||||||
|  | 				return e != 'features'  | ||||||
|  | 					&& that[e] instanceof Feature })  | ||||||
|  | 	}, | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
| 	// Build feature list...
 | 	// Build feature list...
 | ||||||
| 	//
 | 	//
 | ||||||
| 	// 	Build a list of all registered features
 | 	// 	Build a list of all registered features
 | ||||||
| @ -297,13 +307,17 @@ module.FeatureSet = { | |||||||
| 	// 		careful.
 | 	// 		careful.
 | ||||||
| 	//
 | 	//
 | ||||||
| 	// XXX make suggested feature expansion recursive...
 | 	// XXX make suggested feature expansion recursive...
 | ||||||
|  | 	// XXX this appears to be very slow if lst not passed...
 | ||||||
| 	buildFeatureList: function(obj, lst, auto_include, depth){ | 	buildFeatureList: function(obj, lst, auto_include, depth){ | ||||||
| 		lst = lst == null ? Object.keys(this) : lst | 		var that = this | ||||||
|  | 		obj = obj || {} | ||||||
|  | 
 | ||||||
|  | 		lst = lst == null ? this.features : lst | ||||||
| 		lst = lst.constructor !== Array ? [lst] : lst | 		lst = lst.constructor !== Array ? [lst] : lst | ||||||
|  | 
 | ||||||
| 		auto_include = auto_include == null ? true : false | 		auto_include = auto_include == null ? true : false | ||||||
| 		depth = depth || 8 | 		depth = depth || 8 | ||||||
| 
 | 
 | ||||||
| 		var that = this |  | ||||||
| 
 | 
 | ||||||
| 		var missing = {} | 		var missing = {} | ||||||
| 
 | 
 | ||||||
|  | |||||||
| @ -30,5 +30,9 @@ | |||||||
|   "preferGlobal": true, |   "preferGlobal": true, | ||||||
|   "bin": { |   "bin": { | ||||||
|     "ig": "ig.js" |     "ig": "ig.js" | ||||||
|  |   }, | ||||||
|  |   "devDependencies": { | ||||||
|  |     "nw-builder": "^2.2.0", | ||||||
|  |     "less": "*" | ||||||
|   } |   } | ||||||
| } | } | ||||||
|  | |||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user