diff options
| author | jvoisin | 2013-04-05 22:53:13 +0200 |
|---|---|---|
| committer | jvoisin | 2013-04-05 22:53:13 +0200 |
| commit | 6c6a4e01171b8b6de3dc6a11c27c434de256ff2b (patch) | |
| tree | 3fe08b88cff044fb80e2d835d2e4422d617cdb15 /mat-gui | |
| parent | a64b69775aaa46de7f70aff18a18b527dbea32cc (diff) | |
Multiples files can now be drag'n'dropped in the GUI
Diffstat (limited to 'mat-gui')
| -rwxr-xr-x | mat-gui | 36 |
1 files changed, 20 insertions, 16 deletions
| @@ -529,23 +529,27 @@ non-anonymised) file to output archive')) | |||
| 529 | drag'n'droped into mat. | 529 | drag'n'droped into mat. |
| 530 | It basically add files. | 530 | It basically add files. |
| 531 | ''' | 531 | ''' |
| 532 | urls = selection.data.strip('\r\n\x00') # strip stupid characters | ||
| 533 | cleaned_urls = map(self.__clean_draged_file_path, urls.split('\n')) | ||
| 534 | task = self.populate(cleaned_urls) | ||
| 535 | GObject.idle_add(task.next) # asynchrone processing | ||
| 536 | 532 | ||
| 537 | def __clean_draged_file_path(self, url): | 533 | |
| 538 | ''' | 534 | def clean_path(url): |
| 539 | Since the dragged urls are ugly, | 535 | ''' |
| 540 | we need to process them | 536 | Since the dragged urls are ugly, |
| 541 | ''' | 537 | we need to process them |
| 542 | url = urllib2.unquote(url) # unescape stupid chars | 538 | ''' |
| 543 | if url.startswith('file:\\\\\\'): # windows | 539 | url = urllib2.unquote(url) # unescape stupid chars |
| 544 | return url[8:] # 8 is len('file:///') | 540 | url = url.replace('\n', '') |
| 545 | elif url.startswith('file://'): # nautilus, rox | 541 | if url.startswith('file:\\\\\\'): # windows |
| 546 | return url[7:] # 7 is len('file://') | 542 | return url[8:] # 8 is len('file:///') |
| 547 | elif url.startswith('file:'): # xffm | 543 | elif url.startswith('file://'): # nautilus, rox |
| 548 | return url[5:] # 5 is len('file:') | 544 | return url[7:] # 7 is len('file://') |
| 545 | elif url.startswith('file:'): # xffm | ||
| 546 | return url[5:] # 5 is len('file:') | ||
| 547 | |||
| 548 | urls = selection.get_data().split('\r') | ||
| 549 | urls = urls[:-1] # last entry in only a '\n' | ||
| 550 | urls = map(clean_path, urls) | ||
| 551 | task = self.populate(urls) | ||
| 552 | GObject.idle_add(task.next) # asynchrone processing | ||
| 549 | 553 | ||
| 550 | def __process_files(self, button, func): | 554 | def __process_files(self, button, func): |
| 551 | ''' | 555 | ''' |
