コード例 #1
0
 def generate(self, *args):
     # The idea is to just do this, but it seems to cause strange things to happen
     # internally. So we do it outside SWTBot instead.
     # self.widget.setFocus()
     page = self.widget.getViewReference().getPage()
     view = self.widget.getViewReference().getView(False)
     swtsimulator.runOnUIThread(page.activate, view)
コード例 #2
0
    def connectRecord(self, method):
        class RecordListener(IPartListener):
            def partActivated(listenerSelf, part):
                method(part, self)

        page = self.widget.getViewReference().getPage()
        swtsimulator.runOnUIThread(page.addPartListener, RecordListener())
コード例 #3
0
 def connectRecord(self, method):
     class RecordListener(IPartListener):
         def partClosed(listenerSelf, part): #@NoSelf
             if part is self.widget.getViewReference().getView(False):
                 storytext.guishared.catchAll(method, part, self)
     page = self.widget.getViewReference().getPage()
     swtsimulator.runOnUIThread(page.addPartListener, RecordListener())
コード例 #4
0
ファイル: nattablesimulator.py プロジェクト: gbtami/storytext
 def _generate(self, cell):
     row, col = cell
     button = self.mouseButton()
     if button == 3:
         desc = InstantMenuDescriber(self.widget)
         simulator.runOnUIThread(desc.addFilter)
     simulator.runOnUIThread(self.widget.clickOnCell, row, col, self.clickCount(), button)
コード例 #5
0
 def connectRecord(self, method):
     swtsimulator.CTabCloseEvent.connectRecord(self, method)
     class DisposeFilter(swt.widgets.Listener):
         def handleEvent(listenerSelf, e): #@NoSelf
             if isinstance(e.widget, swt.custom.CTabItem):
                 self.disposedTabs[e.widget] = e.widget.getText()
                 
     if not self.disposeFilter:
         RCPCTabCloseEvent.disposeFilter = DisposeFilter()
         swtsimulator.runOnUIThread(self.widget.widget.widget.getDisplay().addFilter, SWT.Dispose, self.disposeFilter)
コード例 #6
0
 def drag(self, editPart, toX, toY, keyModifiers=0):
     widgetCentreX, widgetCentreY = self.getCenter(editPart)
     displayCentre = swtsimulator.runOnUIThread(self.getFigureCanvas().toDisplayLocation, widgetCentreX, widgetCentreY)
     centreX = displayCentre.x
     centreY = displayCentre.y
     self.logger.debug("Dragging " + repr((centreX, centreY)) + " to " + repr((toX, toY)))
     self.getFigureCanvas().mouseDrag(centreX, centreY, toX, toY, keyModifiers)
コード例 #7
0
 def mouseDrag(self, fromX, fromY, toX, toY, keyModifiers=0):
     # These values, and the broad algorithm here, are taken from a draft implementation of DnD for SWTBot
     # The code is attached to the bug at https://bugs.eclipse.org/bugs/show_bug.cgi?id=285271
     # When it is integrated into SWTBot we should probably use it directly
     dragThreshold = 16
     dragDelay = 0.3
     self.eventPoster.moveMouseAndWait(fromX, fromY)
            
     self.eventPoster.checkAndPostKeyPressed(keyModifiers)
     initialDragTargetX = fromX + dragThreshold
     initialDragTargetY = fromY
     swtsimulator.runOnUIThread(storytext.guishared.catchAll, self.startDrag, initialDragTargetX, initialDragTargetY)
     time.sleep(dragDelay)
     self.moveDragged(initialDragTargetX, initialDragTargetY, toX, toY)
     swtsimulator.runOnUIThread(storytext.guishared.catchAll, self.eventPoster.postMouseUp)
     self.eventPoster.checkAndPostKeyReleased(keyModifiers)
コード例 #8
0
 def isPreferred(self):
     viewWidget = self.getViewWidget()
     if viewWidget in self.widgetViewIds:
         viewId = self.widgetViewIds.get(viewWidget)
         activeViewId = swtsimulator.runOnUIThread(self.getActiveViewId)
         return viewId == activeViewId
     else:
         return False
