Commits

Jure Žbontar committed b036b00 Merge

merge

  • Participants
  • Parent commits 65bf91e, ef90c73

Comments (0)

Files changed (2)

 from subprocess import Popen, PIPE
 import os
+import platform
 import glob
 import re
 import sqlite3
 
 import ref
 
+XDG_OPEN = ['xdg-open', 'open'][platform.system=="Darwin"]
 
 def search_documents(query):
     global last_select_cmd
 
 
 def str_document(doc):
-    return '  '.join(
-        (str(doc[h] or '')[:col_size[h]].ljust(col_size[h]) for h in headers))
+    return ('  '.join(
+        (str(doc[h] or '').decode('utf-8', 'replace')[:col_size[h]].ljust(col_size[h])
+         for h in headers))).encode('utf-8')
 
 
 def selected_document():
 
 def open_document():
     filename = selected_document()['filename']
-    Popen(['xdg-open', os.path.join(ref.DOCUMENT_DIR, filename)], stderr=PIPE, stdout=PIPE)
+    Popen([XDG_OPEN, os.path.join(ref.DOCUMENT_DIR, filename)], stderr=PIPE, stdout=PIPE)
 
 
 def add_document(fname):
 #! /bin/sh
-
+export PYTHONPATH=$PYTHONPATH:`dirname $0`
 vim -c "python from gui_vim import *"