LayoutManager [release 1.1]

Discuss and share scripts and script files...
Filehero
Posts: 2283
Joined: 27 Feb 2012 18:50
Location: Windows 10 Pro x64

LayoutManager [release 1.1]

Post by Filehero » 23 Mar 2012 19:26

Hi,

before I start to run around in circles, I'm releasing it now - I've become blinkered anyway. :wink:


Edit/Update June 2014: I think, I won't update it anymore, see here for a simple replacement using new functions build-in to XY.


---------------------
Edit: The current release is LayoutManager-1.1.
---------------------
---------------------
Edit: The current release is LayoutManager-1.0.
---------------------


It started here, especially this statement
admin wrote:Technically it would be possible and quite easy to add.
told me to go for it, because it's the kind of 'challenge' I can dare to take. :mrgreen:

So here it is: LayoutManager 0.5 alpha, the combined outcome of my first SC exercises.

What does it do?
Sure, XY is not a heavyweight gem such as an IDE (Eclipse or MS Visual Studio to name a few), where those layouts/perspectives are not only major time saviors, but undispensable essentials for effective coding. Nevertheless, I did find myself looking for single-click GUI-batch-toggle quite quick. After Don stated, this has been a almost-never-asked-for-feature and therefore isn't on top of his priorities (which is completely understood because it's his plain business after all), I decided to give it a try.

Not really surprising, the LayoutManager script does create, save, switch and delete what I call Layouts. I consider a Layout to mainly provide a snapshot of the visibility and relative positions of the major GUI elements at a given time. There's not really much more about it (at least, released by now). The rest is just bells & whistles.

The GUI component states the script can handle are restricted to those function IDs whose toggle states can be retrieved by calling

Code: Select all

get("#functionID");
Currently, those are

Code: Select all

#800	Panes  | Dual Pane
#801	Panes  | Horizontal Panes
#660	Window | Show Address Bar
#661	Window | Show Toolbar
#662	Window | Show Tab Bar
#670	Window | Show Status Bar
#669	Window | Show Status Bar Buttons
#668	Window | Show Tree
#664	Window | Show Catalog
#665	Window | Show Info Panel
#685	Window | Wide Info Panel
#686	Window | Catalog Above Tree
#1061  Miscellaneous | General Functions | Show/Hide Main Menu
I would be happy, if there will be support for more in the future, e.g. (note: meanwhile this has become history stuff!)

Code: Select all

#686	       | Catalog Above Tree             [DONE as of v1.1]
#666	       | Last Size/Minimize Info Panel  [no XY-internal state -> won't be done]
#667	       | Maximize/Minimize Info Panel   [no XY-internal state -> won't be done]
I could also think of integrating the Toolbar icon size and the Toolbar/Adressbar alignments into a layout. :wink:


Install 'guide'
Simply unzip* to the <xyscipts>-folder of any XYplorer installation and create a custom-button with On-Click "load("<xyscripts>\LayoutManager\\LMMenu.xys")".

I recommend:
Unzip it somewhere and read <somewhere>\LayoutManager\resources\help\LM-help.xhtml first.

Because it's pointless, I skipped posting any code and would like to suggest to simply post selective script codes of interest for further discussion.

I really do wonder how many bugs/pitfalls I've overseen.... :whistle:

Update/just found: The menu seems to need at least two entries to be shown (xyplorer_v10.90.0100).


Cheers,
Filehero

@Don: Thanks a lot for raising the single attachment size limit. :appl:

Edit 12-03-23: Added script description//www
Attachments
LayoutManager-0.5_alpha.zip
(341.77 KiB) Downloaded 269 times
Last edited by Filehero on 08 Jun 2014 23:37, edited 12 times in total.

admin
Site Admin
Posts: 47075
Joined: 22 May 2004 16:48
Location: Cologne, Win 8.1, Win 10
Contact:

Re: LayoutManager

Post by admin » 23 Mar 2012 19:47

It works. :)


And what a pleasing shiny icon-packed menu.


Astonishing. :appl:

serendipity
Posts: 3347
Joined: 07 May 2007 18:14
Location: NJ/NY

