Redesign of the menu system
Hi,
Currently, the menu system is a little unorganized and difficult to extend. My goal of the redesign are:
Modular
Split code into small modules, each module implement a specific function, modules uses predefined interface to call each other.
Extensible
The core of the menu system is components, which can be extended easily. Components can be written in C or lua.
Configurable
The menu system can be configured easily by end users. The layout of screen can be configured with xml file, while the window styles is configured with css file. Interface are exported to C and lua so that you can configure the menu system dynamically.
I suggest reorganize the menu system based on four layers:
Display layer
This is the lowest layer and have already been implemented. There are two display modules, one for text mode and one for graphics mode.
Windows layer
The windows layer build on top of display layer, it implement windows creation and manipulation. The windows layer uses css to configure the look and feel of windows, it also handle the difference between text mode and graphics mode so that components can be written regardless of the underlying display system.
Component layer
This is the core of menu system. This layer implements the logic of gui components, and rely on the windows layer or display layer for the actual rendering.
Menu layer
This is the lop layer. The layer is actually quite simple, it creates the components based on xml and link the various parts together.
Signature · 4 lines
Bean gitgrub home: http://github.com/grub/grub/ my fork page: http://github.com/bean123/grub/
Quoted 8 lines · Bean
Hi,
Currently, the menu system is a little unorganized and difficult to extend. My goal of the redesign are:
Modular
Split code into small modules, each module implement a specific function, modules uses predefined interface to call each other.
I'm ok with using predefined interfaces but splitting between .mods may be not beneficial since normal.mod isn't size-critical. But I'm ok with just compiling code-independent parts into the same module
Quoted 10 lines
Extensible
The core of the menu system is components, which can be extended easily. Components can be written in C or lua.Configurable
The menu system can be configured easily by end users. The layout of screen can be configured with xml file, while the window styles is configured with css file. Interface are exported to C and lua so that you can configure the menu system dynamically.
I don't like the idea of xml or css. For xnu device tree I designed my own format but then I saw that the whole idea of loading file for configuring grub behaviour is fundamentally flawed. Environment variables are already present, modifiable from shell and easy to use. To have level or tree-like model you can use '.' as a name separator it will make the system uniform with current FreeBSD booting.
Quoted 11 lines
I suggest reorganize the menu system based on four layers:
Windows layer
The windows layer build on top of display layer, it implement windows creation and manipulation. The windows layer uses css to configure the look and feel of windows, it also handle the difference between text mode and graphics mode so that components can be written regardless of the underlying display system.
Quoted 9 lines
Component layer
This is the core of menu system. This layer implements the logic of gui components, and rely on the windows layer or display layer for the actual rendering.Menu layer
This is the lop layer. The layer is actually quite simple, it creates the components based on xml and link the various parts together.
Doesn't gfxmenu in Collin's patches already have a similar system? Additionally your proposed abstractions are visually-oriented. It's ok for them to be so in menu_text and gfxmenu but these are the only 2 menus of this kind (they can be extensible, sure). In future we're likely to have other types of menus like dumb terminal menu or voice menu.
Quoted 12 lines
--
Beangitgrub home: http://github.com/grub/grub/
my fork page: http://github.com/bean123/grub/_______________________________________________
Grub-devel mailing list
[email protected]
http://lists.gnu.org/mailman/listinfo/grub-devel
Signature · 4 lines
Regards Vladimir 'phcoder' Serbinenko Personal git repository: http://repo.or.cz/w/grub2/phcoder.git
2009/8/19 Vladimir 'phcoder' Serbinenko <[email protected]>:
Quoted 22 lines · Bean
Quoted 8 lines
Hi,
Currently, the menu system is a little unorganized and difficult to extend. My goal of the redesign are:
Modular
Split code into small modules, each module implement a specific function, modules uses predefined interface to call each other.I'm ok with using predefined interfaces but splitting between .mods may be not beneficial since normal.mod isn't size-critical. But I'm ok with just compiling code-independent parts into the same module
Quoted 10 lines
Extensible
The core of the menu system is components, which can be extended easily. Components can be written in C or lua.Configurable
The menu system can be configured easily by end users. The layout of screen can be configured with xml file, while the window styles is configured with css file. Interface are exported to C and lua so that you can configure the menu system dynamically.
Quoted 6 lines
I don't like the idea of xml or css. For xnu device tree I designed my own format but then I saw that the whole idea of loading file for configuring grub behaviour is fundamentally flawed. Environment variables are already present, modifiable from shell and easy to use. To have level or tree-like model you can use '.' as a name separator it will make the system uniform with current FreeBSD booting.
XML/CSS is not the easiest format to work with but a bunch of variables which represent a tree is not nice either.
However, apt has settings format that allows to specify variables both separately and as trees (using {} nested blocks).
Something like that would probably make the life easier - you do not have to write the branch names again and again if you add several variables to the same branch but you can set a single variable deep inside the tree easily.
Thanks
Michal
Quoted 9 lines
Quoted 2 lines
To have level or tree-like model you can use '.' as a name separator it will make the system uniform with current FreeBSD booting.
XML/CSS is not the easiest format to work with but a bunch of variables which represent a tree is not nice either.
However, apt has settings format that allows to specify variables both separately and as trees (using {} nested blocks).
Do you mean sth like
set root {
branch {
value = key; }
}
?
This would effectively promote 'set' to a keyword of grub-sh scripting language but I'm ok with this.
Quoted 11 lines
Thanks
Michal
_______________________________________________
Grub-devel mailing list
[email protected]
http://lists.gnu.org/mailman/listinfo/grub-devel
Signature · 4 lines
Regards Vladimir 'phcoder' Serbinenko Personal git repository: http://repo.or.cz/w/grub2/phcoder.git
2009/8/19 Vladimir 'phcoder' Serbinenko <[email protected]>:
Quoted 9 lines
Quoted 9 lines
Quoted 2 lines
To have level or tree-like model you can use '.' as a name separator it will make the system uniform with current FreeBSD booting.
XML/CSS is not the easiest format to work with but a bunch of variables which represent a tree is not nice either.
However, apt has settings format that allows to specify variables both separately and as trees (using {} nested blocks).
Quoted 9 lines
Do you mean sth like
set root {
branch {
value = key;
}
}
?
This would effectively promote 'set' to a keyword of grub-sh scripting language but I'm ok with this.
Yes, something like that.
I am not sure how the configuration parser currently works and what are the implications of adding this syntax.
But having a shorthand
set root.branch {
value1=key1;
value2=key2;
value3=key3;
}
for
set root.branch.value1=key1;
set root.branch.value2=key2;
set root.branch.value3=key3;
is good for several reasons. At the very least it reduces typing, enhances readability somewhat, and allows for more modular construction of multilevel menus or such.
apt uses :: for separator (not .) and any :: can be replaced with { and has to be closed with } then.
Thanks
Michal
Hi,
Some clarification about the XML/CSS format:
First of all, the internal representation of component is tree-like structure, which is quite natural to XML, we can create the tree while parsing. Besides, we don't need to implement the full specification of XML/CSS, just a subset that works for us.
And as stated previously, XML/CSS is not the only interface. It's primarily used for normal user. As XML/CSS is wildly used, user can open the configuration file and get a general idea of what's it about. But for advanced users, he may decide to configure the menu in grub.cfg, in this case, XML is definitely not suitable as it conflicts with existing syntax, and the {} syntax would be fine.
Signature · 4 lines
Bean gitgrub home: http://github.com/grub/grub/ my fork page: http://github.com/bean123/grub/
Quoted 9 lines · Bean
Hi,
Some clarification about the XML/CSS format:
First of all, the internal representation of component is tree-like structure, which is quite natural to XML, we can create the tree while parsing. Besides, we don't need to implement the full specification of XML/CSS, just a subset that works for us.
Quoted 7 lines
And as stated previously, XML/CSS is not the only interface. It's primarily used for normal user. As XML/CSS is wildly used, user can open the configuration file and get a general idea of what's it about. But for advanced users, he may decide to configure the menu in grub.cfg, in this case, XML is definitely not suitable as it conflicts with existing syntax, and the {} syntax would be fine.
The problem of XML/CSS is that they can't be modified on the fly by commands from shell. You need to have an OS booted to do that. Because of that I see no benefit from supporting XM in grub itself. If you want to allow menu interface creation with XML+CSS which can be good thing you can create a converter running in userspace and this way you can reuse existing XML and CSS libraries. Then in grub the resulting format can be loaded using "source" command
Quoted 12 lines
--
Beangitgrub home: http://github.com/grub/grub/
my fork page: http://github.com/bean123/grub/_______________________________________________
Grub-devel mailing list
[email protected]
http://lists.gnu.org/mailman/listinfo/grub-devel
Signature · 4 lines
Regards Vladimir 'phcoder' Serbinenko Personal git repository: http://repo.or.cz/w/grub2/phcoder.git
Quoted 17 lines · Vladimir 'phcoder' Serbinenko
Quoted 9 lines · Bean
Hi,
Some clarification about the XML/CSS format:
First of all, the internal representation of component is tree-like structure, which is quite natural to XML, we can create the tree while parsing. Besides, we don't need to implement the full specification of XML/CSS, just a subset that works for us.
Quoted 7 lines
And as stated previously, XML/CSS is not the only interface. It's primarily used for normal user. As XML/CSS is wildly used, user can open the configuration file and get a general idea of what's it about. But for advanced users, he may decide to configure the menu in grub.cfg, in this case, XML is definitely not suitable as it conflicts with existing syntax, and the {} syntax would be fine.
Quoted 7 lines
The problem of XML/CSS is that they can't be modified on the fly by commands from shell. You need to have an OS booted to do that. Because of that I see no benefit from supporting XM in grub itself. If you want to allow menu interface creation with XML+CSS which can be good thing you can create a converter running in userspace and this way you can reuse existing XML and CSS libraries. Then in grub the resulting format can be loaded using "source" command
Hi,
XML/CSS is only used for the represent of initial layout, you can manipulate the tree after it's created. For example:
# Add static contentload_xml menu.xml
# Add dynamic content
...
It's like using html for page layout, and javascript for interaction. There is no conflict between the two.
About the converter, it could cause more trouble than it solves. XML/CSS can be written using plain text editor. while the converter needs to be compiled or depend on other program, and it needs to be rerun every time XML/CSS is changed, this could be quite troublesome.
Signature · 4 lines
Bean gitgrub home: http://github.com/grub/grub/ my fork page: http://github.com/bean123/grub/
2009/8/19 Bean <[email protected]>:
Quoted 37 lines
Quoted 17 lines · Vladimir 'phcoder' Serbinenko
Quoted 9 lines · Bean
Hi,
Some clarification about the XML/CSS format:
First of all, the internal representation of component is tree-like structure, which is quite natural to XML, we can create the tree while parsing. Besides, we don't need to implement the full specification of XML/CSS, just a subset that works for us.
Quoted 7 lines
And as stated previously, XML/CSS is not the only interface. It's primarily used for normal user. As XML/CSS is wildly used, user can open the configuration file and get a general idea of what's it about. But for advanced users, he may decide to configure the menu in grub.cfg, in this case, XML is definitely not suitable as it conflicts with existing syntax, and the {} syntax would be fine.
Quoted 7 lines
The problem of XML/CSS is that they can't be modified on the fly by commands from shell. You need to have an OS booted to do that. Because of that I see no benefit from supporting XM in grub itself. If you want to allow menu interface creation with XML+CSS which can be good thing you can create a converter running in userspace and this way you can reuse existing XML and CSS libraries. Then in grub the resulting format can be loaded using "source" command
Hi,
XML/CSS is only used for the represent of initial layout, you can manipulate the tree after it's created. For example:
# Add static content
load_xmlmenu.xml
# Add dynamic content
...
Quoted 7 lines
It's like using html for page layout, and javascript for interaction. There is no conflict between the two.
About the converter, it could cause more trouble than it solves. XML/CSS can be written using plain text editor. while the converter needs to be compiled or depend on other program, and it needs to be rerun every time XML/CSS is changed, this could be quite troublesome.
{} block syntax is also widely used and much easier to read and write by humans than XML+CSS.
I do not see the reason for pushing XML/CSS everywhere. It's a compromise that does not quite work for neither of visual formatting, other media formatting, automatic parsing nor user readability.
While you can add additional properties that make it specific enough for grub to know what to do (and drop things that grub would not use) it is no longer really XML/CSS and the familiarity could be even misleading.
XML/CSS was created for the web but does not work even there because it is unclear, underspecified, and does not solve problems of media representation description that any decent menu system will want to solve.
Given that using XML/CSS is contradicting your goal of extensibility.
Thanks
Michal
Quoted 12 lines · Michal Suchanek
{} block syntax is also widely used and much easier to read and write by humans than XML+CSS.
I do not see the reason for pushing XML/CSS everywhere. It's a compromise that does not quite work for neither of visual formatting, other media formatting, automatic parsing nor user readability.
While you can add additional properties that make it specific enough for grub to know what to do (and drop things that grub would not use) it is no longer really XML/CSS and the familiarity could be even misleading.
Quoted 6 lines
XML/CSS was created for the web but does not work even there because it is unclear, underspecified, and does not solve problems of media representation description that any decent menu system will want to solve.
Given that using XML/CSS is contradicting your goal of extensibility.
Hi,
It's just a format to represent data, XML or not, as long as it does the job, it's ok with me.
The basic requirement would be: component has a name, and various number of attributes. Some component is container that have child components.
Currently Colin use a format like this:
+ vbox {
position = (10, 440)
preferred_size = (620, 40)
+ label {
text="Select an item with the arrow keys and press Enter to boot." font="lime Regular 11" color=#000
}
+ label {
text="Press: 'c' for command line; 't' to switch to non-graphical menu." font="lime Regular 11" color=#000
}
}
If it's fine with others, I'd just stick to it.
Signature · 4 lines
Bean gitgrub home: http://github.com/grub/grub/ my fork page: http://github.com/bean123/grub/