Attempt to fix #138. Keeping open for verification.
This commit is contained in:
@@ -95,7 +95,10 @@ class App(QtCore.QObject):
|
||||
# Handled by:
|
||||
# * register_folder()
|
||||
# * register_recent()
|
||||
file_opened = QtCore.pyqtSignal(str, str) # File type and filename
|
||||
# Note: Setting the parameters to unicode does not seem
|
||||
# to have an effect. Then are received as Qstring
|
||||
# anyway.
|
||||
file_opened = QtCore.pyqtSignal(unicode, unicode) # File type and filename
|
||||
|
||||
progress = QtCore.pyqtSignal(int) # Percentage of progress
|
||||
|
||||
@@ -956,7 +959,7 @@ class App(QtCore.QObject):
|
||||
self.log.debug(" %s" % kind)
|
||||
self.log.debug(" %s" % filename)
|
||||
|
||||
record = {'kind': str(kind), 'filename': str(filename)}
|
||||
record = {'kind': unicode(kind), 'filename': unicode(filename)}
|
||||
if record in self.recent:
|
||||
return
|
||||
|
||||
@@ -1682,9 +1685,9 @@ class App(QtCore.QObject):
|
||||
# The Qt methods above will return a QString which can cause problems later.
|
||||
# So far json.dump() will fail to serialize it.
|
||||
# TODO: Improve the serialization methods and remove this fix.
|
||||
filename = str(filename)
|
||||
filename = unicode(filename)
|
||||
|
||||
if str(filename) == "":
|
||||
if filename == "":
|
||||
self.inform.emit("Open cancelled.")
|
||||
else:
|
||||
self.worker_task.emit({'fcn': self.open_gerber,
|
||||
@@ -1709,9 +1712,9 @@ class App(QtCore.QObject):
|
||||
# The Qt methods above will return a QString which can cause problems later.
|
||||
# So far json.dump() will fail to serialize it.
|
||||
# TODO: Improve the serialization methods and remove this fix.
|
||||
filename = str(filename)
|
||||
filename = unicode(filename)
|
||||
|
||||
if str(filename) == "":
|
||||
if filename == "":
|
||||
self.inform.emit("Open cancelled.")
|
||||
else:
|
||||
self.worker_task.emit({'fcn': self.open_excellon,
|
||||
@@ -1736,9 +1739,9 @@ class App(QtCore.QObject):
|
||||
# The Qt methods above will return a QString which can cause problems later.
|
||||
# So far json.dump() will fail to serialize it.
|
||||
# TODO: Improve the serialization methods and remove this fix.
|
||||
filename = str(filename)
|
||||
filename = unicode(filename)
|
||||
|
||||
if str(filename) == "":
|
||||
if filename == "":
|
||||
self.inform.emit("Open cancelled.")
|
||||
else:
|
||||
self.worker_task.emit({'fcn': self.open_gcode,
|
||||
@@ -1763,9 +1766,9 @@ class App(QtCore.QObject):
|
||||
# The Qt methods above will return a QString which can cause problems later.
|
||||
# So far json.dump() will fail to serialize it.
|
||||
# TODO: Improve the serialization methods and remove this fix.
|
||||
filename = str(filename)
|
||||
filename = unicode(filename)
|
||||
|
||||
if str(filename) == "":
|
||||
if filename == "":
|
||||
self.inform.emit("Open cancelled.")
|
||||
else:
|
||||
# self.worker_task.emit({'fcn': self.open_project,
|
||||
@@ -1813,9 +1816,9 @@ class App(QtCore.QObject):
|
||||
except TypeError:
|
||||
filename = QtGui.QFileDialog.getSaveFileName(caption="Export SVG")
|
||||
|
||||
filename = str(filename)
|
||||
filename = unicode(filename)
|
||||
|
||||
if str(filename) == "":
|
||||
if filename == "":
|
||||
self.inform.emit("Export SVG cancelled.")
|
||||
return
|
||||
else:
|
||||
@@ -1836,9 +1839,9 @@ class App(QtCore.QObject):
|
||||
except TypeError:
|
||||
filename = QtGui.QFileDialog.getOpenFileName(caption="Import SVG")
|
||||
|
||||
filename = str(filename)
|
||||
filename = unicode(filename)
|
||||
|
||||
if str(filename) == "":
|
||||
if filename == "":
|
||||
self.inform.emit("Open cancelled.")
|
||||
else:
|
||||
self.worker_task.emit({'fcn': self.import_svg,
|
||||
@@ -1879,6 +1882,8 @@ class App(QtCore.QObject):
|
||||
except TypeError:
|
||||
filename = QtGui.QFileDialog.getSaveFileName(caption="Save Project As ...")
|
||||
|
||||
filename = unicode(filename)
|
||||
|
||||
try:
|
||||
f = open(filename, 'r')
|
||||
f.close()
|
||||
@@ -2306,7 +2311,7 @@ class App(QtCore.QObject):
|
||||
self.worker_task.emit({'fcn': worker_task, 'params': [self]})
|
||||
|
||||
def register_folder(self, filename):
|
||||
self.defaults["last_folder"] = os.path.split(str(filename))[0]
|
||||
self.defaults["last_folder"] = os.path.split(unicode(filename))[0]
|
||||
|
||||
def set_progress_bar(self, percentage, text=""):
|
||||
self.ui.progress_bar.setValue(int(percentage))
|
||||
|
||||
Reference in New Issue
Block a user