Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Py3 compatibility #39

Open
wants to merge 30 commits into
base: 27ene19
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
30 commits
Select commit Hold shift + click to select a range
b3981c5
Update README.md
hernanchavezthielemann Dec 29, 2020
a107789
Update README.md
hernanchavezthielemann Dec 29, 2020
0521e34
setup and show func
hernanchavezthielemann Dec 31, 2020
770d8ec
setup and show func R02
hernanchavezthielemann Dec 31, 2020
456e811
setup and show func R03
hernanchavezthielemann Dec 31, 2020
42950f5
setup and show func R04
hernanchavezthielemann Jan 3, 2021
51e3438
setup and show func R05
hernanchavezthielemann Jan 3, 2021
17ebfc2
setup and show func R06 final py3 coverage
hernanchavezthielemann Jan 4, 2021
31e5463
setup and show func R06 final py3 coverage R01
hernanchavezthielemann Jan 4, 2021
70f4ad7
Update .travis.yml
hernanchavezthielemann Jan 4, 2021
b2f565b
Update README.md
hernanchavezthielemann Jan 4, 2021
c2e2e30
setup and show func R06 final py3 coverage R02
hernanchavezthielemann Jan 4, 2021
4179aee
Merge branch 'py3_compatibility' of github.com:hernanchavezthielemann…
hernanchavezthielemann Jan 4, 2021
033dec8
Update README.md
hernanchavezthielemann Jan 4, 2021
02afbad
Update README.md
hernanchavezthielemann Jan 4, 2021
7b99486
Update .travis.yml
hernanchavezthielemann Jan 4, 2021
63b7f6e
Update README.md
hernanchavezthielemann Jan 4, 2021
0ba793d
Update README.md
hernanchavezthielemann Jan 4, 2021
ea41b5e
setup sizes
hernanchavezthielemann Jan 4, 2021
911f320
Update .travis.yml
hernanchavezthielemann Jan 4, 2021
dca04f0
Update .travis.yml
hernanchavezthielemann Jan 4, 2021
461cab2
Update .travis.yml
hernanchavezthielemann Jan 4, 2021
e0a34c1
change angles dihedrals directive request
hernanchavezthielemann Apr 29, 2023
8604e37
Update file.py
hernanchavezthielemann Apr 29, 2023
52861a4
Merge pull request #60 from hernanchavezthielemann/hernanchavezthiele…
hernanchavezthielemann Apr 29, 2023
740eded
Update lammps.py
hernanchavezthielemann Apr 29, 2023
cb37911
Merge pull request #61 from hernanchavezthielemann/hernanchavezthiele…
hernanchavezthielemann Apr 29, 2023
1f39664
Merge pull request #59 from hernanchavezthielemann/hernanchavezthiele…
hernanchavezthielemann Apr 29, 2023
337b063
Update setup
hernanchavezthielemann Apr 29, 2023
a07fee7
Update setup
hernanchavezthielemann Apr 29, 2023
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 14 additions & 3 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,14 @@ language: bash
before_install: sudo apt-get install python-tk

language: python
python: 2.7
install: python2 setup -t
python:
- 2.7
- 3.5
- 3.9
install:
- python --version
- pip install coverage
- python setup -t

services:
- xvfb
Expand All @@ -12,4 +18,9 @@ before_script:
- "export DISPLAY=:99.0"
- sleep 3 # give xvfb some time to start

script: ./run
script:
- python run
- coverage run -m unittest discover

