예제 #1
0
    def OnListBoxItem(self, evt):
        "The user selected an event in the listbox"
        index = evt.m_itemIndex
        curtime, curdesc, curclass, curdata = self.packets[index]
        self.errorinfo = ""
        self.hex.SetData("")
        self.hex.highlightrange(-1, -1)
        if len(curdata):
            self.hex.SetData(curdata)
            # self.hex.ShowPosition(self.hex.XYToPosition(0,0))
        else:
            self.hex.SetData(curdesc)
            # self.hex.ShowPosition(self.hex.XYToPosition(0,0))

        self.tree.DeleteAllItems()
        if len(curclass):
            b = prototypes.buffer(curdata)
            try:
                klass = common.getfullname(curclass)
            except Exception, e:
                self.errorme("Finding class", e)
                wx.TipWindow(self.tree, self.errorinfo)
                return
            try:
                obj = klass()
            except Exception, e:
                self.errorme("Instantiating object", e)
                wx.TipWindow(self.tree, self.errorinfo)
                return
예제 #2
0
 def onAddAccount(self, event):
     # Grab the account name and add it.
     accountName = self.editCtrl.Value
     try:
         self.Model.CreateAccount(accountName)
     except bankexceptions.AccountAlreadyExistsException:
         wx.TipWindow(self,
                      _("Sorry, an account by that name already exists.")
                      )  #, maxLength=200)
     except bankexceptions.BlankAccountNameException:
         wx.TipWindow(self, _("Account names cannot be blank."))
예제 #3
0
 def OnShowDoc(self, event, flag):
     if flag == 1:
         wx.TipWindow(self, "Full path to a directory containing files " \
                            "for a single FSL model. All models must " \
                            "include .con, .mat, and .grp files. Models " \
                            "in which an F-Test is specified must also " \
                            "include a .fts file.", 500)
     elif flag == 2:
         wx.TipWindow(self, "Full path to a CPAC FSL model configuration "\
                            "file to be used.\n\nFor more information, " \
                            "please refer to the user guide.", 500)
예제 #4
0
 def OnShowDoc(self, event, flag):
     if flag == 1:
         wx.TipWindow(
             self,
             "Full path to a directory containing files for a single FSL model. All models must include .con, .mat, and .grp files. Models in which an F-Test is specified must also include a .fts file.",
             500)
     elif flag == 2:
         #wx.TipWindow(self, "Full path to a subject list to be used with this model.\n\nThis should be a text file with one subject per line.", 500)
         wx.TipWindow(
             self,
             "Full path to a CPAC FSL model configuration file to be used.\n\nFor more information, please refer to the user guide.",
             500)
예제 #5
0
 def test_tipwinCtor(self):
     w = wx.TipWindow(self.frame, "This is a tip message")
     w.SetBoundingRect(self.frame.GetRect())
     self.waitFor(100)
     w.Show()
     self.waitFor(100)
     w.Close()
예제 #6
0
 def tooltipShow(self):
     """ Show the tooltip, showing a text sample for text passages,
     and some image size info for image passages."""
     if self.tooltipplace is not None and self.trackinghover and not self.draggingWidgets:
         m = wx.GetMousePosition()
         p = self.tooltipplace.passage
         length = len(p.text)
         if p.isImage():
             mimeType = "unknown"
             mimeTypeRE = re.search(r"data:image/([^;]*);", p.text)
             if mimeTypeRE:
                 mimeType = mimeTypeRE.group(1)
             # Including the data URI prefix in the byte count, just because.
             text = "Image type: " + mimeType + "\nSize: " + str(
                 len(p.text) / 1024) + " KB"
         else:
             text = "Title: " + p.title + "\n" + (
                 "Tags: " + ", ".join(p.tags) + '\n\n' if p.tags else "")
             text += p.text[:840]
             if length >= 840:
                 text += "..."
         # Don't show a tooltip for a 0-length passage
         if length > 0:
             # self.tooltipobj = wx.TipWindow(self, text, min(240, max(160,length/2)), wx.Rect(m[0],m[1],1,1))
             self.tooltipobj = wx.TipWindow(self, text,
                                            min(240, max(160, length / 2)))
