-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
12 changed files
with
244 additions
and
150 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
{% set data = load_setup_py_data() %} | ||
package: | ||
name: xml2table | ||
version: {{ data['version'] }} | ||
|
||
source: | ||
path: .. | ||
|
||
build: | ||
script: python3 setup.py install | ||
|
||
requirements: | ||
build: | ||
- python >=3.6,{{PY_VER}}* | ||
- setuptools <60.0 | ||
run: | ||
- python {{PY_VER}}* | ||
- numpy >=1.8* | ||
|
||
about: | ||
home: https://github.com/Xemin0/XML2Table | ||
license: BSD 3-Clause | ||
license_file: LICENSE | ||
license_family: BSD | ||
|
||
summary: data['description'] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
from setuptools import setup, find_packages | ||
|
||
setup( | ||
name = 'xml2table', | ||
version = '0.2.2', | ||
packages = find_packages(), | ||
url = 'https://github.com/Xemin0/XML2Table', | ||
|
||
# BSD 3-Clause License: | ||
# - http://choosealicense.com/licenses/bsd-3-clause | ||
# - http://opensource.org/licenses/BSD-3-Clause | ||
license = 'BSD', | ||
author = 'Xemin0', | ||
author_email = '[email protected]', | ||
description = 'A simple python GUI to facilate parameter settings (Contact Energies) in XML file generated by CompuCell3D, by converting between XML and a colored table. ', | ||
install_requires = [ | ||
'numpy>=1.8.0', | ||
], | ||
# See https://pypi.python.org/pypi?%3Aaction=list_classifiers | ||
classifiers = [ | ||
'Development Status :: 4 - Beta', | ||
'License :: OSI Approved :: BSD License', | ||
'Programming Language :: Python :: 3', | ||
'Programming Language :: Python :: 3.7', | ||
'Programming Language :: Python :: 3.8', | ||
'Programming Language :: Python :: 3.9', | ||
'Programming Language :: Python :: 3.10', | ||
], | ||
entry_points={ | ||
'console_scripts': [ | ||
'xml2table=xml2table.xml2table:main', | ||
], | ||
} | ||
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
# __init__.py | ||
|
||
from .xml2table import main | ||
|
||
# Optional | ||
#from .utils.EventHandler import EventHandler | ||
#from .visual_components.ColorBar import ColorBar |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
from .EventHandler import EventHandler |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
from .xml_parser import names_and_values |
File renamed without changes.
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
from .ColorBar import ColorBar |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,151 @@ | ||
""" | ||
Front-end GUI for the python app XML2Table | ||
to facilitate the Contact Energy Plugin settings in XML generated in CompuCell3D | ||
Visual Compenents and their usages (Left to Right) | ||
- Text Field for XML(Contact Energy Plugin): | ||
- XML section copy-pasted from CC3D.twedit to be converted to table | ||
or | ||
- XML section generated based on the adjusted table | ||
- Four Buttons: | ||
- Convert XML to Table | ||
- Generate XML from Table | ||
- Add a New Cell | ||
- Clear the Table | ||
- Color Bar Field: | ||
- Table Field: | ||
""" | ||
import tkinter as tk | ||
|
||
if __name__ == "__main__": | ||
# running as a script | ||
from utils.EventHandler import EventHandler | ||
from visual_components.ColorBar import ColorBar | ||
else: | ||
from .utils.EventHandler import EventHandler | ||
from .visual_components.ColorBar import ColorBar | ||
|
||
def main(): | ||
""" | ||
# Base window | ||
""" | ||
|
||
window = tk.Tk() | ||
window.title("Simple XML2Table Editor") | ||
|
||
# Set minimal Size to ensure the texts in the buttons will be shown properly | ||
window.rowconfigure(0, minsize = 200, weight = 1) | ||
window.columnconfigure(0, minsize = 100, weight = 1) | ||
window.columnconfigure(1, minsize = 150, weight = 1) | ||
window.columnconfigure(2, minsize = 25, weight = 1) | ||
window.columnconfigure(3, minsize = 100, weight = 1) | ||
|
||
# ====================================== # | ||
|
||
|
||
|
||
""" | ||
# Create Frames for each region and attach them to the main window horizontally | ||
# with default sizes | ||
""" | ||
|
||
frame_txtField = tk.Frame(master = window, width = 60, height = 200) | ||
|
||
frame_buttons = tk.Frame(master = window, relief = tk.RAISED, bd = 2, width = 20, height = 200) | ||
|
||
frame_CB = tk.Frame(master = window, width = 30, height = 200) | ||
|
||
frame_table = tk.Frame(master = window, width = 100, height = 200) | ||
|
||
# ====================================== # | ||
|
||
|
||
""" | ||
# Arrange the Fields/Widgets accordingly inside the main window | ||
""" | ||
#frame_txtField.pack(fill = tk.BOTH, side = tk.LEFT, expand = True) | ||
#frame_buttons.pack(fill = tk.Y, side = tk.LEFT, expand = True) | ||
#frame_table.pack(fill = tk.BOTH, side = tk.LEFT, expand = True) | ||
|
||
frame_txtField.grid(row = 0, column = 0, sticky = 'nsew') | ||
frame_buttons.grid(row = 0, column = 1, sticky = 'ns') | ||
frame_CB.grid(row = 0, column = 2, sticky = 'ns') | ||
frame_table.grid(row = 0, column = 3, sticky = 'nsew') | ||
|
||
# ====================================== # | ||
|
||
|
||
|
||
""" | ||
# Text Field for XML | ||
""" | ||
|
||
text_box = tk.Text(master = frame_txtField) # height = 10, width = 20) | ||
|
||
# Place text field inside the frame | ||
text_box.pack(fill = tk.BOTH, expand = True) | ||
|
||
# ====================================== # | ||
""" | ||
# Event Handler Class Object | ||
""" | ||
e_handler = EventHandler(text_box, frame_table) | ||
|
||
# ====================================== # | ||
|
||
|
||
|
||
|
||
""" | ||
# Buttons | ||
- convert to table | ||
- convert to XML | ||
- add new cell | ||
- clear table | ||
# Event Handlers for each Button | ||
""" | ||
|
||
|
||
btn_xml2table = tk.Button(master = frame_buttons, text = 'Convert to Table', command = e_handler.toTable) | ||
btn_table2xml = tk.Button(master = frame_buttons, text = 'Convert to XML', command = e_handler.toXML) | ||
btn_newCell = tk.Button(master = frame_buttons, text = 'Add New Cell', command = e_handler.newCell) | ||
btn_clear = tk.Button(master = frame_buttons, text = 'Clear Table', command = e_handler.clearTable) | ||
|
||
# Place the three buttons inside the frame | ||
#btn_xml2table.pack(fill = tk.Y, padx = 5) | ||
#btn_table2xml.pack(fill = tk.Y, padx = 5) | ||
#btn_newCell.pack(fill = tk.Y, padx = 5) | ||
|
||
# Sticky = 'ew' to guarantee the buttons are all of the same width | ||
btn_xml2table.grid(row = 0, column = 0, sticky = 'ew', padx = 5, pady = 5) | ||
btn_table2xml.grid(row = 1, column = 0, sticky = 'ew', padx = 5, pady = 5) | ||
btn_newCell.grid(row = 2, column = 0, sticky = 'ew', padx = 5, pady = 5) | ||
btn_clear.grid(row = 3, column = 0, sticky = 'ew', padx = 5, pady = 5) | ||
|
||
|
||
# ====================================== # | ||
|
||
|
||
""" | ||
Color Bar | ||
200 x 25 | ||
""" | ||
color_bar = ColorBar(root = frame_CB, compute_color_func = e_handler.compute_color, | ||
W = 25, H = 200) | ||
|
||
|
||
# ====================================== # | ||
|
||
""" | ||
# Table Field | ||
** This part is not initialized by default, but will be updated once a related button event occurs | ||
""" | ||
|
||
|
||
window.mainloop() | ||
|
||
|
||
if __name__ == '__main__': | ||
main() |
Oops, something went wrong.