after_success:
- bash <(curl -s https://codecov.io/bash)
2 changes: 1 addition & 1 deletion LICENSE
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
MIT License

Copyright (c) 2018 Hernan Chavez Thielemann
Copyright (c) 2018-2021 Hernan Chavez Thielemann

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
Expand Down
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@

python 2.7: [![Build Status](https://travis-ci.org/hernanchavezthielemann/GRO2LAM.svg?branch=27ene19)](https://travis-ci.org/hernanchavezthielemann/GRO2LAM)
python 2.7 & 3.5-3.9: [![Build Status](https://travis-ci.com/hernanchavezthielemann/GRO2LAM.svg?branch=py3_compatibility)](https://travis-ci.com/hernanchavezthielemann/GRO2LAM)

python 2.7 & 3.5-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

Expand Down
7 changes: 4 additions & 3 deletions lib/grotolam.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
from lib.misc.version import __version__
from lib.misc.file import write_file
from lib.gui.main_gui import launch_gui
from lib.misc.display import show

class Grotolam(object):
def __init__(self, master=None):
Expand All @@ -27,14 +28,14 @@ def grotolam_launcher():
''' at this point this is just the name, quite deceptive ;)
maybe <run> can call directly the GUI in the future,
but this handles the library'''
print '\n'+' '*20+__version__+'\n'
show( '\n' + ' '*20 + __version__ + '\n')

launch_gui()

def grotolam_launcher_test():

print '-'*21+' TESTING '+'-'*21+'\n\n'
print '\n'+' '*20+__version__+'\n'
show( '-'*21 + ' TESTING ' + '-'*21 + '\n\n')
show( '\n' + ' '*20 + __version__ + '\n')
launch_gui( True)

#conv_data, ckbuttons, solva_tags,_quit_flag_ = launch_gui()
Expand Down
Binary file added lib/gui/__init__.pyc
Binary file not shown.
28 changes: 14 additions & 14 deletions lib/gui/conversion_gui.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,13 +7,13 @@
#/// Packages and globals definitions are here ///
#------------------------------------------------------

from Tkinter import Frame, Label, StringVar, Button # , IntVar
from lib.gui.tk_lib import Frame, Label, StringVar, Button # , IntVar
from lib.gui.tk_lib import bottom_hline_deco, format_dec, Drop_Down_List
from lib.gui.tk_lib import createmenubar, create_entry, get_entriesvalue
from lib.gui.custom_row import File_Entry

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

from lib.misc.warn import print_dec_g, pop_wrg_1, pop_err_1
from lib.misc.display import show_in_green, show
from lib.misc.warn import pop_wrg_1, pop_err_1
from lib.misc.file import check_file, check_in_file

from lib.handling.gromacs import extract_gromacs_data, get_ffldfiles
Expand Down Expand Up @@ -59,7 +59,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]
Expand Down Expand Up @@ -125,7 +125,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):
Expand Down Expand Up @@ -186,7 +186,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 )
Expand Down Expand Up @@ -219,9 +219,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]:
Expand Down Expand Up @@ -252,7 +252,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_)
Expand All @@ -279,7 +279,7 @@ def getdata_and_convert(self):
flag_done_ = False

if flag_done_:
print_dec_g( 'Data file generated as "data.gro2lam"' )
show_in_green( 'Data file generated as "data.gro2lam"' )

self._convertdata_ = sim_data
self._convertdata_['filename'] = data_fnam
Expand Down
14 changes: 7 additions & 7 deletions lib/gui/custom_row.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@
# By Hernan Chavez Thielemann
__author__ = 'Hernan Chavez Thielemann <hchavezthiele at gmail dot com>'

from Tkinter import Entry, Button, Frame, StringVar
from tk_lib import format_dec
from popup import FilePopUp
from lib.gui.tk_lib import Entry, Button, Frame, StringVar, format_dec
from lib.misc.display import show
from lib.gui.popup import FilePopUp


class File_Entry(Frame):
Expand Down Expand Up @@ -85,8 +85,8 @@ def browsefile(self, entry, ext=None):
'''Browse a file <button> action binder'''

pop = FilePopUp( master = self)
if ext<>None and isinstance(ext, tuple):
#print '--- ', ext, type(ext)
if ext != None and isinstance(ext, tuple):
#show( '--- ', ext, type(ext)
pop.filetypes['filetypes'] = ext #(("All","*"),) #
filepath = pop.getfilepath()

