欢迎光临散文网 会员登陆 & 注册

3.17. 自定义GUI工具条(OLEX2使用手册)

2021-02-27 21:11 作者:DJ_Tokyo  | 我要投稿

原文如下:


Customise GUI toolbar


You can add your own buttons to the main GUI toolbar there the buttons like EditIns, EditAtom and Text are located. For this purpose first of all locate your configuration directory by typing:


>>shell app.ConfigDir()


This directory may be located in different places depending on your operating system and configuration. By default it is the same as the DataDir() . Then you will need to create a folder 'gui' inside and a file 'toolbar.htm' in the 'gui' folder. Then you can place the following HTML code into that file:


<table border='1'> 

<tr> 

<td><a href='fuse'>Fuse</a></td> 

<td><a href='fmol'>fmol</a></td> 

<td><a href="rota 1 0 0 90 3">X</a></td> 

</tr>


<tr> 

<td><a href='cell'>Cell</a></td> 

<td><a href='basis'>Basis</a></td> 

<td><a href="rota 0 1 0 90 3">Y</a></td> 

</tr> 

</table>


Then you can update the GUI panel by expanding or collapsing any of the items or by typing the following into the Olex2 command line:


>>html.Update


Customising Olex2 Shortcuts and main menu bar


Olex2 keyboard shortcuts and main menu can be easily customised and extended. For this you need to open the application configuration directory as above and create custrom_settings.xld file. This file has two sections – shortcuts and menus:


<shortcuts 

 <shortcut key="Ctrl+Shift+C" macro="exec -o cmd"> 

<menus 

    <item title="Help;My item" macro="echo getCompilationInfo(full) -c"> 

    <item title="My menu;Exit" macro="exit" before="Help"> 

>


Note that to control your menu position in the menubar, you use the ‘before’ keyword.


译文如下:


3.17. 自定义GUI工具条


你可以将自己的按钮添加到包含EditIns、EditAtom和Text等按钮的主GUI工具栏中。为此,首先通过键入以下指令找到配置目录:


>>shell app.ConfigDir()


此目录可能位于不同的位置,具体取决于你的操作系统和配置。默认情况下,它与DataDir()相同。然后你需要在里面创建一个包含'toolbar.htm'文件的'gui'文件夹。然后你可以将以下HTML代码放入到该文件中:


<table border='1'>

<tr>

<td><a href='fuse'>Fuse</a></td>

<td><a href='fmol'>fmol</a></td>

<td><a href="rota 1 0 0 90 3">X</a></td>

</tr>

 

<tr>

<td><a href='cell'>Cell</a></td>

<td><a href='basis'>Basis</a></td>

<td><a href="rota 0 1 0 90 3">Y</a></td>

</tr>

</table>


然后,你可以通过展开或折叠任何项目,或者在Olex2指令行中键入以下指令来更新GUI面板:


>>html.Update


3.18. 自定义Olex2快捷键和主菜单栏

Olex2键盘快捷键和主菜单可以轻松自定义和扩展。为此,你需要以上述方式打开应用程序配置目录并创建custom_settings.xld文件。该文件有两部分——shortcuts和menus:


<shortcuts

<shortcutkey="Ctrl+Shift+C" macro="exec -o cmd">

<menus

<itemtitle="Help;My item" macro="echo getCompilationInfo(full)-c">

<itemtitle="My menu;Exit" macro="exit" before="Help">


请注意,要控制菜单栏中的菜单位置,请使用'before'关键词。


辅助视频如下:

3.17-自定义GUI工具条

https://www.bilibili.com/video/BV1hi4y1T7WM


公众号文章链接:

https://mp.weixin.qq.com/s?__biz=MzU0NjkzMTM1MQ==&mid=2247485364&idx=4&sn=50be39e23ef56d3cac3594c31ac60ba5&chksm=fb57504ccc20d95a421da23eea99d6319bb0ca35124415909b4a3acf56d4841a4b93f5df01cb&token=1126004319&lang=zh_CN#rd



3.17. 自定义GUI工具条(OLEX2使用手册)的评论 (共 条)

分享到微博请遵守国家法律