Re: LayoutManager

Post by serendipity » 24 Mar 2012 04:36

Looks very nice. Impressive. and lovely icons. :D
However, it would be useful to add few words in the beginning to explain what it does. i know you provided a link but it would be useful to have it here too.

Filehero
Posts: 2283
Joined: 27 Feb 2012 18:50
Location: Windows 10 Pro x64

Re: LayoutManager

Post by Filehero » 24 Mar 2012 08:41

admin wrote:It works. :)
Astonishing. :appl:
serendipity wrote:Looks very nice. Impressive.
Thanks to both of you. I like. :D

admin wrote:And what a pleasing shiny icon-packed menu.
serendipity wrote:Looks very nice. Impressive. and lovely icons. :D
Well, you surely know, only once you have tried it, you know that making good icons is an extremely difficult task to do. I had tried it again this time - and failed miserably once again. Creating expressive 256-pixel mosaics is simply not my realm. :mrgreen:
So, this 'Oscar' goes to both Yusuke Kamiyamane and visualpharm. But finding them took quite a while as well.

serendipity wrote:However, it would be useful to add few words in the beginning to explain what it does. i know you provided a link but it would be useful to have it here too.
Good point, done.


Cheers,
Filehero

klownboy
Posts: 2702
Joined: 28 Feb 2012 19:27

Re: LayoutManager

Post by klownboy » 24 Mar 2012 14:03

Hi Filehero,
What a computing piece of art like XYplorer. You don't know what you are missing (layouts) until you have it. A bit like not having a garage door opener for 30 years and now that I have it I wouldn't want a new home without one. :)

I realize it's an alpha version, but I am experiencing some problems with saving and loading layouts. I copied the Layout Manager directory to the scripts folder and setup a button as the help file directs and it works but it doesn't seem to make any changes to the layouts.ini file. I've attached the error screens, since I've got no clue how to insert the screen saves in the post. (I know it involves the IMG button on the post, but I have no on-line picture depository account.) I've looked at my layouts.ini file and there are no changes to add any new layouts made since I've bee using it. By the way, there are 2 lines listed at the end of each layout in layouts.ini. They are obviously from your personnel setup?
pane1.tabs=D:\Personal\myProjects\Powershell|D:\Personal\myProjects\XYPlorer
pane2.tabs=D:\Personal\myProjects\XYPlorer\foreign
My layout, "Original Ken01" never shows up in layouts.ini. There seems to be an issue loading even the built-in layouts at some point.
Thanks for a fabulous script.
Ken
Attachments
my_layouts.jpg
my_layouts.jpg (52.65 KiB) Viewed 6585 times
opps_message.jpg
opps_message.jpg (65.5 KiB) Viewed 6585 times
saving layout error message.jpg
saving layout error message.jpg (95.49 KiB) Viewed 6585 times

Filehero
Posts: 2283
Joined: 27 Feb 2012 18:50
Location: Windows 10 Pro x64

Re: LayoutManager

Post by Filehero » 24 Mar 2012 15:58

Hi klownboy,

first of all, thank you very much for testing and providing detailed feedback. :)

Secondly, I apologize deeply for all those errors, I thought I checked all major things. Apparently, I've messed up the code with some global renamings somewhat, additionally I forgot to comment some experimetal stuff - embarassing. :oops: :( :?

But it's out anyway. :)

I just found some spare minutes in between the usual weekend family business to address at least some of your problems (attached v0.5.1_alpha).

1. Broken "Load Layout":
Should work now (for those interested: all of a sudden the <global> modifier was missing from the variable holding the picked layout, shrug)

2. Broken script call of "Save Layout":
Fixed (uncomplete refactoring).

3. 2 'mystic' lines in the ini:
Fixed (commented experimental code, :whistle: ).


-- new issue
4. Flawed blacklist and duped names check:

Question:

Code: Select all

$needle = "Tree";
$haystack_1 = "Plain, Crowded Wide, Tree, Crowded Navi, TreeXPanes, TreeYPanes, Catalogy, ATree, Pany, Minimalistic";
$haystack_2 = "Plain, Crowded Wide, Crowded Navi, TreeXPanes, TreeYPanes, Catalogy, ATree, Pany, Minimalistic";
What is the smartest SC way to check the haystacks for an exact (word/token) match for $needle so that only haystack_1 (3rd item) is matched?


