本文整理汇总了Python中viewer.Viewer.show方法的典型用法代码示例。如果您正苦于以下问题:Python Viewer.show方法的具体用法?Python Viewer.show怎么用?Python Viewer.show使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类viewer.Viewer
的用法示例。
在下文中一共展示了Viewer.show方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: test_execution_fail
# 需要导入模块: from viewer import Viewer [as 别名]
# 或者: from viewer.Viewer import show [as 别名]
def test_execution_fail(self, mock_call, mock_exists):
mock_call.side_effect = OSError("mock execution failed")
v = Viewer(self.prog)
deleted_pics = v.show(self.pics)
self.assertListEqual(deleted_pics, [])
self.assertTrue(self.viewer_err_logger.called)
示例2: __init__
# 需要导入模块: from viewer import Viewer [as 别名]
# 或者: from viewer.Viewer import show [as 别名]
class Controller:
def __init__(self, app):
self.app = app
self.view = Viewer(self)
self.model = Model()
self.view.show()
self.refreshGui()
def event(self, event):
print 'Handing event', event
try:
if event == 'PROJ_SELECT':
self._selectProject()
elif event == 'LIST_SELECTION_CHANGED':
self._listSelectionChanged()
self._refreshButtons()
elif event == 'ABOUT_MENU_ITEM':
self._aboutMenuItem()
elif event == 'QUIT_MENU_ITEM':
self._quitMenuItem()
#these events need a project to be specified already
else:
if not self.model.project:
return
if event == 'NEW_BUTTON':
self._newButton()
elif event == 'OPEN_BUTTON':
self._openButton()
elif event == 'CHECKIN_BUTTON':
self._checkinButton()
elif event == 'CHECKOUT_BUTTON':
self._checkoutButton()
elif event == 'DELETE_BUTTON':
self._deleteButton()
elif event == 'REFRESH_BUTTON':
self._refreshButton()
elif event == 'NEW_FILE_MENU_ITEM':
self._newFileMenuItem()
except UIAbortException, e:
pass
示例3: test_execution_error
# 需要导入模块: from viewer import Viewer [as 别名]
# 或者: from viewer.Viewer import show [as 别名]
def test_execution_error(self, mock_call, mock_exists):
mock_call.return_value = 5
v = Viewer(self.prog)
deleted_pics = v.show(self.pics)
self.assertListEqual(deleted_pics, [])
self.assertTrue(self.viewer_err_logger.called)
示例4: view_pics
# 需要导入模块: from viewer import Viewer [as 别名]
# 或者: from viewer.Viewer import show [as 别名]
def view_pics(rep, prog):
"""
Launch external viewer and keep track of pictures deleted within.
Arguments:
rep -- View pictures from this repository.
"""
if not prog:
prog = rep.config['viewer.prog']
v = Viewer(prog)
deleted_pics = v.show(rep.index.pics())
remove_pics(rep, [pic.filename for pic in deleted_pics])
示例5: test_execution_sucess
# 需要导入模块: from viewer import Viewer [as 别名]
# 或者: from viewer.Viewer import show [as 别名]
def test_execution_sucess(self, mock_call, mock_exists):
mock_call.return_value = 0
mock_exists.return_value = True
v = Viewer(self.prog)
deleted_pics = v.show(self.pics)
actual_call_args = mock_call.call_args_list[0][0][0]
expected_call_args = self.prog.split() + sorted(self.thumbs)
self.assertItemsEqual(expected_call_args, actual_call_args)
self.assertListEqual(deleted_pics, [])
self.assertFalse(self.viewer_err_logger.called)
示例6: __init__
# 需要导入模块: from viewer import Viewer [as 别名]
# 或者: from viewer.Viewer import show [as 别名]
def __init__(self,filename):
self.filename = filename
self.workfolder = os.path.split(filename)[0]
info = os.path.join(os.path.split(filename)[0],os.path.join(self.workfolder,"info.json"))
if not os.path.exists(info):
os.makedirs(info)
image = im.open(filename)
width,height = image.size
tileSize = 1024
levels = self.levels(width,height,tileSize)
tmpinfo = json.dumps({
"width": width,
"height" : height,
"levels": levels,
"tileSize":tileSize
})
file(info,'w').write(tmpinfo)
Diced = dice(filename)
theViewer = Viewer(self.workfolder+'/',5)
theViewer.show()
coords = [[260, 1185], [609, 1183], [971, 1185], [17418, 1260], [259, 1195], [267, 1544], [277, 1906], [192, 17650]]
grid = GridMaker(coords,filename,theViewer.Ti)
grid.showWell(20,20)
示例7: test_deleted_pics
# 需要导入模块: from viewer import Viewer [as 别名]
# 或者: from viewer.Viewer import show [as 别名]
def test_deleted_pics(self, mock_call, mock_exists):
mock_call.return_value = 0
deleted_thumbs = [pic.get_thumbnail_filenames()[0]
for pic in self.pics[4:15:2]]
def pic_exists(path):
if path in deleted_thumbs:
return False
else:
return True
mock_exists.side_effect = pic_exists
v = Viewer(self.prog)
deleted_pics = v.show(self.pics)
self.assertItemsEqual(deleted_pics, self.pics[4:15:2])
self.assertFalse(self.viewer_err_logger.called)