Skip to content

Commit

Permalink
Merge pull request #10 from molssi-seamm/bugfix
Browse files Browse the repository at this point in the history
Bugfix
  • Loading branch information
paulsaxe authored Dec 17, 2019
2 parents e4e385a + ceaa39b commit b3ff2e3
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 55 deletions.
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@ dist: clean ## builds source and wheel package
python setup.py bdist_wheel
ls -l dist

install: clean ## install the package to the active Python's site-packages
install: uninstall ## install the package to the active Python's site-packages
python setup.py install

uninstall: clean ## uninstall the package
Expand Down
1 change: 1 addition & 0 deletions from_smiles_step/from_smiles.py
Original file line number Diff line number Diff line change
Expand Up @@ -148,6 +148,7 @@ def run(self):
echo 'CCO' | obabel --gen3d -ismi -omol | obabel -imol -osmi -xh\
| obabel --gen3d -ismi -opcjson
"""
logger.debug('Entering from_smiles:run')

next_node = super().run(printer)

Expand Down
66 changes: 12 additions & 54 deletions from_smiles_step/tk_from_smiles.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,7 @@

import seamm
import seamm_widgets as sw
import Pmw
import tkinter as tk
import tkinter.ttk as ttk


class TkFromSMILES(seamm.TkNode):
Expand Down Expand Up @@ -46,59 +44,19 @@ def right_click(self, event):

self.popup_menu.tk_popup(event.x_root, event.y_root, 0)

def edit(self):
"""Present a dialog for editing the SMILES string
def create_dialog(self):
"""Create a dialog for editing the SMILES string
"""
"""Create the dialog!"""
if not self.dialog:
self.dialog = Pmw.Dialog(
self.toplevel,
buttons=('OK', 'Help', 'Cancel'),
defaultbutton='OK',
master=self.toplevel,
title='Edit Energy parameters',
command=self.handle_dialog
)
self.dialog.withdraw()
frame = super().create_dialog('Edit SMILES Step')

frame = ttk.Frame(self.dialog.interior())
frame.pack(expand=tk.YES, fill=tk.BOTH)
self['frame'] = frame

# Create the widgets and grid them in
P = self.node.parameters
row = 0
widgets = []
for key in P:
self[key] = P[key].widget(frame)
widgets.append(self[key])
self[key].grid(row=row, column=0, sticky=tk.EW)
row += 1

sw.align_labels(widgets)

self.dialog.activate(geometry='centerscreenfirst')

def handle_dialog(self, result):

if result is None or result == 'Cancel':
self.dialog.deactivate(result)
return

if result == 'Help':
# display help!!!
return

if result != "OK":
self.dialog.deactivate(result)
raise RuntimeError(
"Don't recognize dialog result '{}'".format(result)
)

self.dialog.deactivate(result)

# Shortcut for parameters
# Create the widgets and grid them in
P = self.node.parameters

row = 0
widgets = []
for key in P:
P[key].set_from_widget()
self[key] = P[key].widget(frame)
widgets.append(self[key])
self[key].grid(row=row, column=0, sticky=tk.EW)
row += 1

sw.align_labels(widgets)

0 comments on commit b3ff2e3

Please sign in to comment.