Metadata property added to call ref. Checkin of the latest readme_creator files
This commit is contained in:
parent
faa701e3de
commit
fcb3cc7bde
17 changed files with 19766 additions and 8351 deletions
6
readme_creator/etc/LoG_call_ref_.py
Normal file
6
readme_creator/etc/LoG_call_ref_.py
Normal file
|
@ -0,0 +1,6 @@
|
|||
readfile = lambda fpath: open(fpath, 'r', encoding='utf-8').read()
|
||||
writefile = lambda fpath, x: open(fpath, 'w', encoding='utf-8').write(x)
|
||||
|
||||
from collections import Counter
|
||||
asd = Counter(readfile('LoG_call_ref.json').split('\n'))
|
||||
import pdb; pdb.set_trace();
|
61
readme_creator/etc/listbox_goto.py
Normal file
61
readme_creator/etc/listbox_goto.py
Normal file
|
@ -0,0 +1,61 @@
|
|||
import PySimpleGUIQt as sg
|
||||
print(sg)
|
||||
|
||||
|
||||
dicta1 = {
|
||||
"a": "hellgdfgo world",
|
||||
4: 5,
|
||||
"qwerty" : "ytjyhrewq"
|
||||
}
|
||||
dicta2 = {
|
||||
"a": "helldasdo world",
|
||||
4: 5,
|
||||
"qwerty" : "ytrewq"
|
||||
}
|
||||
dicta3 = {
|
||||
"a": "hello world",
|
||||
4: 5,
|
||||
"qwerty" : "ytwqddqwrewq"
|
||||
}
|
||||
|
||||
|
||||
class ParsingError(object):
|
||||
def __init__(self, psg_object, num):
|
||||
self.num = num
|
||||
self.psg_object = psg_object
|
||||
|
||||
def __str__(self):
|
||||
return self.__repr__()
|
||||
|
||||
def __repr__(self):
|
||||
return f'{self.num} {self.psg_object}'
|
||||
|
||||
@staticmethod
|
||||
def headers():
|
||||
return 'num,psg_object'.split(',')
|
||||
|
||||
|
||||
items = [
|
||||
ParsingError(dicta1, 45),
|
||||
ParsingError(dicta2, 42),
|
||||
ParsingError(dicta3, 12),
|
||||
]
|
||||
|
||||
|
||||
window = sg.Window('Test', [
|
||||
[sg.Listbox(items, key='qwe', enable_events=True)],
|
||||
[sg.B('q1'), sg.B('q2'), sg.B('q3')],
|
||||
],return_keyboard_events=True)
|
||||
|
||||
while True:
|
||||
event, values = window()
|
||||
if event in ('Exit', None): break
|
||||
|
||||
print(event, values)
|
||||
|
||||
if event == 'q1':
|
||||
gui = values['qwe'][0]
|
||||
print(gui.num)
|
||||
print(gui.psg_object[4])
|
||||
|
||||
window.close()
|
60
readme_creator/etc/pep8ify.py
Normal file
60
readme_creator/etc/pep8ify.py
Normal file
|
@ -0,0 +1,60 @@
|
|||
import inspect
|
||||
import PySimpleGUI
|
||||
|
||||
"""
|
||||
Create All Possible Tags
|
||||
Will output to STDOUT all of the different tags for classes, members and functions for a given PySimpleGUI.py
|
||||
file. Functions that begin with _ are filtered out from the list.
|
||||
Displays the results in a PySimpleGUI window which can be used to copy and paste into other places.
|
||||
|
||||
"""
|
||||
|
||||
|
||||
def new_name(name):
|
||||
name = name.replace("OK", "*1")
|
||||
name = name.replace("TK", "*2")
|
||||
name = name.replace("RGB", "*3")
|
||||
new = name[0].lower()
|
||||
for c in name[1:]:
|
||||
new += '_' + c.lower() if (c.isupper() or c == "*") else c
|
||||
new=new.replace("*1", "ok")
|
||||
new = new.replace("*2", "tk")
|
||||
new = new.replace("*3", "rgb")
|
||||
return new
|
||||
|
||||
layout = [[PySimpleGUI.Output(size=(600,300))]]
|
||||
window = PySimpleGUI.Window('Dump of tags', layout, resizable=True).Finalize()
|
||||
|
||||
psg_members = inspect.getmembers(PySimpleGUI)
|
||||
|
||||
psg_funcs = [o for o in psg_members if inspect.isfunction(o[1])]
|
||||
psg_classes = [o for o in psg_members if inspect.isclass(o[1])]
|
||||
# I don't know how this magic filtering works, I just know it works. "Private" stuff (begins with _) are somehow
|
||||
# excluded from the list with the following 2 lines of code. Very nicely done Kol-ee-ya!
|
||||
psg_classes_ = list(set([i[1] for i in psg_classes])) # filtering of anything that starts with _ (methods, classes, etc)
|
||||
psg_classes = list(zip([i.__name__ for i in psg_classes_], psg_classes_))
|
||||
|
||||
for pclass in sorted(psg_classes):
|
||||
if 'Tk' in pclass[0] or 'TK' in pclass[0] or 'Element' == pclass[0]: # or 'Window' == i[0]:
|
||||
continue
|
||||
# print(f'### {pclass[0]} Element')
|
||||
# print('')
|
||||
# print(f'<!-- <+{pclass[0]}.doc+> -->')
|
||||
# print(f'<!-- <+{pclass[0]}.__init__+> -->')
|
||||
print('')
|
||||
print(f'{pclass[0]} methods in PEP8 format --------------------------------------')
|
||||
for funcs in inspect.getmembers(pclass[1]):
|
||||
if '_' not in funcs[0]:
|
||||
# print(f'{pclass[0]}.{new_name(funcs[0])} = {pclass[0]}.{funcs[0]}') # version that has class on front
|
||||
print(f'{new_name(funcs[0])} = {funcs[0]}') # version without class on front (use for most)
|
||||
# print('\n'.join([f"#### {j[0]}\n\n<!-- <+{pclass[0]}.{j[0]}+> -->\n" for j in inspect.getmembers(pclass[1]) if '_' not in j[0]]))
|
||||
|
||||
# print('\n------------------------- Functions start here -------------------------\n')
|
||||
#
|
||||
for f in psg_funcs:
|
||||
if f[0][0] == '_':
|
||||
continue
|
||||
print(f'{new_name(f[0])} = {f[0]}')
|
||||
# print(f"<!-- <+func.{f[0]}+> -->")
|
||||
|
||||
window.Read()
|
83
readme_creator/etc/psg_gui.py
Normal file
83
readme_creator/etc/psg_gui.py
Normal file
|
@ -0,0 +1,83 @@
|
|||
import make_real_readme as mk_readme
|
||||
import PySimpleGUI as sg
|
||||
import logging, os
|
||||
|
||||
enable_logs = False
|
||||
|
||||
def readfile(filename):
|
||||
with open(filename, 'r', encoding='utf-8') as ff:
|
||||
return ff.read()
|
||||
|
||||
def writefile(fpath, content):
|
||||
with open(fpath, 'w', encoding='utf-8') as ff:
|
||||
ff.write(content)
|
||||
|
||||
|
||||
window = sg.Window('Test', [
|
||||
[sg.CB('include all .md files', True, key='all-checkbox', enable_events=True)],
|
||||
[sg.CB('1', True, key='file1', disabled=True, enable_events=True)],
|
||||
[sg.CB('2', False,key='file2', disabled=True, enable_events=True)],
|
||||
[sg.CB('3', False,key='file3', disabled=True, enable_events=True)],
|
||||
|
||||
|
||||
[sg.CB('4', False,key='file4', disabled=True, enable_events=True)],
|
||||
[sg.T('well, this is you output name:'), sg.I('readme.md', key='output_name'), sg.B('aaaand, hope for the best... Compile.', key='comp')],
|
||||
|
||||
[sg.T('-- -- -- -- -- -- --\nlogs\n-- -- -- -- -- -- --', justification='center')],
|
||||
# [sg.ML('', key='logs', size=(120,25))]
|
||||
|
||||
[sg.Column([
|
||||
[sg.T('COMPLETE')],
|
||||
[sg.Listbox([], size=(40, 10), key='COMPLETE')]
|
||||
]), sg.Column([
|
||||
[sg.T('NOTCOMPLETE')],
|
||||
[sg.Listbox([], size=(40, 10), key='NOTCOMPLETE')]
|
||||
])],
|
||||
|
||||
],element_justification='center')
|
||||
|
||||
while True:
|
||||
event, values = window()
|
||||
if event in ('Exit', None): break
|
||||
|
||||
print(event, values)
|
||||
|
||||
if event == 'all-checkbox':
|
||||
window['file1'](disabled=values['all-checkbox'])
|
||||
window['file2'](disabled=values['all-checkbox'])
|
||||
window['file3'](disabled=values['all-checkbox'])
|
||||
window['file4'](disabled=values['all-checkbox'])
|
||||
if event == 'comp':
|
||||
|
||||
if enable_logs: window['logs'](values['logs'] + 'start')
|
||||
|
||||
# MAIN WORK - START
|
||||
# 1### logging module
|
||||
logger = logging.getLogger(__name__); logger.setLevel(logging.DEBUG); a_log_file = logging.FileHandler('_logs.txt', mode='w'); a_log_file.setLevel(logging.DEBUG); formatter = logging.Formatter('%(asctime)s>%(levelname)s: %(message)s'); a_log_file.setFormatter(formatter); logger.addHandler(a_log_file);
|
||||
# 2### files to compile
|
||||
files = [0, 1, 2, 3] if values['all-checkbox'] else []
|
||||
if not values['all-checkbox']:
|
||||
if values['file1']: files.append(1)
|
||||
if values['file2']: files.append(2)
|
||||
if values['file3']: files.append(3)
|
||||
if values['file4']: files.append(4)
|
||||
# 3### REAL work:
|
||||
mk_readme.main(logger=logger,
|
||||
files_to_include=files,
|
||||
output_name=values['output_name'],
|
||||
delete_html_comments=True)
|
||||
|
||||
# MAIN WORK - END
|
||||
|
||||
for i in readfile('_logs.txt').split('\n'):
|
||||
if i.endswith('--> - COMPLETE'):
|
||||
window['COMPLETE'](values['COMPLETE'] + [i])
|
||||
else:
|
||||
window['NOTCOMPLETE'](values['COMPLETE'] + [i])
|
||||
|
||||
if enable_logs: window['logs'](values['logs'] + output_readme)
|
||||
|
||||
|
||||
|
||||
|
||||
window.close()
|
Loading…
Add table
Add a link
Reference in a new issue