Use os.startfile on win32 to open files for issue155
This commit is contained in:
1 parent
abd7d5e330
commit
5215f9086d
2 files changed
+14
No files matched your search
@@ -132,6 +132,16 @@ def file_selection(title, filename='', parent=None,
|
||||
return filenames
|
||||
|
||||
def file_open(filename, type, parent, print_p=False):
|
||||
if os.name == 'nt':
|
||||
operation = 'open'
|
||||
if print_p:
|
||||
operation = 'print'
|
||||
try:
|
||||
os.startfile(os.path.normpath(filename), operation)
|
||||
except:
|
||||
# Try without operation, it is not supported on version < 2.5
|
||||
os.startfile(os.path.normpath(filename))
|
||||
return
|
||||
cmd = ''
|
||||
if type in CONFIG['client.actions']:
|
||||
if print_p:
|
||||
|
||||
@@ -599,6 +599,10 @@ class Main(object):
|
||||
self.glade.get_widget(signals[signal][2]).set_active(
|
||||
int(bool(CONFIG[signals[signal][1]])))
|
||||
|
||||
if os.name == 'nt':
|
||||
# Disable actions, on win32 we use os.startfile
|
||||
self.glade.get_widget('actions').set_sensitive(False)
|
||||
|
||||
# Adding a timer the check to requests
|
||||
gobject.timeout_add(5 * 60 * 1000, self.request_set)
|
||||
_MAIN.append(self)
|
||||
|
||||
Reference in new issue
Block a user