dev: 增加初步设置目标KPS

This commit is contained in:
Julian Freeman
2024-07-19 23:36:40 -04:00
parent 1fcb707472
commit b476da4697
6 changed files with 122 additions and 9 deletions

75
src/da_target_login.py Normal file
View File

@@ -0,0 +1,75 @@
# coding: utf8
from PySide6 import QtWidgets, QtCore, QtGui
class DaTargetLogin(QtWidgets.QDialog):
def __init__(self, parent=None):
super().__init__(parent)
self.setWindowTitle("目标文件")
self.vly_m = QtWidgets.QVBoxLayout()
self.setLayout(self.vly_m)
icon_ellipsis = QtGui.QIcon(":/asset/img/ellipsis.svg")
self.icon_eye = QtGui.QIcon(":/asset/img/eye.svg")
self.icon_eye_off = QtGui.QIcon(":/asset/img/eye-off.svg")
self.hly_path = QtWidgets.QHBoxLayout()
self.vly_m.addLayout(self.hly_path)
self.lb_path = QtWidgets.QLabel("路径:", self)
self.lne_path = QtWidgets.QLineEdit(self)
self.pbn_browse = QtWidgets.QPushButton(icon=icon_ellipsis, parent=self)
self.hly_path.addWidget(self.lb_path)
self.hly_path.addWidget(self.lne_path)
self.hly_path.addWidget(self.pbn_browse)
self.hly_password = QtWidgets.QHBoxLayout()
self.vly_m.addLayout(self.hly_password)
self.lb_password = QtWidgets.QLabel("密码:", self)
self.lne_password = QtWidgets.QLineEdit(self)
self.lne_password.setEchoMode(QtWidgets.QLineEdit.EchoMode.Password)
self.pbn_eye = QtWidgets.QPushButton(icon=self.icon_eye_off, parent=self)
self.hly_password.addWidget(self.lb_password)
self.hly_password.addWidget(self.lne_password)
self.hly_password.addWidget(self.pbn_eye)
self.hly_bottom = QtWidgets.QHBoxLayout()
self.vly_m.addLayout(self.hly_bottom)
self.pbn_ok = QtWidgets.QPushButton("确定", self)
self.pbn_cancel = QtWidgets.QPushButton("取消", self)
self.hly_bottom.addStretch(1)
self.hly_bottom.addWidget(self.pbn_ok)
self.hly_bottom.addWidget(self.pbn_cancel)
self.vly_m.addStretch(1)
self.pbn_browse.clicked.connect(self.on_pbn_browse_clicked)
self.pbn_eye.clicked.connect(self.on_pbn_eye_clicked)
self.pbn_ok.clicked.connect(self.on_pbn_ok_clicked)
self.pbn_cancel.clicked.connect(self.on_pbn_cancel_clicked)
def on_pbn_browse_clicked(self):
filename, _ = QtWidgets.QFileDialog.getOpenFileName(self, "选择", "../",
filter="KeePass 2 数据库 (*.kdbx);;所有文件 (*)")
if len(filename) == 0:
return
self.lne_path.setText(filename)
def on_pbn_eye_clicked(self):
if self.lne_password.echoMode() == QtWidgets.QLineEdit.EchoMode.Password:
self.lne_password.setEchoMode(QtWidgets.QLineEdit.EchoMode.Normal)
self.pbn_eye.setIcon(self.icon_eye)
else:
self.lne_password.setEchoMode(QtWidgets.QLineEdit.EchoMode.Password)
self.pbn_eye.setIcon(self.icon_eye_off)
def sizeHint(self):
return QtCore.QSize(540, 40)
def on_pbn_ok_clicked(self):
self.accept()
def on_pbn_cancel_clicked(self):
self.reject()

View File

@@ -1,6 +0,0 @@
<RCC>
<qresource prefix="/">
<file>asset/img/eye.svg</file>
<file>asset/img/eye-off.svg</file>
</qresource>
</RCC>

View File

@@ -5,6 +5,7 @@ from PySide6 import QtWidgets, QtCore, QtGui
from pykeepass import PyKeePass
from .da_entry_info import DaEntryInfo
from .da_target_login import DaTargetLogin
from .utils import HorizontalLine, get_filepath_uuids_map, accept_warning
from lib.Sqlite3Helper import Sqlite3Worker, Expression, Operand
from lib.db_columns_def import (
@@ -269,7 +270,8 @@ class PageQuery(QtWidgets.QWidget):
f"{total} 条标记的条目,已删除 {success} 条,无效 {invalid} 条。")
def on_pbn_set_target_clicked(self):
pass
da_target_login = DaTargetLogin(self)
da_target_login.exec()
class PushButtonWithData(QtWidgets.QPushButton):

View File

@@ -6,6 +6,34 @@
from PySide6 import QtCore
qt_resource_data = b"\
\x00\x00\x01\x9a\
<\
svg xmlns=\x22http:\
//www.w3.org/200\
0/svg\x22 class=\x22io\
nicon\x22 viewBox=\x22\
0 0 512 512\x22><ci\
rcle cx=\x22256\x22 cy\
=\x22256\x22 r=\x2232\x22 fi\
ll=\x22none\x22 stroke\
=\x22currentColor\x22 \
stroke-miterlimi\
t=\x2210\x22 stroke-wi\
dth=\x2232\x22/><circl\
e cx=\x22416\x22 cy=\x222\
56\x22 r=\x2232\x22 fill=\
\x22none\x22 stroke=\x22c\
urrentColor\x22 str\
oke-miterlimit=\x22\
10\x22 stroke-width\
=\x2232\x22/><circle c\
x=\x2296\x22 cy=\x22256\x22 \
r=\x2232\x22 fill=\x22non\
e\x22 stroke=\x22curre\
ntColor\x22 stroke-\
miterlimit=\x2210\x22 \
stroke-width=\x2232\
\x22/></svg>\
\x00\x00\x01\xf4\
<\
svg xmlns=\x22http:\
@@ -125,6 +153,10 @@ qt_resource_name = b"\
\x00\x00p7\
\x00i\
\x00m\x00g\
\x00\x0c\
\x07\x84:'\
\x00e\
\x00l\x00l\x00i\x00p\x00s\x00i\x00s\x00.\x00s\x00v\x00g\
\x00\x07\
\x0c\xf8Z\x07\
\x00e\
@@ -140,11 +172,13 @@ qt_resource_struct = b"\
\x00\x00\x00\x00\x00\x00\x00\x00\
\x00\x00\x00\x00\x00\x02\x00\x00\x00\x01\x00\x00\x00\x02\
\x00\x00\x00\x00\x00\x00\x00\x00\
\x00\x00\x00\x10\x00\x02\x00\x00\x00\x02\x00\x00\x00\x03\
\x00\x00\x00\x10\x00\x02\x00\x00\x00\x03\x00\x00\x00\x03\
\x00\x00\x00\x00\x00\x00\x00\x00\
\x00\x00\x000\x00\x00\x00\x00\x00\x01\x00\x00\x01\xf8\
\x00\x00\x00N\x00\x00\x00\x00\x00\x01\x00\x00\x03\x96\
\x00\x00\x01\x90\xc8\xe4\x89P\
\x00\x00\x00\x1c\x00\x00\x00\x00\x00\x01\x00\x00\x00\x00\
\x00\x00\x01\x90\xce\x13\xe7\xfd\
\x00\x00\x00:\x00\x00\x00\x00\x00\x01\x00\x00\x01\x9e\
\x00\x00\x01\x90\xc8\xe4\xa5\xc7\
"