From b3981c5df29cf99b4fa2708f044ef26413c6e40e Mon Sep 17 00:00:00 2001 From: Hernan Chavez Thielemann Date: Tue, 29 Dec 2020 01:56:47 +0100 Subject: [PATCH 01/26] Update README.md --- README.md | 1 + 1 file changed, 1 insertion(+) diff --git a/README.md b/README.md index 5417746..6cb7fc2 100644 --- a/README.md +++ b/README.md @@ -1,5 +1,6 @@ python 2.7: [![Build Status](https://travis-ci.org/hernanchavezthielemann/GRO2LAM.svg?branch=27ene19)](https://travis-ci.org/hernanchavezthielemann/GRO2LAM) +python 3.9: [![Build Status](https://travis-ci.org/hernanchavezthielemann/GRO2LAM.svg?branch=py3_compatibility)](https://travis-ci.org/hernanchavezthielemann/GRO2LAM) # GRO2LAM Gromacs to Lammps simulation converter From a107789e88fe27eebea961a6e1860e18888af5f1 Mon Sep 17 00:00:00 2001 From: Hernan Chavez Thielemann Date: Tue, 29 Dec 2020 01:56:59 +0100 Subject: [PATCH 02/26] Update README.md --- README.md | 1 + 1 file changed, 1 insertion(+) diff --git a/README.md b/README.md index 6cb7fc2..2617853 100644 --- a/README.md +++ b/README.md @@ -1,5 +1,6 @@ python 2.7: [![Build Status](https://travis-ci.org/hernanchavezthielemann/GRO2LAM.svg?branch=27ene19)](https://travis-ci.org/hernanchavezthielemann/GRO2LAM) + python 3.9: [![Build Status](https://travis-ci.org/hernanchavezthielemann/GRO2LAM.svg?branch=py3_compatibility)](https://travis-ci.org/hernanchavezthielemann/GRO2LAM) # GRO2LAM From 0521e34aef56f0a7f5e96a819da731b6146a3779 Mon Sep 17 00:00:00 2001 From: hechathi Date: Thu, 31 Dec 2020 21:51:42 +0100 Subject: [PATCH 03/26] setup and show func --- lib/gui/conversion_gui.py | 3 +- lib/gui/custom_row.py | 3 +- lib/gui/main_gui.py | 3 +- lib/gui/popup.py | 4 +- lib/gui/run_gui.py | 4 +- lib/gui/script_gui.py | 7 +- lib/gui/tk_lib.py | 29 ++++++-- lib/misc/data.py | 16 ++--- lib/misc/display.py | 137 ++++++++++++++++++++++++++++++++++++++ lib/misc/version.py | 12 ++-- lib/misc/warn.py | 75 --------------------- setup | 107 ++++++++++++++++------------- 12 files changed, 246 insertions(+), 154 deletions(-) create mode 100644 lib/misc/display.py delete mode 100644 lib/misc/warn.py diff --git a/lib/gui/conversion_gui.py b/lib/gui/conversion_gui.py index 9683bf7..a34e033 100644 --- a/lib/gui/conversion_gui.py +++ b/lib/gui/conversion_gui.py @@ -7,8 +7,7 @@ #/// Packages and globals definitions are here /// #------------------------------------------------------ -from Tkinter import Frame, Label, StringVar, Button # , IntVar - +from tk_lib import Frame, Label, StringVar, Button # , IntVar from tk_lib import bottom_hline_deco, format_dec, Drop_Down_List from tk_lib import createmenubar, create_entry, get_entriesvalue from custom_row import File_Entry diff --git a/lib/gui/custom_row.py b/lib/gui/custom_row.py index 5b438c6..88fd48b 100644 --- a/lib/gui/custom_row.py +++ b/lib/gui/custom_row.py @@ -2,8 +2,7 @@ # By Hernan Chavez Thielemann __author__ = 'Hernan Chavez Thielemann ' -from Tkinter import Entry, Button, Frame, StringVar -from tk_lib import format_dec +from tk_lib import Entry, Button, Frame, StringVar, format_dec from popup import FilePopUp diff --git a/lib/gui/main_gui.py b/lib/gui/main_gui.py index 1a30811..a5f078c 100644 --- a/lib/gui/main_gui.py +++ b/lib/gui/main_gui.py @@ -9,14 +9,13 @@ from os.path import dirname, realpath from sys import exit -from Tkinter import Tk, Frame, Label, TclError, PhotoImage +from tk_lib import Tk, Frame, Label, TclError, PhotoImage, createmenubar from conversion_gui import Conversion from script_gui import Script_GUI from run_gui import Run_GUI from popup import AboutPopUp -from tk_lib import createmenubar from lib.misc.warn import wrg_3 from lib.misc.file import run_command diff --git a/lib/gui/popup.py b/lib/gui/popup.py index 9417bb4..ecd26a7 100644 --- a/lib/gui/popup.py +++ b/lib/gui/popup.py @@ -2,8 +2,8 @@ # By Hernan Chavez Thielemann __author__ = 'Hernan Chavez Thielemann ' -from Tkinter import Frame, Toplevel, Label, Button, Checkbutton, Entry -from Tkinter import SUNKEN, X, Y, PhotoImage, IntVar +from tk_lib import Frame, Toplevel, Label, Button, Checkbutton, Entry +from tk_lib import SUNKEN, X, Y, PhotoImage, IntVar from tk_lib import create_entry, bottom_hline_deco, get_entriesvalue from tkFont import Font from webbrowser import open_new diff --git a/lib/gui/run_gui.py b/lib/gui/run_gui.py index 3b852cd..db82c08 100644 --- a/lib/gui/run_gui.py +++ b/lib/gui/run_gui.py @@ -7,9 +7,9 @@ #/// Packages and globals definitions are here /// #------------------------------------------------------ -from Tkinter import Frame, Button, Label - +from tk_lib import Frame, Button, Label from tk_lib import create_entry, get_entriesvalue, bottom_hline_deco + from custom_row import createfileentry from lib.misc.data import check_vars from lib.misc.file import check_file, run_command diff --git a/lib/gui/script_gui.py b/lib/gui/script_gui.py index a5747d1..751a63d 100644 --- a/lib/gui/script_gui.py +++ b/lib/gui/script_gui.py @@ -7,13 +7,12 @@ #/// Packages and globals definitions are here /// #------------------------------------------------------ -from Tkinter import Frame, Button, Label - -from popup import PromptPopUp, PromptPopUp_wck - +from tk_lib import Frame, Button, Label from tk_lib import bottom_hline_deco, format_dec, Drop_Down_List from tk_lib import createmenubar, create_entry, get_entriesvalue +from popup import PromptPopUp, PromptPopUp_wck + from custom_row import File_Entry, createfileentry from lib.handling.lammps import write_lammps_input diff --git a/lib/gui/tk_lib.py b/lib/gui/tk_lib.py index 9107eb9..19a48ea 100644 --- a/lib/gui/tk_lib.py +++ b/lib/gui/tk_lib.py @@ -2,10 +2,29 @@ # By Hernan Chavez Thielemann __author__ = 'Hernan Chavez Thielemann ' -from Tkinter import Entry, Button, Frame, Label, Scrollbar, StringVar, Menu -from Tkinter import Listbox, IntVar, Checkbutton, Widget, Spinbox -from Tkinter import X, Y, SUNKEN, VERTICAL, END +from lib.misc.version import __python_version__ +from lib.misc.display import show +if __python_version__ > 3: + '''between trying and knowing, I rather prefer the last one''' + from tkinter import Tk, Frame, Label, TclError, PhotoImage, Toplevel + from tkinter import Entry, Button, Scrollbar, StringVar, Menu + from tkinter import Listbox, IntVar, Checkbutton, Widget, Spinbox +else: + from Tkinter import Tk, Frame, Label, TclError, PhotoImage, Toplevel + from Tkinter import Entry, Button, Scrollbar, StringVar, Menu + from Tkinter import Listbox, IntVar, Checkbutton, Widget, Spinbox + +''' Home made ttk library ''' + +#================================ +# Variables definition +#================================ +X = 'x' +Y = 'y' +SUNKEN = 'sunken' +VERTICAL = 'vertical' +END = 'end' ''' Home made ttk library ''' #================================ @@ -261,9 +280,9 @@ def createmenubar( _root_window_, _listofentriesdicts_): else: sub_menu.add_separator( ) else: - print ' - incomplete data - ' + show( ' - incomplete data - ') def testprint(): - print '>command33<' + show( '>command33<') # vim:tw=80 diff --git a/lib/misc/data.py b/lib/misc/data.py index d532f73..05e83b8 100644 --- a/lib/misc/data.py +++ b/lib/misc/data.py @@ -45,7 +45,7 @@ def check_vars( _vars_, _varstype_, _endtext_ = 'Input script not created!'): elif _varstype_[v] == 'int:': _aux_ = _vars_[v].split(':') - if len( _aux_) <> 2: + if len( _aux_) != 2: err_txt = ( 'Please separate two integers with one colon (:)' +' instead of {}'.format(_vars_[v])) _flag_c_ += [0,0] @@ -54,7 +54,7 @@ def check_vars( _vars_, _varstype_, _endtext_ = 'Input script not created!'): elif _varstype_[v] =='float:': _aux_ = _vars_[v].split(':') - if len( _aux_) <> 2: + if len( _aux_) != 2: err_txt = ( 'Please separate two floats with one colon (:)' +' instead of {}'.format(_vars_[v])) _flag_c_ += [0,0] @@ -64,7 +64,7 @@ def check_vars( _vars_, _varstype_, _endtext_ = 'Input script not created!'): elif _varstype_[v] == 'float:xyz': _aux_ = _vars_[v].split(':') - if len( _aux_) <> 2: + if len( _aux_) != 2: err_txt = ( 'Please separate the integer and "xyz" with one' +'colon (:) instead of {}'.format(_vars_[v])) _flag_c_ += [0,0] @@ -86,7 +86,7 @@ def check_vars( _vars_, _varstype_, _endtext_ = 'Input script not created!'): _aux_v_ = [x.strip(' ') for x in _vars_[v].split(':')] _min, _max = _varstype_[v][1:] - if len( _aux_v_) <> 3: + if len( _aux_v_) != 3: err_txt = ( 'Please separate three floats with two colons (:)' +' instead of {}'.format(_vars_[v])) _flag_c_ += [0,0,0] @@ -139,7 +139,7 @@ def check_vars( _vars_, _varstype_, _endtext_ = 'Input script not created!'): else: err_txt += ( 'Unknown value <{}>.\n'.format( _v_)) _flag_c_.append(0) - if err_txt <> '': + if err_txt != '': err_txt += '\nAllowed values are:\n' for av in _varstype_[v][2:-1]: err_txt += '"{}" or '.format(av) @@ -204,12 +204,12 @@ def check_vars( _vars_, _varstype_, _endtext_ = 'Input script not created!'): _flag_c_ += [0] else: #print _varstype_[v] - print 'Unhandled variable check for: ', _vars_[v] + show( 'Unhandled variable check for: ' , _vars_[v]) _flag_c_.append(1) '''**** Message ****''' - if err_txt<>'': - pop_err_1( err_txt+'\n'+_endtext_) + if err_txt != '': + pop_err_1( err_txt + '\n' + _endtext_) return _flag_c_ diff --git a/lib/misc/display.py b/lib/misc/display.py new file mode 100644 index 0000000..3a428df --- /dev/null +++ b/lib/misc/display.py @@ -0,0 +1,137 @@ +#!/usr/bin/python +# By Hernan Chavez Thielemann +# this is a blend of warn and vervose + +from sys import stdout +#from lib.gui.popup import message_box + +__verbose__ = [True]*2 + +def yellow_deco(func): + def func_wrapper(name): + return "\033[93m{0}\033[0m".format(func(name)) + return func_wrapper + +#@yellow_deco +def wrg_3(*text): + ''' yellow warning scheme''' + n_text = '' + if text != None: + for line in text[:-1]: + n_text += line +'\n' + n_text +=text[-1] + return '\033[93mWarning!!\033[0m -- '+ n_text + +def wrg_2(*text): + ''' warning scheme''' + n_text = '' + if text != None: + for line in text[:-1]: + n_text += line +'\n' + n_text +=text[-1] + return '\033[92m'+'Warning!!'+'\033[0m -- ' + n_text + +def wrg_1(*text): + ''' warning scheme''' + n_text = '' + if text != None: + for line in text[:-1]: + n_text += line +'\n' + n_text +=text[-1] + return '\033[91m'+'Warning!!'+'\033[0m -- ' + n_text + +def print_dec_g(*text): + ''' warning scheme''' + n_text = '' + if text != None: + for line in text[:-1]: + n_text += line +'\n' + n_text +=text[-1] + show( '\033[92m'+n_text+'\033[0m ') + +def green(_text_): + return '\033[92m'+_text_+'\033[0m ' + +def pop_wrg_1(*_text_, **kwargs): + + if '_i_' in kwargs.keys(): + _i_ = kwargs['_i_'] + else: + _i_ = -1 + + show( wrg_1(*_text_) ) + message_box(_text_[_i_], 'Warning', icon='warning') + +def pop_err_1(*_text_, **kwargs): + + if '_i_' in kwargs.keys(): + _i_ = kwargs['_i_'] + else: + _i_ = -1 + + show( wrg_1(*_text_) ) + message_box(_text_[_i_], 'Error', icon='error') + + +def show( *multi_print, **kargs): + ''' show in terminal function + to handle basically two things: + verbose levels (under development) + print under py2 and py3 with the same behaviour + e.g. to avoid : print( var1, var2) >< print var1, var2 + ''' + # verbose level set in each show command, else is printed + try: + v = kargs['v'] - 1 + except KeyError: + v = 0 + + if __verbose__[ v]: + + try: + end = kargs['end'] + except KeyError: + end = '\n' + try: + sep = kargs['sep'] + except KeyError: + sep = ' ' + + #ln = len(multi_print) + string = sep.join( multi_print ) + #string = '{}'.format( elem) + + stdout.write( string + end) + stdout.flush() + + +def set_verbose( degrees ): + ''' three degrees of verbose deep should be more than enough''' + global __verbose__ + if degrees < 1: + degrees = 1 + __verbose__ = [ True]*degrees + [ False]*( 3 - degrees) + +def test_show(): + set_verbose( 2) + a = 'misc txt here\n oops new line in the same var' + b = "another var\n with\n multiple\n lines" + c = 'last var' + show( ) + show( a) + show( a , b, c) + show( a , b, c, sep = '') + show( a , b, c, sep = '\n') + show( a , b, c, end = ' - ') + show( a , b, c, sep = ' - ', end = '\n') + show( a , b, c, sep = ' & ', end = '\n', v=3) +# vim:tw=80 + +## test +if __name__ == '__main__': + #print wrg_1('') + #print wrg_2('') + #print wrg_3('') + #print dec_g('deco') + test_show() + pass \ No newline at end of file diff --git a/lib/misc/version.py b/lib/misc/version.py index 1a6bd52..6f4ccd8 100644 --- a/lib/misc/version.py +++ b/lib/misc/version.py @@ -1,12 +1,16 @@ #!/usr/bin/python # pitiful file, but neats +from sys import version as python_version -__curr_ver__ = '1.25 10 Aug 2020'.split() +__curr_ver__ = '1.30 30 Dec 2020'.split() -__old_vers__ = ['1.24 20 Feb 2020', '1.23 02 Oct 2019', '1.21 20 Mar 2019', '1.2 27 Jan 2019', - '1.12 20 Dic 2018', '1.11 20 Jul 2018', '1.1 07 May 2018','1.0 13 Apr 2018'] +__old_vers__ = [ '1.25 10 Aug 2020', '1.24 20 Feb 2020', '1.23 02 Oct 2019', + '1.21 20 Mar 2019', '1.2 27 Jan 2019', '1.12 20 Dic 2018', + '1.11 20 Jul 2018', '1.1 07 May 2018','1.0 13 Apr 2018'] __url__ = 'https://github.com/hernanchavezthielemann/GRO2LAM' -__version__ = ' GRO2LAM version {} ({} {} {})'.format(*__curr_ver__) +__version__ = ' GRO2LAM version {} ({} {} {})'.format( *__curr_ver__) + +__python_version__ = float( python_version[ 0:3]) \ No newline at end of file diff --git a/lib/misc/warn.py b/lib/misc/warn.py deleted file mode 100644 index 2d8bbd4..0000000 --- a/lib/misc/warn.py +++ /dev/null @@ -1,75 +0,0 @@ -#!/usr/bin/python -# By Hernan Chavez Thielemann - -from lib.gui.popup import message_box - -def ye_deco(func): - def func_wrapper(name): - return "\033[93m{0}\033[0m".format(func(name)) - return func_wrapper - -#@ye_deco -def wrg_3(*text): - ''' yellow warning scheme''' - n_text = '' - if text <>None: - for line in text[:-1]: - n_text += line +'\n' - n_text +=text[-1] - return '\033[93mWarning!!\033[0m -- '+ n_text - -def wrg_2(*text): - ''' warning scheme''' - n_text = '' - if text <>None: - for line in text[:-1]: - n_text += line +'\n' - n_text +=text[-1] - return '\033[92m'+'Warning!!'+'\033[0m -- ' + n_text - -def wrg_1(*text): - ''' warning scheme''' - n_text = '' - if text <>None: - for line in text[:-1]: - n_text += line +'\n' - n_text +=text[-1] - return '\033[91m'+'Warning!!'+'\033[0m -- ' + n_text - -def print_dec_g(*text): - ''' warning scheme''' - n_text = '' - if text <>None: - for line in text[:-1]: - n_text += line +'\n' - n_text +=text[-1] - print '\033[92m'+n_text+'\033[0m ' - -def green(_text_): - return '\033[92m'+_text_+'\033[0m ' - -def pop_wrg_1(*_text_, **kwargs): - - if '_i_' in kwargs.keys(): - _i_ = kwargs['_i_'] - else: - _i_ = -1 - - print wrg_1(*_text_) - message_box(_text_[_i_], 'Warning', icon='warning') - -def pop_err_1(*_text_, **kwargs): - - if '_i_' in kwargs.keys(): - _i_ = kwargs['_i_'] - else: - _i_ = -1 - - print wrg_1(*_text_) - message_box(_text_[_i_], 'Error', icon='error') -## test - -#print wrg_1('') -#print wrg_2('') -#print wrg_3('') -#print dec_g('deco') diff --git a/setup b/setup index 8ca9817..b5d1846 100644 --- a/setup +++ b/setup @@ -1,49 +1,60 @@ #!/usr/bin/python +# By Hernan Chavez Thielemann +__author__ = 'Hernan Chavez Thielemann ' +### My homemade setup +# If you think/know that there is a better option for this please contact me. +# I am positively sure that there is something that I am skipping here ;) from os import system, getcwd from sys import exit, argv - +from lib.misc.display import green, show +from lib.misc.file import write_xfile, fileseeker, check_file +from lib.misc.version import __version__, __python_version__ _okflag_ = True _exit_txt_ = '' _test_ = False -if len(argv)>1 and argv[1] == '-t': +if len( argv) > 1 and argv[1] == '-t': _test_ = True try: - import Tkinter + if __python_version__ > 3: + tk_install_txt = 3 + from tkinter import Tk + else: + tk_install_txt = '' + from Tkinter import Tk + except ImportError: - print 'Package python-tk not found!' + show( 'Package python-tk not found!' ) sel = '' - print ('You need to install the python-tk package,' + show( 'You need to install the python-tk package,' +' would you like to do it now?') while sel not in ['yes','no','y','n']: sel = raw_input('Please write "yes" or "no": ') if sel in ['y','yes']: - su ='' + su = '' while su not in ['yes','no','y','n']: su = raw_input('Do you possess sudo rights?,' +' Please answer "yes" or "no": ') if su in ['y','yes']: - system('sudo apt-get install python-tk') + system('sudo apt-get install python{}-tk'.format( tk_install_txt)) + exit('\nPlease run again the setup\n' + - '"./GRO2LAM-27ene19/python2 setup"') + '"./GRO2LAM-ddmmmYY/python setup"') else: _exit_txt_ += ('Without sudo rights you cannot install tkinter.' +'\n - Please contact your system administrator\n') _okflag_ = False else: - _exit_txt_ += ( 'In order to use GRO2LAM GUI you need to install' - +' the python-tk package first\n') + _exit_txt_ += ( 'In order to use GRO2LAM GUI you need to install the ' + + 'python{}-tk package first\n'.format( tk_install_txt)) _okflag_ = False if _okflag_: - from lib.misc.file import write_xfile, fileseeker, check_file - from lib.misc.warn import green - from lib.grotolam import __version__ - print 'Checking instalation files for {}'.format(__version__) + show( 'Checking instalation files for {}'.format( __version__) ) commands_container = ['mkdir ./lib/docs','mv README.md ./lib/docs', 'mv setup ./lib', 'mv LICENSE ./lib/docs', @@ -51,41 +62,41 @@ if _okflag_: for com_txt in commands_container: system( com_txt) + +# The voodoo call *~* >o +_run_s_ = ( ')(rehcnual_malotorg \n:"__niam__" == __eman__ fi\n' + + 'rehcnual_malotorg tropmi malotorg.bil morf\n' + + 'nohtyp/nib/rsu/!#', 'just to play with the reader ;)') -_run_s_ = (')(rehcnual_malotorg \n:"__niam__" == __eman__ fi\n' - +'rehcnual_malotorg tropmi malotorg.bil morf\n'+ - 'nohtyp/nib/rsu/!#', 'just to play with the reader ;)') - - -_run_t_ = (')(tset_rehcnual_malotorg\ntset_rehcnual_malotorg tropmi' +_run_t_ = ( ')(tset_rehcnual_malotorg\ntset_rehcnual_malotorg tropmi' +' malotorg.bil morf\nnohtyp/nib/rsu/!#', 'same here ;)') -files = {'./grotolam.py', './__init__.py', './setup', - - './gui/popup.py', './gui/__init__.py', './gui/main_gui.py', - './gui/script_gui.py', './gui/run_gui.py','./gui/custom_row.py', - './gui/conversion_gui.py', './gui/tk_lib.py', '/gui/img/README.md', +files = { './grotolam.py', './__init__.py', './setup', + + './gui/popup.py', './gui/__init__.py', './gui/main_gui.py', + './gui/script_gui.py', './gui/run_gui.py','./gui/custom_row.py', + './gui/conversion_gui.py', './gui/tk_lib.py', '/gui/img/README.md', './gui/img/logo.ppm', './gui/img/gear.ppm', - './gui/img/logo2.ppm', './gui/img/small_logo2.ppm', - './gui/img/file.ppm', './gui/img/help.ppm', + './gui/img/logo2.ppm', './gui/img/small_logo2.ppm', + './gui/img/file.ppm', './gui/img/help.ppm', - './docs/README.md', './docs/LICENSE', + './docs/README.md', './docs/LICENSE', - './misc/file.py', './misc/warn.py', './misc/version.py', - './misc/data.py', './misc/geometry.py', './misc/__init__.py', + './misc/file.py', './misc/display.py', './misc/version.py', + './misc/data.py', './misc/geometry.py', './misc/__init__.py', - './handling/lammps.py', - './handling/__init__.py', './handling/gromacs.py'} + './handling/lammps.py', + './handling/__init__.py', './handling/gromacs.py'} if _okflag_: - # This gathers all the files downstream /lib - act_files = fileseeker(getcwd()+'/lib', '', '.pyc') + # This gathers all the files downstream /lib, avoiding pyc extension + act_files = fileseeker( getcwd() + '/lib', '', '.pyc') - # so the we can compare - if len(files) == len(act_files): - print 'File check sum ok!' + # so then we can compare + if len( files) == len( act_files): + show( 'File check sum ok!') fi_o_flag = 1 _eq_files_ = [] for _fi_ in act_files: @@ -93,36 +104,36 @@ if _okflag_: #print _eq_files_[-1] for _fi_ in files: if _fi_.lstrip('./') in _eq_files_: - if check_file('./lib/'+_fi_): - print ('File {} '+green('ok')).format(_fi_) + if check_file( './lib/'+_fi_): + show( ( 'File {} ' + green('ok') ).format(_fi_) ) else: fi_o_flag *= 0 else: - print 'File {} not found'.format(_fi_) + show( 'File {} not found'.format(_fi_) ) fi_o_flag *= 0 if fi_o_flag: - print 'File check done!' + show( 'File check done!') else: _exit_txt_ += 'Warning!! some file not found!\n' _okflag_ = False else: _okflag_ = False - print len(files), len(act_files) + show( len( files), len(act_files) ) for fi in act_files: - print fi + show( fi) _exit_txt_ += 'Warning!! there is something rare in these files\n' if not _okflag_: for fi in act_files: - print fi - exit(_exit_txt_) + show( fi) + exit( _exit_txt_) if _test_: - write_xfile('run', _run_t_[0][::-1]) + write_xfile( 'run', _run_t_[0][::-1]) else: - write_xfile('run', _run_s_[0][::-1]) + write_xfile( 'run', _run_s_[0][::-1]) -print 'Exit status OK!' +show( 'Exit status OK!') From 770d8ecbcf7b2f965682c302fd5f0e2000350fe7 Mon Sep 17 00:00:00 2001 From: hechathi Date: Thu, 31 Dec 2020 22:48:52 +0100 Subject: [PATCH 04/26] setup and show func R02 --- lib/gui/conversion_gui.py | 16 +-- lib/gui/custom_row.py | 9 +- lib/gui/main_gui.py | 22 +-- lib/gui/popup.py | 31 ++-- lib/gui/run_gui.py | 5 +- lib/gui/script_gui.py | 40 +++--- lib/handling/gromacs.py | 146 ++++++++++--------- lib/handling/lammps.py | 289 +++++++++++++++++++------------------- lib/misc/data.py | 15 +- lib/misc/display.py | 2 +- lib/misc/file.py | 34 ++--- lib/misc/geometry.py | 15 +- 12 files changed, 314 insertions(+), 310 deletions(-) diff --git a/lib/gui/conversion_gui.py b/lib/gui/conversion_gui.py index a34e033..4eacab2 100644 --- a/lib/gui/conversion_gui.py +++ b/lib/gui/conversion_gui.py @@ -12,7 +12,7 @@ from tk_lib import createmenubar, create_entry, get_entriesvalue from custom_row import File_Entry -from lib.misc.warn import print_dec_g, pop_wrg_1, pop_err_1 +from lib.misc.display import print_dec_g, pop_wrg_1, pop_err_1, show from lib.misc.file import check_file, check_in_file from lib.handling.gromacs import extract_gromacs_data, get_ffldfiles @@ -58,7 +58,7 @@ def create_conversion_gui(self): _atomstyle_ = 'full' data_cont = self.master._convert_['setup'] - if data_cont <> []: + if data_cont != []: _autoload_ = data_cont[0] eg_files = data_cont[1:-1] _atomstyle_ = data_cont[-1] @@ -124,7 +124,7 @@ def create_conversion_gui(self): ###### END CONSTRUCTION SITE -> PACK OUTSIDE ######### if self.master.test: - print 'Seeing main gro2lam converter GUI' + show( 'Seeing main gro2lam converter GUI') self.after(2000, self.test_hook ) def atomstyle( self): @@ -185,7 +185,7 @@ def autoloadstuff(self): #_autoload_ = self.objt_c[0].get() main_top_file = self.objt_c[2].get() - if self.autoload_buffer <> main_top_file: + if self.autoload_buffer != main_top_file: # self.autoload_buffer = _autoload_ self.autoload_buffer = main_top_file aux_cont, nonerr_flag = get_ffldfiles( main_top_file ) @@ -218,9 +218,9 @@ def load_top_file( self, *args ):#event=None, in order to avoid the the waving experienced with a first "''" in the entry an if is inside ''' - #print args - if self.objt_c[2].get() <> '': - #print ( self.objt_c[2].get()) + #show( args + if self.objt_c[2].get() != '': + #show( ( self.objt_c[2].get()) self.autol_b.configure( state = 'normal') for i in [2, 3, 4]: @@ -251,7 +251,7 @@ def getdata_and_convert(self): data_cont = self.master._convert_['setup'] root_folder = '/'.join(data_cont[1].split('/')[:-1]+['']) - print( 'Root folder: {}'.format( root_folder) ) + show( 'Root folder: {}'.format( root_folder) ) sim_data, _flags_ = extract_gromacs_data( data_cont[1:-1], _autoload_) diff --git a/lib/gui/custom_row.py b/lib/gui/custom_row.py index 88fd48b..3a1ad4e 100644 --- a/lib/gui/custom_row.py +++ b/lib/gui/custom_row.py @@ -3,6 +3,7 @@ __author__ = 'Hernan Chavez Thielemann ' from tk_lib import Entry, Button, Frame, StringVar, format_dec +from lib.misc.display import show from popup import FilePopUp @@ -84,8 +85,8 @@ def browsefile(self, entry, ext=None): '''Browse a file