コード例 #9
0
ファイル: nattablesimulator.py プロジェクト: gbtami/storytext
 def updateTableInfo(self):
     simulator.runOnUIThread(self.setOffsets, self.widget)
     self.logger.debug("Updated NatTable indexer with row offset " + str(self.rowOffset) + " and column offset " + str(self.colOffset))
     simulator.TableIndexer.updateTableInfo(self)
コード例 #10
0
 def widgetDisposed(self):
     control = self.getControl()
     return control is None or swtsimulator.runOnUIThread(control.isDisposed)
コード例 #11
0
 def generate(self, *args):
     # The idea is to just do this, but it seems to cause strange things to happen
     #internally. So we do it outside SWTBot instead.
     #self.widget.setFocus()
     swtsimulator.runOnUIThread(self.clickMatchingTab, *args)
コード例 #12
0
 def connectRecord(self, method):
     swtsimulator.SelectEvent.connectRecord(self, method)
     widget = self.widget.widget.widget
     if hasattr(widget, "getAccelerator"):
         swtsimulator.runOnUIThread(self.connectRecordKeyBinding, widget, method)
コード例 #13
0
 def getViewWidget(self):
     widget = self.widget.widget
     if isinstance(widget, swt.widgets.MenuItem):
         return swtsimulator.runOnUIThread(util.getRootMenu, widget)
     else:
         return widget
コード例 #14
0
 def generate(self, *args):
     swtsimulator.runOnUIThread(self.widget.clickOnCenter)
コード例 #15
0
ファイル: nattablesimulator.py プロジェクト: gbtami/storytext
 def checkRowInViewport(self, row):
     clientAreaHeight = simulator.runOnUIThread(self.widget.getClientArea).height
     bounds = simulator.runOnUIThread(self.widget.getBoundsByPosition, 0, row)
     y = util.getInt(bounds.y) + util.getInt(bounds.height) / 2
     if y > clientAreaHeight:
         raise UseCaseScriptError, "Could not select row, it is outside the viewport"
コード例 #16
0
ファイル: nattablesimulator.py プロジェクト: gbtami/storytext
 def scrollToY(self, layer, offset):
     yCoord = layer.getOrigin().getY()
     simulator.runOnUIThread(layer.setOriginY, yCoord + offset)
コード例 #17
0
ファイル: simulator.py プロジェクト: gbtami/storytext
 def mouseMoveLeftClick(self, x, y, keyModifiers=0):
     displayLoc = swtsimulator.runOnUIThread(self.toDisplayLocation, x, y)
     self.eventPoster.moveClickAndReturn(displayLoc.x, displayLoc.y, keyModifiers)
コード例 #18
0
    def connectRecord(self, method):
        class RecordListener(ExpansionAdapter):
            def expansionStateChanged(listenerSelf, e): #@NoSelf
                storytext.guishared.catchAll(method, e, self)

        swtsimulator.runOnUIThread(self.widget.widget.widget.addExpansionListener, RecordListener())
コード例 #19
0
 def addActivePartListener(self, swtbotView):
     class RecordListener(IPartListener):
         def partActivated(listenerSelf, part):#@NoSelf
             self.monitorMenus(swtbotView)
     page = swtbotView.getViewReference().getPage()
     swtsimulator.runOnUIThread(page.addPartListener, RecordListener())
コード例 #20
0
 def monitorAllWidgets(self, *args, **kw):
     self.setWidgetAdapter()
     swtsimulator.runOnUIThread(self.cacheAndMonitorViews)
     swtsimulator.WidgetMonitor.monitorAllWidgets(self, *args, **kw)
コード例 #21
0
 def clickOnCenter(self, row, col, clickCount, button):
     bounds = self.widget.getBoundsByPosition(col, row)
     x = util.getInt(bounds.x) + util.getInt(bounds.width) / 2
     y = util.getInt(bounds.y) + util.getInt(bounds.height) / 2
     displayLoc = simulator.runOnUIThread(self.display.map, self.widget, None, x, y)
     self.eventPoster.moveClickAndReturn(displayLoc.x, displayLoc.y, count=clickCount, button=button)