[alacarte] MainWindow: Make property editing work again



commit 23f0318083e989112892260f4ad0cec047570cc0
Author: Jasper St. Pierre <jstpierre mecheye net>
Date:   Thu Jan 10 21:33:57 2013 -0500

    MainWindow: Make property editing work again
    
    It seems I was mixing up binary/unicode data again. Rather
    than copy manually by reading into memory, just use shutil
    to do a direct copy.

 Alacarte/MainWindow.py |    6 ++----
 1 files changed, 2 insertions(+), 4 deletions(-)
---
diff --git a/Alacarte/MainWindow.py b/Alacarte/MainWindow.py
index ab7ae14..e9d84e0 100644
--- a/Alacarte/MainWindow.py
+++ b/Alacarte/MainWindow.py
@@ -19,10 +19,10 @@
 
 from gi.repository import Gtk, GObject, Gio, GdkPixbuf, Gdk, GMenu, GLib
 import cgi
-import codecs
 import os
 import gettext
 import subprocess
+import shutil
 
 from Alacarte import config
 gettext.bindtextdomain(config.GETTEXT_PACKAGE, config.localedir)
@@ -327,9 +327,7 @@ class MainWindow(object):
             file_type = 'Menu'
 
         if not os.path.isfile(file_path):
-            data = open(item.get_desktop_file_path()).read()
-            with codecs.open(file_path, 'w', 'utf8') as f:
-                f.write(data)
+            shutil.copy(item.get_desktop_file_path(), file_path)
 
         if file_path not in self.edit_pool:
             self.edit_pool.append(file_path)



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]