1- import toml
21import warnings
32from copy import deepcopy
4- from bept .gen .toml_in_converter import in_toml , toml_in
5- from typing import Coroutine , Any
3+ from typing import Any , Coroutine
4+
5+ import toml
66from textual import on
77from textual .app import App
8- from textual .containers import Vertical , Horizontal , VerticalScroll
9- from textual .widgets import (
10- Footer ,
11- Label ,
12- Checkbox ,
13- RadioSet ,
14- RadioButton ,
15- TabbedContent ,
16- Input ,
17- TabPane ,
18- Select ,
19- Collapsible ,
20- Static ,
21- OptionList ,
22- )
8+ from textual .containers import Horizontal , Vertical , VerticalScroll
9+ from textual .widgets import (Checkbox , Collapsible , Footer , Input , Label ,
10+ OptionList , RadioButton , RadioSet , Select , Static ,
11+ TabbedContent , TabPane )
2312from textual .widgets .option_list import Option
2413
14+ from bept .gen .toml_in_converter import in_toml , toml_in
15+
2516# GLOBALS
2617TAB_NAMES = ["Input" , "Misc-Options" , "Output-Settings" ]
2718possible_inputs = ["mg-auto" , "mg-para" , "mg-manual" , "fe-manual" , "mg-dummy" ]
5546
5647
5748def generate_toml_file (input_file ):
58- global \
59- data , \
60- input_file_name , \
61- write_commands , \
62- calcenergy , \
63- calcforce , \
64- selected_input , \
65- form
49+ global data , input_file_name , write_commands , calcenergy , calcforce , selected_input , form
6650
6751 in_toml (input_file )
6852 toml_input_file_name = input_file_name = input_file [:- 3 ] + ".toml"
@@ -1519,20 +1503,18 @@ def compose(self):
15191503 yield Label ("Output" )
15201504 with Collapsible (title = "FORMAT TO WRITE DATA:" ):
15211505 with RadioSet (id = "format" ):
1522- yield RadioButton (
1523- "OpenDX" , id = "dx" , value = (self .write_pot [0 ] == "dx" )
1524- )
1506+ yield RadioButton ("OpenDX" , id = "dx" , value = (self .format [0 ] == "dx" ))
15251507 yield RadioButton (
15261508 "AVS UCD" ,
15271509 id = "avs" ,
15281510 disabled = (selected_input != "fe-manual" ),
1529- value = (self .write_pot [0 ] == "avs" ),
1511+ value = (self .format [0 ] == "avs" ),
15301512 )
15311513 yield RadioButton (
15321514 "UBHD" ,
15331515 id = "uhbd" ,
15341516 disabled = (selected_input == "fe-manual" ),
1535- value = (self .write_pot [0 ] == "uhbd" ),
1517+ value = (self .format [0 ] == "uhbd" ),
15361518 )
15371519
15381520
@@ -1542,14 +1524,7 @@ def __init__(self, input_path):
15421524 self .input_path = input_path
15431525
15441526 # Initializations
1545- global \
1546- data , \
1547- input_file_name , \
1548- write_commands , \
1549- calcenergy , \
1550- calcforce , \
1551- selected_input , \
1552- form
1527+ global data , input_file_name , write_commands , calcenergy , calcforce , selected_input , form
15531528 new_data = mg_auto_def
15541529 cgcent = ["" , "" , "" ]
15551530 fgcent = ["" , "" , "" ]
@@ -1772,7 +1747,10 @@ def action_show_tab(self, tab: str) -> None:
17721747
17731748 def action_quit (self ) -> Coroutine [Any , Any , None ]:
17741749 """Triggers when the App is quit"""
1775- self .new_data ["read" ]["mol" ] = ["pqr" , data ["read" ]["mol" ][1 ].split ("." )[0 ] + ".pqr" ]
1750+ self .new_data ["read" ]["mol" ] = [
1751+ "pqr" ,
1752+ data ["read" ]["mol" ][1 ].split ("." )[0 ] + ".pqr" ,
1753+ ]
17761754 self .new_data ["elec" ]["calcforce" ] = calcforce
17771755 self .new_data ["elec" ]["calcenergy" ] = calcenergy
17781756 for i in range (len (write_commands )):
0 commit comments