Expand All @@ -98,8 +98,8 @@ def browsefile(self, entry, ext=None):
entry.xview_moveto(1)
except:
if filepath not in [ '', ()]:
print "Could not open File: ", filepath
print exc_info()[1]
show( "Could not open File: ", filepath)
show( exc_info()[1])

def setter(self, value):

Expand Down
File renamed without changes.
52 changes: 25 additions & 27 deletions lib/gui/main_gui.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,15 +9,12 @@
from os.path import dirname, realpath
from sys import exit

from Tkinter import Tk, Frame, Label, TclError, PhotoImage

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.gui.tk_lib import Tk, Frame, Label, TclError, PhotoImage, createmenubar
from lib.gui.conversion_gui import Conversion
from lib.gui.script_gui import Script_GUI
from lib.gui.run_gui import Run_GUI
from lib.gui.popup import AboutPopUp
from lib.misc.display import show
from lib.misc.warn import wrg_3
from lib.misc.file import run_command
from lib.misc.version import __version__
Expand Down Expand Up @@ -74,23 +71,23 @@ def swapbody(self, _pbody_):# checked ok 16/09 -----------WF
this, because it is just a "small" overlapping I gess
'''

if self.prevailing_body <> _pbody_:
if self.prevailing_body != _pbody_:
if self.body == None:
self.body = self.create_conversion_gui()

else:
self.body.destroy()

if _pbody_==1:
print 'Swapping to gro2lam converter GUI'
show( 'Swapping to gro2lam converter GUI')
self.body = self.create_conversion_gui()

elif _pbody_==2:
print 'Swapping to input script generator GUI'
show( 'Swapping to input script generator GUI')
self.body = self.create_script_gui()

elif _pbody_==3:
print 'Swapping to run script GUI'
show( 'Swapping to run script GUI')
self.body = self.create_run_gui()

else:
Expand Down Expand Up @@ -136,9 +133,9 @@ def launch_gui( started = False):
Main GUI constructor
'''

print wrg_3('Before you start, make sure there are no comments',
show( wrg_3('Before you start, make sure there are no comments',
'(;) in the middle of a line of the input GROMACS files.',
'Data after this symbol are not taken into account.')
'Data after this symbol are not taken into account.') )

MasterWin = Tk()
prompt = Gro2Lam_GUI( master= MasterWin, test = started)# xl_App
Expand All @@ -165,15 +162,16 @@ def launch_gui( started = False):
ws = MasterWin.winfo_screenwidth() # width of the screen
hs = MasterWin.winfo_screenheight() # height of the screen
# calculate x and y coordinates for the Tk root window
x = (ws/6) - (w/2)
if x <100:
x = int( (ws/6.0) - (w/2.0))
if x < 100:
x = 100
y = (hs/3) - (h/2)
if y< 40:
y = int( (hs/3.0) - (h/2.0))
if y < 40:
y = 40


#show([ws, hs, w, h, x, y] )
prompt.MAINVERTEX = [ws, hs, w, h, x, y]
#print MAINVERTEX
show( prompt.MAINVERTEX, v = 4)
# set the dimensions of the screen
# and where it is placed
MasterWin.geometry('{:d}x{:d}+{:d}+{:d}'.format( *prompt.MAINVERTEX[2:]))
Expand All @@ -188,15 +186,15 @@ def launch_gui( started = False):

def showlicence():

print 'Opening licence file'
command = 'gedit ./lib/docs/COPYING'#
run_command(command)
show( 'Opening licence file')
command = 'gedit ./lib/docs/LICENSE'#
run_command( command)

def launch_about( _master_window_):

print 'Launching about'
show( 'Launching about')

title_txt = ' '*17+'ABOUT GROTOLAM'
title_txt = ' '*10+'ABOUT GROTOLAM'

pop = AboutPopUp(master = _master_window_,
title = title_txt,
Expand All @@ -205,7 +203,7 @@ def launch_about( _master_window_):

def showuserman():

print 'Opening readme file'
show( 'Opening readme file')
command = 'gedit ./lib/docs/README.md'#
run_command(command)

Expand Down
Loading