Fix a bug that the application crashes when the browser opens.
This commit is contained in:
parent
ee31cad396
commit
bc71e12a9a
16
labelImg.py
16
labelImg.py
@ -1,7 +1,9 @@
|
|||||||
#!/usr/bin/env python
|
#!/usr/bin/env python
|
||||||
# -*- coding: utf-8 -*-
|
# -*- coding: utf-8 -*-
|
||||||
import codecs
|
import codecs
|
||||||
|
import distutils.spawn
|
||||||
import os.path
|
import os.path
|
||||||
|
import platform
|
||||||
import re
|
import re
|
||||||
import sys
|
import sys
|
||||||
import subprocess
|
import subprocess
|
||||||
@ -112,7 +114,7 @@ class MainWindow(QMainWindow, WindowMixin):
|
|||||||
|
|
||||||
self._noSelectionSlot = False
|
self._noSelectionSlot = False
|
||||||
self._beginner = True
|
self._beginner = True
|
||||||
self.screencastViewer = "firefox"
|
self.screencastViewer = self.getAvailableScreencastViewer()
|
||||||
self.screencast = "https://youtu.be/p0nR2YsCY_U"
|
self.screencast = "https://youtu.be/p0nR2YsCY_U"
|
||||||
|
|
||||||
# Load predefined classes to the list
|
# Load predefined classes to the list
|
||||||
@ -577,9 +579,19 @@ class MainWindow(QMainWindow, WindowMixin):
|
|||||||
def advanced(self):
|
def advanced(self):
|
||||||
return not self.beginner()
|
return not self.beginner()
|
||||||
|
|
||||||
|
def getAvailableScreencastViewer(self):
|
||||||
|
osName = platform.system()
|
||||||
|
|
||||||
|
if osName == 'Windows':
|
||||||
|
return ['C:\\Program Files\\Internet Explorer\\iexplore.exe']
|
||||||
|
elif osName == 'Linux':
|
||||||
|
return ['xdg-open']
|
||||||
|
elif osName == 'Darwin':
|
||||||
|
return ['open', '-a', 'Safari']
|
||||||
|
|
||||||
## Callbacks ##
|
## Callbacks ##
|
||||||
def showTutorialDialog(self):
|
def showTutorialDialog(self):
|
||||||
subprocess.Popen([self.screencastViewer, self.screencast])
|
subprocess.Popen(self.screencastViewer + [self.screencast])
|
||||||
|
|
||||||
def showInfoDialog(self):
|
def showInfoDialog(self):
|
||||||
msg = u'Name:{0} \nApp Version:{1} \n{2} '.format(__appname__, __version__, sys.version_info)
|
msg = u'Name:{0} \nApp Version:{1} \n{2} '.format(__appname__, __version__, sys.version_info)
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user