Example #1
0
from cudatext import *
from cudax_lib import get_translation

_ = get_translation(__file__)  # I18N


def _sort(s, sep_k, sep_v):

    if sep_k:
        if not sep_k in s:
            return s
        key, val = s.split(sep_k, 1)
        vals = sorted(val.split(sep_v))
        return key + sep_k + sep_v.join(vals)
    else:
        vals = sorted(s.split(sep_v))
        return sep_v.join(vals)


def do_sort_sep_values():

    while 1:
        res = dlg_input_ex(
            2, _('Sort: separator chars'),
            _('Separator of prefix, to skip prefix (optional):'), '=',
            _('Separator of values after prefix:'), ',')
        if res is None:
            return
        sep_k, sep_v = res

        if len(sep_k) > 1:
Example #2
0
import json
import os
import collections
import zipfile
import tempfile
import configparser
from cudatext import *

from cudax_lib import get_translation
_ = get_translation(__file__)  # i18n

DIR_PY = app_path(APP_DIR_PY)
DIR_DATA = app_path(APP_DIR_DATA)

README_NAMES = (
    'readme.txt',
    'readme.md',
)

HISTORY_NAMES = ('history.txt', )


def _root_item(s):

    n = s.rfind('/')
    return n < 0 or n == len(s) - 1


def get_props_of_zip_filename(zip_fn):

    temp_dir = tempfile.gettempdir()
Example #3
0
import  cudax_lib           as apx
from    cudatext        import ed
#from    .cd_plug_lib    import *

d   = dict
odict = collections.OrderedDict
OptFetchResult = collections.namedtuple('OptFetchResult', 'opts filter sort')

pass;                           LOG     = (-1== 1) or apx.get_opt('_opts_dlg_log',False)    # Do or dont logging.
pass;                           from pprint import pformat
pass;                           pf=lambda d:pformat(d,width=150)
pass;                           pf80=lambda d:pformat(d,width=80)
pass;                           pf60=lambda d:pformat(d,width=60)
pass;                           ##!! waits correction

_   = apx.get_translation(__file__) # I18N

VERSION     = re.split('Version:', __doc__)[1].split("'")[1]
VERSION_V,  \
VERSION_D   = VERSION.split(' ')
MAX_HIST    = apx.get_opt('ui_max_history_edits', 20)
CFG_JSON    = app.app_path(app.APP_DIR_SETTINGS)+os.sep+'cuda_options_editor.json'
HTM_RPT_FILE= str(Path(tempfile.gettempdir()) / 'CudaText_option_report.html')
FONT_LST    = ['default'] \
            + [font
                for font in app.app_proc(app.PROC_ENUM_FONTS, '')
                if not font.startswith('@')]

NO_CHAP = _('_no_')

pass;                          #FONT_LST=FONT_LST[:3]