Ignore:
Timestamp:
03/07/12 20:34:41 (2 years ago)
Author:
Ales Erjavec <ales.erjavec@…>
Branch:
default
rebase_source:
e0e81317be7e94777360a2a0373960fc9889a2ac
Message:

Added unicode filename support for save/load widgets.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • Orange/OrangeWidgets/Data/OWSave.py

    r9671 r10462  
    77""" 
    88 
    9 # 
    10 # OWFile.py 
    11 # The File Widget 
    12 # A widget for opening orange data files 
    13 # 
    149from OWWidget import * 
    1510import OWGUI 
     
    9186#       The following is a workaround. 
    9287#       (As a consequence, filter selection is not taken into account when appending a default extension.) 
    93         filename, selectedFilter = str(QFileDialog.getSaveFileName(self, 'Save Orange Data File', startfile, 
    94                          self.dlgFormats)), self.dlgFormats.split("\n")[0] 
    95  
     88        filename, selectedFilter = QFileDialog.getSaveFileName(self, 'Save Orange Data File', startfile, 
     89                         self.dlgFormats), self.dlgFormats.split("\n")[0] 
     90        filename = unicode(filename) 
    9691        if not filename or not os.path.split(filename)[1]: 
    9792            return 
     
    9994        ext = lower(os.path.splitext(filename)[1]) 
    10095        if not ext in self.savers: 
    101             filt_ext = self.re_filterExtension.search(str(str(selectedFilter))).group("ext") 
     96            filt_ext = self.re_filterExtension.search(str(selectedFilter)).group("ext") 
    10297            if filt_ext == ".*": 
    10398                filt_ext = ".tab" 
     
    105100 
    106101 
    107         self.addFileToList(str(filename)) 
     102        self.addFileToList(filename) 
    108103        self.saveFile() 
    109104 
     
    111106        self.error() 
    112107        if self.data is not None: 
    113             combotext = str(self.filecombo.currentText()) 
     108            combotext = unicode(self.filecombo.currentText()) 
    114109            if combotext == "(none)": 
    115110                QMessageBox.information( None, "Error saving data", "Unable to save data. Select first a file name by clicking the '...' button.", QMessageBox.Ok + QMessageBox.Default) 
     
    125120                return 
    126121            self.error() 
    127  
    128  
    129122 
    130123    def addFileToList(self,fn): 
Note: See TracChangeset for help on using the changeset viewer.