forked from honeynet/apkinspector
-
Notifications
You must be signed in to change notification settings - Fork 0
/
FindDialog.py
80 lines (61 loc) · 2.27 KB
/
FindDialog.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
# -*- coding: utf-8 -*-
"""
Module implementing FindDialog.
"""
from PyQt4.QtGui import *
from PyQt4.QtCore import *
from PyQt4.QtGui import QDialog
from PyQt4.QtCore import pyqtSignature
from Ui_FindDialog import Ui_FindDialog
class FindDialog(QDialog, Ui_FindDialog):
"""
Class documentation goes here.
"""
findHistroyList = None
options = None
widget = None
def __init__(self, parent = None):
"""
Constructor
"""
QDialog.__init__(self, parent)
self.setupUi(self)
self.comboBox.setEditable(1)
self.findHistroyList = QStringList()
@pyqtSignature("bool")
def on_pushButton_find_clicked(self, checked):
"""
Slot documentation goes here.
"""
lineEditText = self.comboBox.lineEdit().text()
if lineEditText == QString(""):
return
else:
if self.comboBox.findText(lineEditText) == -1:
self.comboBox.insertItem(0,lineEditText)
self.findHistroyList.append(lineEditText)
else:
self.comboBox.removeItem(self.comboBox.findText(lineEditText))
self.comboBox.insertItem(0, lineEditText)
self.comboBox.setEditText(lineEditText)
self.options = QTextDocument.FindFlags(0)
# CaseSensitivity
if self.checkBox_1.isChecked():
self.options = self.options.__ior__(QTextDocument.FindCaseSensitively)
# Backward
if self.checkBox_3.isChecked():
self.options = self.options.__ior__(QTextDocument.FindBackward)
# WholeWords
if self.checkBox_2.isChecked():
self.options = self.options.__ior__(QTextDocument.FindWholeWords)
self.widget.find(lineEditText, self.options)
def setWidget(self, widget):
self.widget = widget
self.moveCursorToStart()
def moveCursorToStart(self):
cursor = self.widget.textCursor()
selectedText = cursor.selectedText()
cursor.movePosition(QTextCursor.Start, QTextCursor.MoveAnchor)
def setFindHistroyList(self, findHistroyList):
self.findHistroyList = findHistroyList
self.comboBox.insertItems(0, self.findHistroyList)