Commit a4c1af8d authored by Lucas Bourneuf's avatar Lucas Bourneuf

replace tkinter by standard types

parent 54e21d40
......@@ -5,7 +5,6 @@
import os
import clyngor
import tkinter as tk
from functools import partial
......@@ -21,12 +20,11 @@ DEFAULT_SHOWS = """% Let the #show begin:
"""
DEFAULT_EXPORT_FILE = 'extraction.lp'
with open(DEFAULT_EXPORT_FILE, 'ab') as fd:
pass # be sure that it exists
OPTION_FILETYPE = partial(tk.filedialog.asksaveasfilename, defaultextension='.lp')
pass # make sure that it exists
def run_on(context:str, *, shows:str=DEFAULT_SHOWS, export_file:OPTION_FILETYPE=DEFAULT_EXPORT_FILE):
def run_on(context:str, *, shows:str=DEFAULT_SHOWS, export_file:(open, 'w')=DEFAULT_EXPORT_FILE):
"""
shows -- ASP lines that will be used to export, but will not be added to the context
export_file -- name of the file to export to. If it contains an '{}', each model will generate its own file
......@@ -47,6 +45,7 @@ def run_on(context:str, *, shows:str=DEFAULT_SHOWS, export_file:OPTION_FILETYPE=
fd.write(''.join(atom + '.\n' for atom in model))
except clyngor.ASPSyntaxError as err:
raise err
except clyngor.utils.ASPSyntaxError:
print('UTILS?!')
except clyngor.utils.ASPSyntaxError as err:
print('This is specifically coming from utils module ; wtf?!')
raise err
return context
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment