Remove unused code and add short cut link
This commit is contained in:
parent
91c23d0a9d
commit
ff681f7054
44
labelImg.py
44
labelImg.py
@ -108,7 +108,6 @@ class MainWindow(QMainWindow, WindowMixin):
|
|||||||
|
|
||||||
self._no_selection_slot = False
|
self._no_selection_slot = False
|
||||||
self._beginner = True
|
self._beginner = True
|
||||||
self.screencast_viewer = self.get_available_screencast_viewer() # deprecated
|
|
||||||
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
|
||||||
@ -290,12 +289,9 @@ class MainWindow(QMainWindow, WindowMixin):
|
|||||||
'Ctrl+A', 'hide', get_str('showAllBoxDetail'),
|
'Ctrl+A', 'hide', get_str('showAllBoxDetail'),
|
||||||
enabled=False)
|
enabled=False)
|
||||||
|
|
||||||
# help = action(get_str('tutorial'), self.show_tutorial_dialog, None, 'help', get_str('tutorialDetail'))
|
|
||||||
# show_info = action(get_str('info'), self.show_info_dialog, None, 'help', get_str('info'))
|
|
||||||
help_default = action(get_str('tutorialDefault'), self.show_default_tutorial_dialog, None, 'help', get_str('tutorialDetail'))
|
help_default = action(get_str('tutorialDefault'), self.show_default_tutorial_dialog, None, 'help', get_str('tutorialDetail'))
|
||||||
help_chrome = action(get_str('tutorialChrome'), self.show_chrome_tutorial_dialog, None, 'help', get_str('tutorialDetail'))
|
|
||||||
show_info = action(get_str('info'), self.show_info_dialog, None, 'help', get_str('info'))
|
show_info = action(get_str('info'), self.show_info_dialog, None, 'help', get_str('info'))
|
||||||
# show_shortcuts = action(get_str('shortcut'), self.show_shortcuts_dialog, None, 'help', get_str('shortcut'))
|
show_shortcut = action(get_str('shortcut'), self.show_shortcuts_dialog, None, 'help', get_str('shortcut'))
|
||||||
|
|
||||||
zoom = QWidgetAction(self)
|
zoom = QWidgetAction(self)
|
||||||
zoom.setDefaultWidget(self.zoom_widget)
|
zoom.setDefaultWidget(self.zoom_widget)
|
||||||
@ -405,12 +401,7 @@ class MainWindow(QMainWindow, WindowMixin):
|
|||||||
|
|
||||||
add_actions(self.menus.file,
|
add_actions(self.menus.file,
|
||||||
(open, open_dir, change_save_dir, open_annotation, copy_prev_bounding, self.menus.recentFiles, save, save_format, save_as, close, reset_all, delete_image, quit))
|
(open, open_dir, change_save_dir, open_annotation, copy_prev_bounding, self.menus.recentFiles, save, save_format, save_as, close, reset_all, delete_image, quit))
|
||||||
if self.os_name == "Windows":
|
add_actions(self.menus.help, (help_default, show_info, show_shortcut))
|
||||||
# add_actions(self.menus.help, (help_default, help_chrome, show_info, show_shortcuts))
|
|
||||||
add_actions(self.menus.help, (help_default, help_chrome, show_info))
|
|
||||||
else:
|
|
||||||
# add_actions(self.menus.help, (help_default, show_info, show_shortcuts))
|
|
||||||
add_actions(self.menus.help, (help_default, show_info))
|
|
||||||
add_actions(self.menus.view, (
|
add_actions(self.menus.view, (
|
||||||
self.auto_saving,
|
self.auto_saving,
|
||||||
self.single_class_mode,
|
self.single_class_mode,
|
||||||
@ -647,23 +638,12 @@ class MainWindow(QMainWindow, WindowMixin):
|
|||||||
def advanced(self):
|
def advanced(self):
|
||||||
return not self.beginner()
|
return not self.beginner()
|
||||||
|
|
||||||
def get_available_screencast_viewer(self):
|
def show_tutorial_dialog(self, browser='default', link=None):
|
||||||
# deprecated, use webbrowser instead
|
if link is None:
|
||||||
# os_name = platform.system()
|
link = self.screencast
|
||||||
|
|
||||||
if self.os_name == 'Windows':
|
|
||||||
return ['C:\\Program Files (x86)\\Google\\Chrome\\Application\\chrome.exe']
|
|
||||||
elif self.os_name == 'Linux':
|
|
||||||
return ['xdg-open']
|
|
||||||
elif self.os_name == 'Darwin':
|
|
||||||
return ['open']
|
|
||||||
|
|
||||||
# Callbacks #
|
|
||||||
# def show_tutorial_dialog(self):
|
|
||||||
# subprocess.Popen(self.screencast_viewer + [self.screencast])
|
|
||||||
def show_tutorial_dialog(self, browser='default'):
|
|
||||||
if browser.lower() == 'default':
|
if browser.lower() == 'default':
|
||||||
wb.open(self.screencast, new=2)
|
wb.open(link, new=2)
|
||||||
elif browser.lower() == 'chrome' and self.os_name == 'Windows':
|
elif browser.lower() == 'chrome' and self.os_name == 'Windows':
|
||||||
if shutil.which(browser.lower()): # 'chrome' not in wb._browsers in windows
|
if shutil.which(browser.lower()): # 'chrome' not in wb._browsers in windows
|
||||||
wb.register('chrome', None, wb.BackgroundBrowser('chrome'))
|
wb.register('chrome', None, wb.BackgroundBrowser('chrome'))
|
||||||
@ -672,26 +652,22 @@ class MainWindow(QMainWindow, WindowMixin):
|
|||||||
if os.path.isfile(chrome_path):
|
if os.path.isfile(chrome_path):
|
||||||
wb.register('chrome', None, wb.BackgroundBrowser(chrome_path))
|
wb.register('chrome', None, wb.BackgroundBrowser(chrome_path))
|
||||||
try:
|
try:
|
||||||
wb.get('chrome').open(self.screencast, new=2)
|
wb.get('chrome').open(link, new=2)
|
||||||
except:
|
except:
|
||||||
wb.open(self.screencast, new=2)
|
wb.open(link, new=2)
|
||||||
elif browser.lower() in wb._browsers:
|
elif browser.lower() in wb._browsers:
|
||||||
wb.get(browser.lower()).open(self.screencast, new=2)
|
wb.get(browser.lower()).open(link, new=2)
|
||||||
|
|
||||||
def show_default_tutorial_dialog(self):
|
def show_default_tutorial_dialog(self):
|
||||||
self.show_tutorial_dialog(browser='default')
|
self.show_tutorial_dialog(browser='default')
|
||||||
|
|
||||||
def show_chrome_tutorial_dialog(self):
|
|
||||||
self.show_tutorial_dialog(browser='chrome')
|
|
||||||
|
|
||||||
def show_info_dialog(self):
|
def show_info_dialog(self):
|
||||||
from libs.__init__ import __version__
|
from libs.__init__ import __version__
|
||||||
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)
|
||||||
QMessageBox.information(self, u'Information', msg)
|
QMessageBox.information(self, u'Information', msg)
|
||||||
|
|
||||||
def show_shortcuts_dialog(self):
|
def show_shortcuts_dialog(self):
|
||||||
msg = u'To write....' # TODO
|
self.show_tutorial_dialog(browser='default', link='https://github.com/tzutalin/labelImg#Hotkeys')
|
||||||
QMessageBox.information(self, u'Shortcuts', msg)
|
|
||||||
|
|
||||||
def create_shape(self):
|
def create_shape(self):
|
||||||
assert self.beginner()
|
assert self.beginner()
|
||||||
|
|||||||
@ -12,7 +12,7 @@ verifyImgDetail=验证图像
|
|||||||
saveDetail=保存标签文件
|
saveDetail=保存标签文件
|
||||||
openFileDetail=打开图像文件
|
openFileDetail=打开图像文件
|
||||||
fitWidthDetail=调整宽度适应到窗口宽度
|
fitWidthDetail=调整宽度适应到窗口宽度
|
||||||
tutorialDefault=YouTube教学(Default Web Browser, Recommended)
|
tutorialDefault=YouTube教学
|
||||||
tutorialChrome=YouTube教学(Chrome)
|
tutorialChrome=YouTube教学(Chrome)
|
||||||
info=版本信息
|
info=版本信息
|
||||||
shortcut=快捷键
|
shortcut=快捷键
|
||||||
|
|||||||
@ -12,7 +12,7 @@ verifyImgDetail=驗證圖像
|
|||||||
saveDetail=將標籤存到
|
saveDetail=將標籤存到
|
||||||
openFileDetail=打開圖像
|
openFileDetail=打開圖像
|
||||||
fitWidthDetail=調整到窗口寬度
|
fitWidthDetail=調整到窗口寬度
|
||||||
tutorialDefault=YouTube教學(Default Web Browser, Recommended)
|
tutorialDefault=YouTube教學
|
||||||
tutorialChrome=YouTube教學(Chrome)
|
tutorialChrome=YouTube教學(Chrome)
|
||||||
info=版本信息
|
info=版本信息
|
||||||
shortcut=快捷鍵
|
shortcut=快捷鍵
|
||||||
|
|||||||
@ -3,7 +3,7 @@ openFileDetail=Open image or label file
|
|||||||
quit=Quit
|
quit=Quit
|
||||||
quitApp=Quit application
|
quitApp=Quit application
|
||||||
openDir=Open Dir
|
openDir=Open Dir
|
||||||
copyPrevBounding=Copy previous Bounding Boxes in the current image
|
copyPrevBounding=Copy previous Bounding Boxes in the current image
|
||||||
changeSavedAnnotationDir=Change default saved Annotation dir
|
changeSavedAnnotationDir=Change default saved Annotation dir
|
||||||
openAnnotation=Open Annotation
|
openAnnotation=Open Annotation
|
||||||
openAnnotationDetail=Open an annotation file
|
openAnnotationDetail=Open an annotation file
|
||||||
@ -33,7 +33,7 @@ delBox=Delete RectBox
|
|||||||
delBoxDetail=Remove the box
|
delBoxDetail=Remove the box
|
||||||
dupBox=Duplicate RectBox
|
dupBox=Duplicate RectBox
|
||||||
dupBoxDetail=Create a duplicate of the selected box
|
dupBoxDetail=Create a duplicate of the selected box
|
||||||
tutorialDefault=Tutorial(Default Web Browser, Recommended)
|
tutorialDefault=Tutorial
|
||||||
tutorialChrome=Tutorial(Chrome)
|
tutorialChrome=Tutorial(Chrome)
|
||||||
tutorialDetail=Show demo
|
tutorialDetail=Show demo
|
||||||
info=Information
|
info=Information
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user