Thanks & cheers,
Filehero
Attachments
LayoutManager-0.5.1_alpha.zip
(344.42 KiB) Downloaded 151 times

klownboy
Posts: 2702
Joined: 28 Feb 2012 19:27

Re: LayoutManager

Post by klownboy » 24 Mar 2012 17:00

Filehero, it's such a great script, I'm just glad to help in any way I can.
Alpha 0.5.1 seems to have solved some issues. I looked at the layouts.ini file however, and I could see where it saved my new layout [Original [no address bar] (just the "plain" w/o the address bar) and looked like the following: Note there was no line space after the previous layout, [Layout Minimalistic], and each line for the new layout has the same new layout statement in front of it. See below.

[Layout Minimalistic]
showToolbar=0
showAddressBar=0
showTabBar=0
showTree=0
showCatalog=0
showInfoPanel=0
wideInfoPanel=0
showStatusBar=0
showStatusBarButtons=0
dualPane=0
horizontalPane=1
[Layout Original [no address bar]]
showToolbar=1
[Layout Original [no address bar]]
showAddressBar=0
[Layout Original [no address bar]]
showTabBar=1
[Layout Original [no address bar]]
showTree=1
[Layout Original [no address bar]]
showCatalog=1
[Layout Original [no address bar]]
showInfoPanel=0
[Layout Original [no address bar]]
wideInfoPanel=0
[Layout Original [no address bar]]
showStatusBar=1
[Layout Original [no address bar]]
showStatusBarButtons=1
[Layout Original [no address bar]]
dualPane=0
[Layout Original [no address bar]]
horizontalPane=1

Is it your intention that any new layout show up in your main pop up menu with the other 6 layouts or only when you select "load layout"? My layout shows up in the load layouts but not in the main popup menu. Either way is fine, I was just curious. I did receive the same "Oups" error message (Oops), concerning missing layout attributes when I attempted to load my layout [Layout Original [no address bar]]. Note: It doesn't happen when I load a built-in layout...the above may be why?

Sorry I can't help your with your coding question. I'm a retired nuclear engineer (submarines) with unfortunately no coding experience other than minor scripts in "Autoit" and "Autohotkey" and some old batch files in DOS. Yeah, that's how old I am. :)
Thanks again for a great script,
Ken

nas8e9
Posts: 2014
Joined: 21 Jun 2008 14:50

Re: LayoutManager

Post by nas8e9 » 24 Mar 2012 17:16

@klownboy: For legibility reasons, could you enclose code and code-like lines in a Code block through the Code button directly above the post edit area? It helps when having to read lines quite literally, to have its formatting clarity.

klownboy
Posts: 2702
Joined: 28 Feb 2012 19:27

Re: LayoutManager

Post by klownboy » 24 Mar 2012 17:35

Sorry, I sure will now that I know. I've seen the boxed in code in other posts so I should have realized. Thanks for pointing that out.

Code: Select all

[Layout Minimalistic]
showToolbar=0
showAddressBar=0
showTabBar=0
showTree=0
showCatalog=0
showInfoPanel=0
wideInfoPanel=0
showStatusBar=0
showStatusBarButtons=0
dualPane=0
horizontalPane=1
[Layout Original [no address bar]]
showToolbar=1
[Layout Original [no address bar]]
showAddressBar=0
[Layout Original [no address bar]]
showTabBar=1
[Layout Original [no address bar]]
showTree=1
[Layout Original [no address bar]]
showCatalog=1
[Layout Original [no address bar]]
showInfoPanel=0
[Layout Original [no address bar]]
wideInfoPanel=0
[Layout Original [no address bar]]
showStatusBar=1
[Layout Original [no address bar]]
showStatusBarButtons=1
[Layout Original [no address bar]]
dualPane=0
[Layout Original [no address bar]]
horizontalPane=1

Filehero
Posts: 2283
Joined: 27 Feb 2012 18:50
Location: Windows 10 Pro x64

Re: LayoutManager

Post by Filehero » 24 Mar 2012 21:09

Hi Ken,
klownboy wrote:Filehero, it's such a great script,
once it works flawlessly .... ahem :wink:
klownboy wrote:I'm just glad to help in any way I can.
Thank you very much, it's really appreciated. I know, how much trouble it can be to hunt down bugs on the user side (Acronis True Image arghhhh..).
klownboy | out of original order wrote:Is it your intention that any new layout show up in your main pop up menu with the other 6 layouts or only when you select "load layout"? My layout shows up in the load layouts but not in the main popup menu. Either way is fine, I was just curious.
With the default settings (max layouts in menu: 6, dynamic menu mode: ON, hit counts not "0") it cannot be seen. :mrgreen:

What default behavior would you expect/like?
I have changed the default behavior (all hits zeroed, max menu entries: 15, dynamic menu mode: OFF) in the LayoutManager\resources\layouts_template.ini (which usually gets 'activated' by hitting 'More Settings | Reset Configuration').
For convenience, I have created an entire new package (release-0.5.2_alpha.zip, hoping that bandwidth is not a concern).

klownboy wrote:I did receive the same "Oups" error message (Oops), concerning missing layout attributes when I attempted to load my layout [Layout Original [no address bar]]. Note: It doesn't happen when I load a built-in layout...the above may be why?
That 'Oups'-message is 'just' a consequence of your busted "no address bar" layout (it is supposed to come up if someone by accident deletes a property line when editing the layouts.ini directly).

klownboy wrote:I looked at the layouts.ini file however, and I could see where it saved my new layout [Original [no address bar] (just the "plain" w/o the address bar) and looked like the following: Note there was no line space after the previous layout, [Layout Minimalistic], and each line for the new layout has the same new layout statement in front of it. See below.

Code: Select all

[Layout Minimalistic]
showToolbar=0
...
...
horizontalPane=1
[Layout Original [no address bar]]
showToolbar=1
[Layout Original [no address bar]]
showAddressBar=0
...
That's a really strange one, I couldn't reproduce it yet on a fresh install over here:
1. Pick 'Plain' layout
2. Hide address bar (Ctrl+Shift+F12) and catalog (Ctrl+F8)
3. Save Layout As with new name 'no address bar'
Everything is fine on my machine. :?:

Edit update: Have you used bracket chars '[]' in the new name? This will screw the underlying ini-file implementation (in VisualBasic, not XY). I have to add them to the blacklist.

Can you remember what exactly you did, in what order? Can anyone else repro this bug?
klownboy wrote:I'm a retired nuclear engineer (submarines)
:shock: How cool is that?


Again, I thank You for painstakingly and patiently helping me. :appl:


Cheers,
Filehero
Attachments
release-0.5.2_alpha.zip
(344.4 KiB) Downloaded 155 times

Filehero
Posts: 2283
Joined: 27 Feb 2012 18:50
Location: Windows 10 Pro x64

Re: LayoutManager

Post by Filehero » 25 Mar 2012 01:20

The legal-character-in-names is starting to become a lot of fun. :wink:

Don't know, whether I should simply come up with a tiny white list of legal ones - or digging deeper into the VB6 RegExp API. Will see and decide next week.

For now, I've added the chars ":", "[", "]", "?" to the list of 'illegal' chars in names, but I recommend not to mess too much with these special characters (for instance, it can happen you misleadingly get the "The layout already exists!"-message when renaming).


Cheers,
Filehero
Attachments
LayoutManager-0.6_alpha.zip
(344.56 KiB) Downloaded 164 times

klownboy
Posts: 2702
Joined: 28 Feb 2012 19:27

Re: LayoutManager

Post by klownboy » 25 Mar 2012 15:14

I loaded 0.6 alpha but haven't yet played with it. I wanted to let you know first that I did use the bracket symbols [ ]. I believe my layout was called, Original [no address bar] See the code box of my layout ini file.

Update: I made a new layout using the latest version. This time I simply called it Original. I used no brackets or special characters. :) I looked at the layouts.ini file and it appears to be fine - no extra lines and spaces where there should be spaces. See below:

Code: Select all

[Layout Minimalistic]
showToolbar=0
showAddressBar=0
showTabBar=0
showTree=0
showCatalog=0
showInfoPanel=0
wideInfoPanel=0
showStatusBar=0
showStatusBarButtons=0
dualPane=0
horizontalPane=1

[Layout Original]
showToolbar=1
showAddressBar=0
showTabBar=1
showTree=1
showCatalog=1
showInfoPanel=0
wideInfoPanel=0
showStatusBar=1
showStatusBarButtons=1
dualPane=0
horizontalPane=1
The "Oups" message box comes up when you select "Load layout..." from the menu and hit "OK" at the bottom of the list without selecting a layout. Obviously someone shouldn't be doing that, they should be canceling instead. I just happened to do it while typing this post. Unless you want a different message for that event like, "Select a layout first dummy or cancel". :lol:
With your new default changes on the number of new layouts in the menu, the new layout is reflected properly in the menu as "Layout 9: Original" (and has the "golden star" when it's selected).

Certainly no biggie, but you have an extra space after the word "and" in your special character message or warning.

Thanks, it's looking good,
Ken

Filehero
Posts: 2283
Joined: 27 Feb 2012 18:50
Location: Windows 10 Pro x64

Re: LayoutManager

Post by Filehero » 25 Mar 2012 19:48

Hi Ken,
klownboy wrote:I looked at the layouts.ini file and it appears to be fine - no extra lines and spaces where there should be spaces.
Sounds good. :) Thanks for this feedback.
klownboy wrote: The "Oups" message box comes up when you select "Load layout..." from the menu and hit "OK" at the bottom of the list without selecting a layout.
Very good point, thanks!
This is already fixed (a one-liner): If nothing is selected, nothing happens when you hit OK (I don't think any preselection would make much sense here).
klownboy wrote:Thanks, it's looking good,
:) I will assemble a new version the upcoming week, addressing the special character pitfall with naming.

I hoped you've enjoyed a sunny sunday as we did over here!


Cheers,
Filehero

klownboy
Posts: 2702
Joined: 28 Feb 2012 19:27

Re: LayoutManager

Post by klownboy » 26 Mar 2012 14:50

Hi Filehero,
I hope all is well. I've been doing a bit more playing with your 0.6 alpha version and I haven't experienced any significant issues. Though when I initially installed it (copied it to the script folder), I checked out "Renaming layout" and I think it was going to allow me to rename a layout when no layout had a golden star yet and there was no current layout reflected in brackets. So what layout would I be renaming in that case? I cancelled out so I'm not sure. After a layout is selected and has a golden star, it shows up in the menu in brackets beside the "Save Layout" and "Rename Layout" menu items. This happened again at some point, I believe, after modifying a layout. I'm not positive, but I know there was no was no "current" layout or golden starred layout. I'm having a problem repeating that issue (getting the menu in a state where no layouts are golden starred). I'm not sure what you think , but I suppose we shouldn't be able to "rename" a layout unless there is a "current" layout (i.e., one with a golden star)?

Sunday wasn't very nice here. It rained most of the day, but today is supposed to be be sunny and around 70 F. :)

Thanks again,
Ken

klownboy
Posts: 2702
Joined: 28 Feb 2012 19:27

Re: LayoutManager

Post by klownboy » 26 Mar 2012 15:21

Filehero, as a follow-up to my last post (please read that first), I was able to duplicate getting the Layout Manager Menu to show up with no layouts having a golden star (no currrent layout). It happens everytime you exit XYplorer and then restart it, even when you save all settings before you exit (I do not have the program save setting automatically on exit). In other words, I have a current layout one that is golden starred, it doesn't seem to matter which one, I then save all my settings and when I reopen XYplorer, there is no golden starred layout, though the layout looks the same as what it was before I exited. I hope that helps. So back to my original probably less important issue with renaming a layout, I suppose we shouldn't be able to rename a layout, unless there is a current layout (one with a golden star).
Thanks,
Ken

Post Reply