예제 #7
0
 def onClickItem(self, event):
     if event.GetEventObject().GetForegroundColour(
     ) != self.__params["disenableColor"]:
         objId = event.GetEventObject().GetId()
         if objId in self.itemKeyDict:
             curIdx = self.getCurIndex()
             if self.itemKeyDict[objId] == "First":
                 self.setCurIndex(0)
             elif self.itemKeyDict[objId] == "Previous":
                 if curIdx > 1:
                     self.setCurIndex(curIdx - 1)
             elif self.itemKeyDict[objId] == "Next":
                 if curIdx < self.getTotalCount():
                     self.setCurIndex(curIdx + 1)
             elif self.itemKeyDict[objId] == "Last":
                 self.setCurIndex(self.getTotalCount())
             elif self.itemKeyDict[objId] == "Skip":
                 val = self.input.GetValue()
                 try:
                     idx = int(val)
                     if idx > 0 and idx < self.getTotalCount():
                         self.setCurIndex(idx)
                 except Exception:
                     wx.TipWindow(self, "输入不允许包含非数字!")
             if hasattr(self, "on" + self.itemKeyDict[objId]):
                 getattr(self, "on" + self.itemKeyDict[objId])(self, event)
 def OnShowDoc(self, event, flag):
     if flag == 1:
         wx.TipWindow(
             self, "Full path to a directory containing files "
             "for a single FSL model. All models must "
             "include .con, .mat, and .grp files. Models "
             "in which an F-Test is specified must also "
             "include a .fts file.", 500)
     elif flag == 2:
         wx.TipWindow(
             self, "Full path to a CPAC FSL FEAT group analysis "
             "model configuration YAML file. You can "
             "either create one using one of the presets, "
             "or by using the model builder to build one "
             "from scratch.\n\nFor more information, "
             "please refer to the user guide.", 500)
예제 #9
0
 def show_tooltip(self, evt):
     abs_x, abs_y = self.ScreenPosition
     rect = wx.Rect(abs_x + self.b_x1, abs_y + self.b_y1,
                    self.b_x2 - self.b_x1 + 1, self.b_y2 - self.b_y1 + 1)
     tip = wx.TipWindow(self, 'Show calendar\n(F4 or space)')
     # tip will be destroyed when mouse leaves this rect
     tip.SetBoundingRect(rect)
예제 #10
0
    def OnLeftDown(self, event=None):
        print("left clicked")
        self.tooltip = wx.TipWindow(self, text="A tip Window")

        self.tooltip.SetBoundingRect(
            wx.Rect(event.GetX(), event.GetY(), 20, 20))
        self.tooltip.Show()
예제 #11
0
    def onRenameAccount(self, event):
        account = self.accountObjects[self.currentIndex]
        oldName = account.Name
        newName = self.editCtrl.Value

        if oldName == newName:
            # If there was no change, don't do anything.
            self.onHideEditCtrl()
            return

        try:
            account.Name = newName
        except bankexceptions.AccountAlreadyExistsException:
            wx.TipWindow(self,
                         _("Sorry, an account by that name already exists.")
                         )  #, maxLength=200)
        except bankexceptions.BlankAccountNameException:
            wx.TipWindow(self, _("Account names cannot be blank."))
예제 #12
0
    def OnShowDoc(self, evt):
        doc = self.help[evt.GetEventObject()]

        # trim the whitespace from each line
        lines = []
        for line in doc.split('\n'):
            lines.append(line.strip())
        doc = '\n'.join(lines)
        wx.TipWindow(self, doc, 500)
예제 #13
0
 def onMouseStillOverBmp(self, rowid):
     if self.mouseoverbmp == rowid:
         obj = self.rowdata[rowid]
         ttdata = string.join([
             u'Author: %s' % obj.Author(),
             u'Title: %s' % obj.Title(),
             u'Date: %s' % obj.ReferDate().ctime(),
             u'File type: %s' % obj.FileData_FileType,
             u'File size: %dkb' % (obj.FileData_Size / 1000),
         ], u'\n')
         self.tw = wx.TipWindow(self, ttdata, maxLength=300)
예제 #14
0
파일: ctrlbox.py 프로젝트: Angell1/mycura
 def OnTipTimer(self, evt):
     """Show the tooltip for the current SegmentButton"""
     pos = self.ScreenToClient(wx.GetMousePosition())
     where, index = self.HitTest(pos)
     if index != -1:
         button = self._buttons[index]
         if button.Label:
             rect = button.Rect
             x,y = self.ClientToScreenXY(rect.x, rect.y)
             rect.x = x
             rect.y = y
             wx.TipWindow(self, button.Label, rectBound=rect) # Transient
예제 #15
0
    def __init__(self, parent, select_gates=[], **kwargs):
        wx.Dialog.__init__(self,
                           parent,
                           title='Create LoadImages Table',
                           size=(300, 200),
                           **kwargs)
        self.Sizer = wx.BoxSizer(wx.VERTICAL)
        text = wx.StaticText(self, -1, 'Select gates to apply:')
        self.Sizer.Add(text, 0, wx.TOP | wx.CENTER, 10)
        for g in select_gates:
            for c in p.gates[g].get_columns():
                assert p.image_table == c.table, 'Can only create LoadImages table from per-image gates.'
        gates = [
            g for g in p.gates_ordered if all(
                [p.image_table == c.table for c in p.gates[g].get_columns()])
        ]
        self.gate_choices = wx.CheckListBox(self, choices=gates)
        self.gate_choices.SetCheckedStrings(select_gates)
        self.Sizer.Add(self.gate_choices, 1, wx.EXPAND | wx.ALL | wx.CENTER,
                       10)

        self.gate_columns_check = wx.CheckBox(self, -1, 'Show gates columns?')
        self.Sizer.Add(self.gate_columns_check, 0, wx.BOTTOM | wx.CENTER, 10)

        btnsizer = wx.StdDialogButtonSizer()

        helpbtn = wx.Button(self, wx.ID_HELP)
        helpbtn.Bind(
            wx.EVT_BUTTON, lambda (evt): wx.TipWindow(
                self,
                'This dialog a list of per_image gates which you may apply'
                'to your per_image data to generate a filtered list of images for'
                'input to CellProfiler LoadImages.\n\n'
                'Select "Show gates as columns" if you would like to output all'
                'image rows with a gate column added for each selected gate. Rows '
                'within the gate will be set to 1 and all others will be 0.\n\n'
                'Leave "Show gates as columns" unchecked if you only want to output'
                'the image rows that are contained by the selected gates.'))
        btnsizer.AddButton(helpbtn)

        btn = wx.Button(self, wx.ID_OK, 'Show Table')
        btnsizer.AddButton(btn)

        btn = wx.Button(self, wx.ID_CANCEL)
        btnsizer.AddButton(btn)

        btnsizer.Realize()
        self.Sizer.Add(btnsizer, 0, wx.EXPAND | wx.BOTTOM, 10)
