|
19 | 19 |
|
20 | 20 | ''' |
21 | 21 |
|
22 | | -__version__ = '9.1.0' |
| 22 | +__version__ = '9.2.0' |
23 | 23 |
|
24 | 24 | import sys |
25 | 25 | import threading |
@@ -582,21 +582,7 @@ def onKeyPressed(self, event): |
582 | 582 | self.showHelp() |
583 | 583 | return |
584 | 584 | elif keysym == 'F5': |
585 | | - self.showVignette() |
586 | | - display = copy.copy(self.device.display) |
587 | | - self.device.initDisplayProperties() |
588 | | - changed = False |
589 | | - for prop in display: |
590 | | - if display[prop] != self.device.display[prop]: |
591 | | - changed = True |
592 | | - break |
593 | | - if changed: |
594 | | - self.window.geometry('%dx%d' % (self.device.display['width']*self.scale, self.device.display['height']*self.scale+int(self.statusBar.winfo_height()))) |
595 | | - self.deleteVignette() |
596 | | - self.canvas.destroy() |
597 | | - self.canvas = None |
598 | | - self.window.update_idletasks() |
599 | | - self.takeScreenshotAndShowItOnWindow() |
| 585 | + self.refresh() |
600 | 586 | return |
601 | 587 | elif keysym == 'Alt_L': |
602 | 588 | return |
@@ -632,6 +618,23 @@ def onKeyPressed(self, event): |
632 | 618 | self.takeScreenshotAndShowItOnWindow() |
633 | 619 |
|
634 | 620 |
|
| 621 | + def refresh(self): |
| 622 | + self.showVignette() |
| 623 | + display = copy.copy(self.device.display) |
| 624 | + self.device.initDisplayProperties() |
| 625 | + changed = False |
| 626 | + for prop in display: |
| 627 | + if display[prop] != self.device.display[prop]: |
| 628 | + changed = True |
| 629 | + break |
| 630 | + if changed: |
| 631 | + self.window.geometry('%dx%d' % (self.device.display['width']*self.scale, self.device.display['height']*self.scale+int(self.statusBar.winfo_height()))) |
| 632 | + self.deleteVignette() |
| 633 | + self.canvas.destroy() |
| 634 | + self.canvas = None |
| 635 | + self.window.update_idletasks() |
| 636 | + self.takeScreenshotAndShowItOnWindow() |
| 637 | + |
635 | 638 | def cancelOperation(self): |
636 | 639 | ''' |
637 | 640 | Cancels the ongoing operation if any. |
@@ -1184,22 +1187,26 @@ def __init__(self, culebron, view): |
1184 | 1187 | #super(ContextMenu, self).__init__(culebron.window, tearoff=False) |
1185 | 1188 | Tkinter.Menu.__init__(self, culebron.window, tearoff=False) |
1186 | 1189 | self.view = view |
1187 | | - items = [ |
1188 | | - ContextMenu.Command('Drag dialog', 0, 'Ctrl+D', '<Control-D>', culebron.showDragDialog), |
1189 | | - ContextMenu.Command('Take snapshot and save to file', 26, 'Ctrl+F', '<Control-F>', culebron.saveSnapshot), |
1190 | | - ContextMenu.Command('Control Panel', 0, 'Ctrl+K', '<Control-K>', culebron.showControlPanel), |
1191 | | - ContextMenu.Command('Long touch point using PX', 0, 'Ctrl+L', '<Control-L>', culebron.toggleLongTouchPoint), |
1192 | | - ContextMenu.Command('Touch using DIP', 13, 'Ctrl+I', '<Control-I>', culebron.toggleTouchPointDip), |
1193 | | - ContextMenu.Command('Touch using PX', 12, 'Ctrl+P', '<Control-P>', culebron.toggleTouchPointPx), |
1194 | | - ContextMenu.Command('Generates a Sleep() on output script', 12, 'Ctrl+S', '<Control-S>', culebron.showSleepDialog), |
1195 | | - ContextMenu.Command('Toggle generating Test Condition', 18, 'Ctrl+T', '<Control-T>', culebron.toggleGenerateTestCondition), |
1196 | | - ContextMenu.Command('Touch Zones', 6, 'Ctrl+Z', '<Control-Z>', culebron.toggleTargetZones), |
1197 | | - ContextMenu.Separator(), |
1198 | | - ContextMenu.Command('Quit', 0, 'Ctrl+Q', '<Control-Q>', culebron.quit), |
1199 | | - ] |
| 1190 | + items = [] |
| 1191 | + |
1200 | 1192 | if self.view: |
1201 | 1193 | _saveViewSnapshotForSelectedView = lambda: culebron.saveViewSnapshot(self.view) |
1202 | | - items.insert(2, ContextMenu.Command('Take view snapshot and save to file', 5, 'Ctrl+W', '<Control-W>', _saveViewSnapshotForSelectedView)) |
| 1194 | + items.append(ContextMenu.Command('Take view snapshot and save to file', 5, 'Ctrl+W', '<Control-W>', _saveViewSnapshotForSelectedView)) |
| 1195 | + items.append(ContextMenu.Separator()) |
| 1196 | + |
| 1197 | + items.append(ContextMenu.Command('Drag dialog', 0, 'Ctrl+D', '<Control-D>', culebron.showDragDialog)) |
| 1198 | + items.append(ContextMenu.Command('Take snapshot and save to file', 26, 'Ctrl+F', '<Control-F>', culebron.saveSnapshot)) |
| 1199 | + items.append(ContextMenu.Command('Control Panel', 0, 'Ctrl+K', '<Control-K>', culebron.showControlPanel)) |
| 1200 | + items.append(ContextMenu.Command('Long touch point using PX', 0, 'Ctrl+L', '<Control-L>', culebron.toggleLongTouchPoint)) |
| 1201 | + items.append(ContextMenu.Command('Touch using DIP', 13, 'Ctrl+I', '<Control-I>', culebron.toggleTouchPointDip)) |
| 1202 | + items.append(ContextMenu.Command('Touch using PX', 12, 'Ctrl+P', '<Control-P>', culebron.toggleTouchPointPx)) |
| 1203 | + items.append(ContextMenu.Command('Generates a Sleep() on output script', 12, 'Ctrl+S', '<Control-S>', culebron.showSleepDialog)) |
| 1204 | + items.append(ContextMenu.Command('Toggle generating Test Condition', 18, 'Ctrl+T', '<Control-T>', culebron.toggleGenerateTestCondition)) |
| 1205 | + items.append(ContextMenu.Command('Touch Zones', 6, 'Ctrl+Z', '<Control-Z>', culebron.toggleTargetZones)) |
| 1206 | + items.append(ContextMenu.Command('Refresh', 0, 'F5', '<F5>', culebron.refresh)) |
| 1207 | + items.append(ContextMenu.Separator()) |
| 1208 | + items.append(ContextMenu.Command('Quit', 0, 'Ctrl+Q', '<Control-Q>', culebron.quit)) |
| 1209 | + |
1203 | 1210 | for item in items: |
1204 | 1211 | self.addItem(item) |
1205 | 1212 |
|
|
0 commit comments