Commit 9a20d051 authored by Luke Campagnola's avatar Luke Campagnola
Browse files

Fixed unicode support in export file save

parent aff70070
from pyqtgraph.widgets.FileDialog import FileDialog from pyqtgraph.widgets.FileDialog import FileDialog
import pyqtgraph as pg import pyqtgraph as pg
from pyqtgraph.Qt import QtGui, QtCore, QtSvg from pyqtgraph.Qt import QtGui, QtCore, QtSvg
from pyqtgraph.python2_3 import asUnicode
import os, re import os, re
LastExportDirectory = None LastExportDirectory = None
...@@ -56,13 +57,13 @@ class Exporter(object): ...@@ -56,13 +57,13 @@ class Exporter(object):
return return
def fileSaveFinished(self, fileName): def fileSaveFinished(self, fileName):
fileName = str(fileName) fileName = asUnicode(fileName)
global LastExportDirectory global LastExportDirectory
LastExportDirectory = os.path.split(fileName)[0] LastExportDirectory = os.path.split(fileName)[0]
## If file name does not match selected extension, append it now ## If file name does not match selected extension, append it now
ext = os.path.splitext(fileName)[1].lower().lstrip('.') ext = os.path.splitext(fileName)[1].lower().lstrip('.')
selectedExt = re.search(r'\*\.(\w+)\b', str(self.fileDialog.selectedNameFilter())) selectedExt = re.search(r'\*\.(\w+)\b', asUnicode(self.fileDialog.selectedNameFilter()))
if selectedExt is not None: if selectedExt is not None:
selectedExt = selectedExt.groups()[0].lower() selectedExt = selectedExt.groups()[0].lower()
if ext != selectedExt: if ext != selectedExt:
......
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