예제 #16
0
    def handleHover(self, event):
        if self.trackinghover and not self.draggingWidgets and not self.draggingMarquee:
            for widget in self.widgets:
                if widget.getPixelRect().Contains(event.GetPosition()):
                    if self.tooltipcounter == 0 or widget.passage.title != self.tooltipplace:
                        self.tooltipcounter = time.time() + 0.500
                        self.tooltipplace = widget.passage.title
                        if self.tooltipobj != None:
                            if isinstance(self.tooltipobj, wx.TipWindow):
                                self.tooltipobj.Close()
                            self.tooltipobj = None
                    elif time.time(
                    ) >= self.tooltipcounter and self.tooltipobj == None:
                        self.tooltipobj = wx.TipWindow(self, self.tooltipplace,
                                                       80,
                                                       wx.Rect(0, 0, 300, 200))
                    return

        self.tooltipcounter = 0
        self.tooltipplace = None
        if self.tooltipobj != None:
            if isinstance(self.tooltipobj, wx.TipWindow):
                self.tooltipobj.Close()
            self.tooltipobj = None
예제 #17
0
 def OnShowDoc(self, event):
     wx.TipWindow(self, "Path to output directory of the pipeline you "
                        "wish to run group-level analysis for.", 500)
예제 #18
0
 def onHelp(self, event):
     comment = "Check the box only if the scans have different slice timing infomation."
     wx.TipWindow(self, comment, 500)
예제 #19
0
 def onTimerToShowTips(self, event=None):
     if self.isPointInRect(wx.GetMousePosition()):  # 判断鼠标位置是否在节点内
         self.tipWindow = wx.TipWindow(self, self.tips)
         self.timeToHideTips()
예제 #20
0
파일: 9.12.py 프로젝트: 642237240/python
import wx

if __name__ == '__main__':
    app = wx.App()
    provider = wx.TipWindow('tips.txt', 0)
    
예제 #21
0
	def showDisableTipWin(self, obj, tips, _retTuple = None):
		if not self.__isAiTurn:
			wx.TipWindow(obj, tips);
예제 #22
0
 def OnShowDoc(self, event):
     wx.TipWindow(self, "Path to file containing derivative path. \n\nThis should be a text file with one path to derivative per line.", 500)
예제 #23
0
	def showDisableTipWin(self, tips):
		wx.TipWindow(self, tips);
예제 #24
0
            try:
                obj.readfrombuffer(b, autolog=False)
            except Exception, e:
                self.errorme("Reading from buffer", e)
                # no return, we persevere

            root = self.tree.AddRoot(curclass)
            try:
                self.tree.SetPyData(root, obj.packetspan())
            except:
                self.errorme("Object did not construct correctly")
                # no return, we persevere
            self.addtreeitems(obj, root)
        if len(self.errorinfo):
            wx.TipWindow(self.tree, self.errorinfo)

    def addtreeitems(self, obj, parent):
        "Add fields from obj to parent node"
        try:
            for name, field, desc in obj.containerelements():
                if desc is None:
                    desc = ""
                else:
                    desc = "      - " + desc
                iscontainer = False
                try:
                    iscontainer = field.iscontainer()
                except:
                    pass
                # Add ourselves
예제 #25
0
 def OnLeft(self, event=None):
     print("left clicked")
     self.tooltip = wx.TipWindow(self, text="A tip Window")
예제 #26
0
 def OnShowDoc(self, event, comment):
     wx.TipWindow(self.parent, comment, 500)
예제 #27
0
 def onTransferTip(self, event):
     tipStr = _("If this box is checked when adding a transaction, you will be prompted for the account to use as the source of the transfer.")+"\n\n"+\
              _("For example, checking this box and entering a transaction of $50 into this account will also subtract $50 from the account that you choose as the source.")
     wx.TipWindow(self, tipStr, maxLength=200)
예제 #28
0
 def OnCtxHelp2(self, event):
     self.log.write("OnCtxHelp2: %s\n" % event)
     tip = wx.TipWindow(self, "This is a wx.TipWindow")