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

Workbench 8.0.26 (Python 3.7.7) compatibility #10

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
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
23 changes: 11 additions & 12 deletions export_sqlite_grt.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,12 +17,11 @@
# along with this program. If not, see <http://www.gnu.org/licenses/>.

import re
import StringIO
from io import StringIO

import grt
import mforms

from grt.modules import Workbench
from wb import DefineModule, wbinputs
from workbench.ui import WizardForm, WizardPage
from mforms import newButton, newCodeEditor, FileChooser
Expand Down Expand Up @@ -51,7 +50,7 @@ def validate_for_sqlite_export(cat):
for i, schema in enumerate(cat.schemata):
if schema.name in idt:
have_errors = True
if Workbench.confirm('Name conflict',
if grt.modules.Workbench.confirm('Name conflict',
'Schemas %d and %d have the same name "%s".'
' Please rename one of them.\n'
'Search for more such errors?' % (
Expand All @@ -69,15 +68,15 @@ def validate_for_sqlite_export(cat):
for i, tbl in enumerate(schema.tables):
if tbl.name == '':
have_errors = True
if Workbench.confirm('Name conflict',
if grt.modules.Workbench.confirm('Name conflict',
'Table %d in schema "%s". has no name.'
' Please rename.\n'
'Search for more such errors?' % (
i, schema.name)) == 0:
return False
if tbl.name in idt:
have_errors = True
if Workbench.confirm('Name conflict',
if grt.modules.Workbench.confirm('Name conflict',
'Tables %d and %d in schema "%s"'
' have the same name "%s".'
' Please rename one of them.\n'
Expand All @@ -96,15 +95,15 @@ def validate_for_sqlite_export(cat):
for i, column in enumerate(tbl.columns):
if column.name == '':
have_errors = True
if Workbench.confirm('Name conflict',
if grt.modules.Workbench.confirm('Name conflict',
'Column %d in table "%s"."%s". has no name.'
' Please rename.\n'
'Search for more such errors?' % (
i, schema.name, tbl.name)) == 0:
return False
if column.name in idt:
have_errors = True
if Workbench.confirm('Name conflict',
if grt.modules.Workbench.confirm('Name conflict',
'Columns %d and %d in table "%s"."%s"'
' have the same name "%s".'
' Please rename one of them.\n'
Expand All @@ -124,15 +123,15 @@ def validate_for_sqlite_export(cat):
if index.indexType == 'INDEX':
if index.name == '':
have_errors = True
if Workbench.confirm('Name conflict',
if grt.modules.Workbench.confirm('Name conflict',
'Index %d in table "%s"."%s". has no name.'
' Please rename.\n'
'Search for more such errors?' % (
i, schema.name, tbl.name)) == 0:
return False
if index.name in idt:
have_errors = True
if Workbench.confirm('Name conflict',
if grt.modules.Workbench.confirm('Name conflict',
'Indices %d and %d in table "%s"."%s"'
' have the same name "%s".'
' Please rename one of them.\n'
Expand Down Expand Up @@ -324,7 +323,7 @@ def order_tables(out, db_name, schema, unordered, respect_deferredness):
while not have_ordered:
if len(unordered) == 0:
have_ordered = True
for tbl in unordered.values():
for tbl in list(unordered.values()):
has_forward_reference = False
for fkey in tbl.foreignKeys:
if (fkey.referencedTable.name in unordered and
Expand Down Expand Up @@ -435,7 +434,7 @@ def comment_format(body):
if not validate_for_sqlite_export(cat):
return 1

out = StringIO.StringIO()
out = StringIO()
out.write(info_format(
'Creator',
'MySQL Workbench %d.%d.%d/ExportSQLite Plugin %s\n' % (
Expand All @@ -458,7 +457,7 @@ def comment_format(body):
for schema in [(s, s.name == 'main') for s in cat.schemata]:
export_schema(out, schema[0], schema[1])
except ExportSQLiteError as e:
Workbench.confirm(e.typ, e.message)
grt.modules.Workbench.confirm(e.typ, e.message)
return 1

sql_text = out.getvalue()
Expand Down