diff options
| author | jvoisin | 2016-03-27 19:20:27 +0200 |
|---|---|---|
| committer | jvoisin | 2016-03-27 19:20:27 +0200 |
| commit | e56992e8e0ef197974932cf3849f3e2fab7281df (patch) | |
| tree | dbc60cce0d6121199abacce0fd6514c35014838a /mat-gui | |
| parent | 368474eaaa6cce9d219ff1963ff31e521eca62e9 (diff) | |
Make the code a bit more python3-compliant
Diffstat (limited to 'mat-gui')
| -rwxr-xr-x | mat-gui | 10 |
1 files changed, 7 insertions, 3 deletions
| @@ -13,7 +13,11 @@ import logging | |||
| 13 | import os | 13 | import os |
| 14 | import sys | 14 | import sys |
| 15 | import xml.sax | 15 | import xml.sax |
| 16 | import urllib2 | 16 | |
| 17 | try: | ||
| 18 | from urllib2 import unquote | ||
| 19 | except ImportError: # python3 | ||
| 20 | from urllib.parse import unquote | ||
| 17 | 21 | ||
| 18 | from libmat import mat | 22 | from libmat import mat |
| 19 | from libmat import strippers | 23 | from libmat import strippers |
| @@ -168,7 +172,7 @@ class GUI(object): | |||
| 168 | metadataPopupListStore.append([_('No metadata found'), '']) | 172 | metadataPopupListStore.append([_('No metadata found'), '']) |
| 169 | else: | 173 | else: |
| 170 | self.liststore[row][2] = _('Dirty') | 174 | self.liststore[row][2] = _('Dirty') |
| 171 | for i, j in self.liststore[row][0].file.get_meta().iteritems(): | 175 | for i, j in self.liststore[row][0].file.get_meta().items(): |
| 172 | metadataPopupListStore.append([i, j]) | 176 | metadataPopupListStore.append([i, j]) |
| 173 | 177 | ||
| 174 | popup_metadata = self.builder.get_object('MetadataPopup') | 178 | popup_metadata = self.builder.get_object('MetadataPopup') |
| @@ -260,7 +264,7 @@ non-anonymised) file from output archive')) | |||
| 260 | """ Since the dragged urls are ugly, | 264 | """ Since the dragged urls are ugly, |
| 261 | we need to process them | 265 | we need to process them |
| 262 | """ | 266 | """ |
| 263 | url = urllib2.unquote(url) # unquote url | 267 | url = unquote(url) # unquote url |
| 264 | url = url.decode('utf-8') # decode in utf-8 | 268 | url = url.decode('utf-8') # decode in utf-8 |
| 265 | if url.startswith('file:\\\\\\'): # windows | 269 | if url.startswith('file:\\\\\\'): # windows |
| 266 | return url[8:] # 8 is len('file:///') | 270 | return url[8:] # 8 is len('file:///') |
