BCDA-APS / adl2pydm

Convert MEDM's .adl files to PyDM's .ui format
Other
0 stars 4 forks source link

hyphen in file name raises exception #48

Closed prjemian closed 4 years ago

prjemian commented 4 years ago

Describe the bug When a converted file has a hyphen in the name, it raises an exception only because the file base name is used as the text of the class element in the .ui file. Changing the hyphen to underscore was successful.

atures_3.uiemian@wow ~/.../projects/sbc-mako $     pydm  ${PYDM_OPTIONS}  --macro "P=13ARV1:,R=cam1:"  AVT_Mako_G234C-fe 
Traceback (most recent call last):
  File "/home/beams/JEMIAN/.conda/envs/pydm_03/bin/pydm", line 11, in <module>
    load_entry_point('pydm', 'gui_scripts', 'pydm')()
  File "/home/beams1/JEMIAN/Documents/projects/pydm-prj/pydm_launcher/main.py", line 113, in main
    stylesheet_path=pydm_args.stylesheet
  File "/home/beams1/JEMIAN/Documents/projects/pydm-prj/pydm/application.py", line 96, in __init__
    self.main_window.open(ui_file, macros, command_line_args)
  File "/home/beams1/JEMIAN/Documents/projects/pydm-prj/pydm/main_window.py", line 328, in open
    target=target)
  File "/home/beams1/JEMIAN/Documents/projects/pydm-prj/pydm/display.py", line 62, in load_file
    w = load_ui_file(file, macros=macros)
  File "/home/beams1/JEMIAN/Documents/projects/pydm-prj/pydm/display.py", line 97, in load_ui_file
    klass, _ = uic.loadUiType(f)
  File "/home/beams/JEMIAN/.conda/envs/pydm_03/lib/python3.7/site-packages/PyQt5/uic/__init__.py", line 202, in loadUiType
    exec(code_string.getvalue(), ui_globals)
  File "<string>", line 4
    class Ui_AVT_Mako_G234C-features_3(object):
                           ^
SyntaxError: invalid syntax

Summary: clean up this text before using it in the class element

prjemian commented 4 years ago

Fixed this by writing Dialog instead: <class>Dialog</class>