Skip to content

Commit

Permalink
add label + text entry template
Browse files Browse the repository at this point in the history
  • Loading branch information
keenanlang committed Mar 31, 2024
1 parent ac9023d commit ac8f6e5
Show file tree
Hide file tree
Showing 2 changed files with 38 additions and 5 deletions.
21 changes: 16 additions & 5 deletions gestalt.py
Original file line number Diff line number Diff line change
Expand Up @@ -128,17 +128,28 @@ def doGenerate(args):
data = Datasheet.parseSubstitutionFile(args.in_filename)
else:
print("Unknown file extension: ", parse_format)
return

styles = Stylesheet.parse(args.template, include_dirs)

write_format = args.out_format

if args.out_format == "auto":
write_format = pathlib.PurePath(args.out_filename).suffix.lstrip('.')
if not args.out_filename:
print("Must specify either output file type or output file name")
return

args.out_format = pathlib.PurePath(args.out_filename).suffix.lstrip('.')

if args.out_format == "qt":
args.out_format = "ui"
elif args.out_format == "css":
args.out_format = "bob"

if not args.out_filename:
args.out_filename = pathlib.PurePath(args.template).stem + "." + args.out_format

if write_format == "qt" or write_format == "ui":
if args.out_format == "ui":
generateQtFile(styles, data, outputfile=args.out_filename)
elif write_format == "css" or write_format == "bob":
elif args.out_format == "bob":
generateCSSFile(styles, data, outputfile=args.out_filename)
else:
print("Unknown file extension: ", write_format)
Expand Down
22 changes: 22 additions & 0 deletions templates/widgets.yml
Original file line number Diff line number Diff line change
Expand Up @@ -142,6 +142,28 @@ _LabeledReadback: !Template:LabeledReadback
pv: "{read-pv}"


_LabeledEntry: !Template:LabeledEntry
- !Defaults
spacing: 15
fontname: "Liberation Sans"

- !hflow
padding: "{spacing}"
children:
- !Text
geometry: "{text-width}x20"
font: "-{fontname} -Regular -11"
alignment: CenterRight
text: "{label}"

- !TextEntry
<<: *editable
geometry: "{write-width}x20"
font: "-{fontname} -Regular -10"
pv: "{write-pv}"



_LabeledMenu: !Template:LabeledMenu
- !Defaults
spacing: 15
Expand Down

0 comments on commit ac8f6e5

Please sign in to comment.