代码拉取完成,页面将自动刷新
同步操作将从 小胖子/SafeTool-51testing 强制同步,此操作会覆盖自 Fork 仓库以来所做的任何修改,且无法恢复!!!
确定后同步将在后台操作,完成时将刷新页面,请耐心等待。
#!/usr/bin/env python
# -*- coding:utf-8 -*-
import wx
from wx import stc
class SqlMapWindow(wx.Frame):
def __init__(self,content):
self.width=800
self.height=500
wx.Frame.__init__(self,None,-1,u'SQLMAP',size=(self.width,self.height),style=wx.DEFAULT_FRAME_STYLE ^ wx.RESIZE_BORDER)
self.SetIcon(wx.Icon("./ico/pins.png",wx.BITMAP_TYPE_PNG))
tb=wx.Frame.CreateToolBar(self,style=wx.TB_FLAT|wx.TB_HORIZONTAL)
tb.AddTool(104,u"搜索",wx.Bitmap("./ico/searchs.png"))
tb.Realize()
self.panel=wx.Panel(self,-1)
self.text = stc.StyledTextCtrl(self.panel,-1,pos=(2,2),size=(self.width-10,self.height-50),style=wx.HSCROLL|wx.TE_MULTILINE)
#self.text=wx.TextCtrl(self.panel,-1,pos=(2,2),size=(self.width-10,self.height-50), style=wx.HSCROLL|wx.TE_MULTILINE)
self.text.SetBackgroundColour('black')
self.text.SetForegroundColour(wx.GREEN)
self.text.AppendText(content)
self.Bind(wx.EVT_MENU,self.OnToolSelected,id=104)
self.Bind(wx.EVT_FIND,self.OnFind)
self.Bind(wx.EVT_FIND_NEXT,self.OnFindNext)
self.Bind(wx.EVT_FIND_REPLACE,self.OnReplace)
self.Bind(wx.EVT_FIND_REPLACE_ALL,self.OnReplaceAll)
self.Bind(wx.EVT_FIND_CLOSE,self.OnFindClose)
self.search_forward = True
self.Show()
def OnToolSelected(self,e):
if e.GetId()==104:
self.Search(self.text.GetSelectedText())
def Search(self,toSearch):
data=wx.FindReplaceData()
data.SetFindString(toSearch)
dlg=wx.FindReplaceDialog(self,data,u"查找替换", wx.FR_REPLACEDIALOG)
dlg.Show()
def OnFind(self,event):
tosearch=event.GetFindString()
length=self.text.GetTextLength()
n=self.text.FindText(0,length,tosearch,event.GetFlags())
self.CenterPosInView(n)
sel_len = len(tosearch.encode("utf-8"))
self.text.SetSelection(n,n+sel_len)
def OnFindNext(self,event):
try:
tosearch = event.GetFindString()
anchor = self.text.GetAnchor()
length = self.text.GetTextLength()
if self.search_forward:
n=self.text.FindText(anchor+1,length,tosearch,event.GetFlags())
else:
n=self.text.FindText(anchor,0,tosearch,event.GetFlags())
if n != -1:
self.CenterPosInView(n)
sel_len=len(tosearch.encode("utf-8"))
self.text.SetSelection(n[0],n[0]+sel_len)
else:
if self.search_forward:
message=u"已经到达文件结束处,是否重新搜索?"
else:
message=u"已经到达文件开始处,是否重新搜索?"
result=dlg=wx.MessageBox(message,"提示信息",wx.YES_NO | wx.CANCEL | wx.ICON_EXCLAMATION,self)
if result==wx.YES:
self.search_forward=not self.search_forward
except Exception as ex:
print(ex)
def OnFindClose(self,event):
dlg=event.GetDialog()
dlg.Destroy()
def CenterLineInView(self,line):
nlines=self.text.LinesOnScreen()
first=self.text.GetFirstVisibleLine()
target=first+nlines/2
self.text.LineScroll(0,line-target)
def CenterPosInView(self,pos):
line=self.text.LineFromPosition(pos)
self.CenterLineInView(line)
self.text.GotoLine(line)
self.text.GotoPos(pos)
def OnReplace(self,event):
searchStr=event.GetFindString()
replaceStr=event.GetReplaceString()
startSel,endSel=self.text.GetSelection()
if startSel != endSel:
m=self.text.Replace(startSel,endSel,replaceStr)
self.OnFindNext(event)
else:
self.OnFind(event)
def OnReplaceAll(self,event):
pass
def openSqlmapWindow(content):
try:
app = wx.App()
SqlMapWindow(content)
app.MainLoop()
except Exception as e:
print(e)
app.ExitMainLoop()
#openSqlmapWindow("test")
此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。
如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。