kvichans / cuda_config_menu Goto Github PK
View Code? Open in Web Editor NEWCudaText plugin to make custom menu
CudaText plugin to make custom menu
if app.app_api_version()<MIN_API_VER: return app.msg_status(_('Need update CudaText'))
это config_menu()
Т.е. это равно проверке api= в install.inf
http://synwrite.sourceforge.net/forums/viewtopic.php?p=10782#p10782
Перевести длинно, не переведу
changed Themes sub; now it has 2 subs
new ids for it
chd also dialog for themes. now 2 cmds to call 2 dialogs.
Если я пр. понял то по ум-ю плагин не работает
И только если я что то в menu file поправлю- работает
лучше дать команду- а- активировать меню плага. б- убрать. в- открыть menu file
Пач делает диалог новым
замена ф-ции
def config_menus_settings(self):
cfg_file = apx.get_opt('config_menus_from', DEF_MENU_CFG_FILE)
cfg_on_start= apx.get_opt('config_menus_on_start', True)
cfg_on_focus= apx.get_opt('config_menus_on_focus', False)
res_file = 1
res_onstart = 2
res_onfocus = 3
res_ok = 4
c1 = chr(1)
res = app.dlg_custom("Settings for 'Config menu'", 320, 136, '\n'.join([]
+[c1.join(['type=label', 'pos=6,6,310,0', 'cap='+LC_MENU_CONFIG_FILE])]
+[c1.join(['type=edit', 'pos=6,24,310,0', 'val='+cfg_file])]
+[c1.join(['type=check', 'pos=6,54,310,0', 'cap=Configure menu on start', 'val='+('1' if cfg_on_start else '0')])]
+[c1.join(['type=check', 'pos=6,74,310,0', 'cap=Configure menu on focus', 'val='+('1' if cfg_on_focus else '0')])]
+[c1.join(['type=button', 'pos=106,104,206,0', 'cap=OK'])]
+[c1.join(['type=button', 'pos=212,104,312,0', 'cap=Cancel'])]
))
if res is None: return
res, text = res
text = text.splitlines()
if res!=res_ok: return
new_file = text[res_file]
new_onstart = text[res_onstart]=='1'
new_onfocus = text[res_onfocus]=='1'
if new_file!=cfg_file:
apx.set_opt('config_menus_from', new_file)
if new_onstart!=cfg_on_start:
apx.set_opt('config_menus_on_start', new_onstart)
if new_onfocus!=cfg_on_focus:
apx.set_opt('config_menus_on_focus', new_onfocus)
#def config_menus_settings
#class Command
config_menus() -не нашел прорвеку ed.get_filename()!=''
или ed.get_prop(PROP_LEXER_FILE)!=''
.
Это бы ускорило плаг, может? из-за лишних on_focus.
новые подменю-пункты "Языки","темы"
надо бы добавить в default menu
учтите
"recents" - recent-files submenu
"themes" - color-themes submenu
"langs" - translations submenu
Menu has also
Edit> Blank oper> Convert tabs
Edit> Blank oper> Convert spaces
pls to menu.json
У себя правил-
заменял
app.app_proc( app.PROC_MENU_ADD, f('{};{};{}', prnt_id, hnt, cap))
на
app.menu_proc(id_action=app.MENU_ADD, id_menu=prnt_id, command=hnt, caption=cap)
При старте Куд-
Traceback (most recent call last):
File "<string>", line 1, in <module>
ImportError: No module named 'cuda_macros'
Traceback (most recent call last):
File "<string>", line 1, in <module>
ImportError: No module named 'cuda_macros'
OK config menus from "/home/user/Downloads/kv-menu2.json"
Пока неудобно-если поставил плаг он просто поменял меню..
в Куд добавилось в меню. а тут не видно. из-за плага. Нужно сделать комм 1- которая запретит исп-ть конфиг menu.json, комм 2- которая включит menu.json
Menu config>
Don't use menu config
Use menu config
Edit menu config
тогда не надо опций?
Apply--что это. зачем. в меню. почему нельзя иметь опции и все?
@kvichans plugin "Config Menu" by pressing button "Create config file with native menu" doesn't create any other items than top-menu
, top menu submenu
, editor context-menu
. I think it would be useful if it also have ability to create a default menu for tab header context menu
and dropdown submenu of toolbar buttons
, something like this:
,{"cap":"", "hint":"tab", "sub":[
{"cap":"Close tab", "cmd":"cmd_FileClose"}
,{"cap":"Close", "sub":[
{"cap":"Others (same group)","cmd":"cmd_FileCloseOtherThis"}
,{"cap":"Others (all groups)","cmd":"cmd_FileCloseOtherAll"}
...
So far I'm creating it manually (and then add the items I need), here's a default template if anyone needs one:
{
{"cap":"", "hint":"tab", "sub":[
{"cap":"Close tab", "cmd":"cmd_FileClose"}
,{"cap":"Close", "sub":[
{"cap":"Others (same group)","cmd":"cmd_FileCloseOtherThis"}
,{"cap":"Others (all groups)","cmd":"cmd_FileCloseOtherAll"}
,{"cap":"All (same group)","cmd":"?"}
,{"cap":"All (all groups)","cmd":"cmd_FileCloseAll"}
,{"cap":"Left tabs (same group)","cmd":"?"}
,{"cap":"Right tabs (same group)","cmd":"?"}
]}
,{"cap":"-"}
,{"cap":"Save", "cmd":"cmd_FileSave"}
,{"cap":"Save as...", "cmd":"cmd_FileSaveAs"}
,{"cap":"-"}
,{"cap":"Copy to clipboard","sub":[
{"cap":"Copy full filepath", "cmd":"cmd_CopyFilenameFull"}
,{"cap":"Copy filepath only", "cmd":"cmd_CopyFilenameDir"}
,{"cap":"Copy filename only", "cmd":"cmd_CopyFilenameName"}
]}
,{"cap":"Move tab to group","sub":[
{"cap":"1","cmd":"cmd_MoveTabToGroup1"}
,{"cap":"2","cmd":"cmd_MoveTabToGroup2"}
,{"cap":"3","cmd":"cmd_MoveTabToGroup3"}
,{"cap":"4","cmd":"cmd_MoveTabToGroup4"}
,{"cap":"5","cmd":"cmd_MoveTabToGroup5"}
,{"cap":"6","cmd":"cmd_MoveTabToGroup6"}
,{"cap":"-"}
,{"cap":"Floating 1","cmd":"cmd_MoveTabToGroupFloating1"}
,{"cap":"Floating 2","cmd":"cmd_MoveTabToGroupFloating2"}
,{"cap":"Floating 3","cmd":"cmd_MoveTabToGroupFloating3"}
,{"cap":"-"}
,{"cap":"Next","cmd":"cmd_MoveTabToGroupNext"}
,{"cap":"Previous","cmd":"cmd_MoveTabToGroupPrev"}
]}
,{"cap":"Pinned","cmd":"cmd_ToggleTabPinned"}
,{"cap":"Set tab color...","cmd":"cmd_SetTabColor"}
]}
}
Note: "?"
are put in place of commands that I could not find.
Commnds про кодировки- не все указали
азиатские забыли (и другие)
See file
readme-menu.zip
Why not (if possible) send the menu bar to a menu button? like on moderm web browsers, maybe a button on toolbar or along with tab bar (like list tabs button).
So you can obtain something of extra space :)
вместо команды **KeyDelete
надо исп-ть cCommand_TextDeleteSelection (в menu.json)-оно не делетит если нет выдел-я
cd_config_menu.py line 151:
i added an "if line" to not clear the menu if "how" set to "add"
if mnu_dict.get('how', 'add') == 'clear':
app.app_proc(app.PROC_MENU_CLEAR, top_id)
Pls add command "Edit/ Char map"
and Encodings asian/arabic - to def menu
possible in new Api.
1.0.255 (app 1.60.5)
add: menu_proc: support menu id "tab"
{"cap":"Copy current line" ,"cmd":"cCommand_ClipboardCopy"}
Не тот код команды (это просто Копир. -надо копир. строку)
Удалил settings/menu.json-теперь плаг ступорит. ничего не может сделать
Удалил ключ в usr- стало ок(не хор. решение)
'Choose existed file` --> 'Chosen file not exists:\n%s'
http://forum.wincmd.ru/viewtopic.php?p=114850#114850
Stanislav сообщает issue- оно крешит программу при зажатии ctrl+tab, неприятно
что править и кому?
Added support
You must add special id in
SPEC_IDS= { 'recents':'_recents', 'langs':'_langs', 'enc':'_enc', 'lexers':'_lexers'
,'_recents':'_recents', '_langs':'_langs', '_enc':'_enc', '_lexers':'_lexers'
, 'plugins':'_plugins'
, '_plugins':'_plugins'
, '_themes-ui':'_themes-ui'
, '_themes-syntax':'_themes-syntax'
, '_oplugins':'_oplugins'
}
works in my Cud alfa ver.
"Select" button -> "Browse"
"Open" btn -> "Edit"
tooltips for checkboxes-
"Apply menu once on CudaText start"
"Apply menu (common or lexer specific) when file tab gets focus"
В конфигураторе menu.json
используются имена из cudatext_cmd.py
. Если эти имена меняются, то возникает проблема, как это донести до пользователей.
Например, сегодня имена
cmd_Encoding_utf8_Reload
cmd_Encoding_utf8_NoReload
поменялись на
cmd_Encoding_utf8bom_Reload
cmd_Encoding_utf8bom_NoReload
Предлагаю ввести запрет на переименования
помоему, так не пишут.
+ mn_cfg_json = mn_cfg_json \
+ if mn_cfg_json else \
+ apx.get_opt('config_menus_from', DEF_MENU_CFG_FILE, apx.CONFIG_LEV_USER) \
5 Все таки неудобное решение с полным файлом меню, да и формат файла неудобен - юникод, да никакого толку от дерева структуры, но у меня руки есть и я просто допилю плагин.
Конечно лучше визуальный редактор, но, судя по всему, всякие настройки в cuda считаются второстепенным функционалом, чтобы на них время тратить. А если мне приспичит, то я для себя напишу.
http://forum.ru-board.com/topic.cgi?forum=5&bm=1&topic=47937&start=220#lt
Cuda has 2 items: a)renamed "groups- 1+2 horz", b)new "groups- 1+2 vert"
Чистая установка
заходим в длг плагина.
Python 3.5.2
OK config menus from "/home/user/Downloads/cud_old/settings/menu.json"
Traceback (most recent call last):
File "<string>", line 1, in <module>
File "/home/user/Downloads/cud_old/py/cuda_config_menu/cd_config_menu.py", line 438, in dlg_config
btn, vals, chds = dlg_wrapper(_('Config menu'), 5+350+5, 5+190+5, cnts, vals, focus_cid='file')
File "/home/user/Downloads/cud_old/py/cuda_config_menu/cd_plug_lib.py", line 497, in dlg_wrapper
aid = cnts[btn_i]['cid']
KeyError: 'cid'
лучше назвать с болш. букв и без "..."
Config Menu
как другие
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.