comparison frontends/src/jp/constants.py @ 2532:772447ec070f

jp: pubsub options refactoring: There is now only "use_pubsub", and specification are set using "pubsub_flags" argument when instantiating CommandBase. Options are more Python Zen compliant by using explicit arguments for item, draft, url instead of trying to guess with magic keyword and type detection. Pubsub node and item are now always using respecively "-n" and "-i" even when required, this way shell history can be used to change command more easily, and it's globally less confusing for user. if --pubsub-url is used, elements can be overwritten with individual option (e.g. change item id with --item). New "use_draft" argument in CommandBase, to re-use current draft or open a file path as draft. Item can now be specified when using a draft. If it already exists, its content will be added to current draft (with a separator), to avoid loosing data. common.BaseEdit.getItemPath could be simplified thanks to those changes. Pubsub URI handling has been moved to base.py.
author Goffi <goffi@goffi.org>
date Wed, 21 Mar 2018 19:13:22 +0100
parents 8e770ac05b0c
children dcc77f23e370
comparison
equal deleted inserted replaced
2531:1dfc5516dead 2532:772447ec070f
34 OUTPUT_COMPLEX = u'complex' # complex data (e.g. multi-level dictionary) 34 OUTPUT_COMPLEX = u'complex' # complex data (e.g. multi-level dictionary)
35 OUTPUT_XML = u'xml' # XML node (as unicode string) 35 OUTPUT_XML = u'xml' # XML node (as unicode string)
36 OUTPUT_LIST_XML = u'list_xml' # list of XML nodes (as unicode strings) 36 OUTPUT_LIST_XML = u'list_xml' # list of XML nodes (as unicode strings)
37 OUTPUT_TYPES = (OUTPUT_TEXT, OUTPUT_DICT, OUTPUT_LIST, OUTPUT_LIST_DICT, OUTPUT_DICT_DICT, OUTPUT_COMPLEX, OUTPUT_XML, OUTPUT_LIST_XML) 37 OUTPUT_TYPES = (OUTPUT_TEXT, OUTPUT_DICT, OUTPUT_LIST, OUTPUT_LIST_DICT, OUTPUT_DICT_DICT, OUTPUT_COMPLEX, OUTPUT_XML, OUTPUT_LIST_XML)
38 38
39 # Pubsub options flags
40 SERVICE = u'service' # service required
41 NODE = u'node' # node required
42 SINGLE_ITEM = u'single_item' # only one item is allowed
43 MULTI_ITEMS = u'multi_items' # multiple items are allowed
44
39 # ANSI 45 # ANSI
40 A_HEADER = A.BOLD + A.FG_YELLOW 46 A_HEADER = A.BOLD + A.FG_YELLOW
41 A_SUBHEADER = A.BOLD + A.FG_RED 47 A_SUBHEADER = A.BOLD + A.FG_RED
42 # A_LEVEL_COLORS may be used to cycle on colors according to depth of data 48 # A_LEVEL_COLORS may be used to cycle on colors according to depth of data
43 A_LEVEL_COLORS = (A_HEADER, A.BOLD + A.FG_BLUE, A.FG_MAGENTA, A.FG_CYAN) 49 A_LEVEL_COLORS = (A_HEADER, A.BOLD + A.FG_BLUE, A.FG_MAGENTA, A.FG_CYAN)