Merge branch 'mizaki-hide_api_token' into develop
This commit is contained in:
commit
364d870fe0
102
comictaggerlib/graphics/eye.svg
Normal file
102
comictaggerlib/graphics/eye.svg
Normal file
@ -0,0 +1,102 @@
|
||||
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
|
||||
<!-- Generator: Adobe Illustrator 19.0.0, SVG Export Plug-In . SVG Version: 6.00 Build 0) -->
|
||||
|
||||
<svg
|
||||
version="1.1"
|
||||
id="Capa_1"
|
||||
x="0px"
|
||||
y="0px"
|
||||
viewBox="0 0 469.333 469.333"
|
||||
style="enable-background:new 0 0 469.333 469.333;"
|
||||
xml:space="preserve"
|
||||
sodipodi:docname="eye.svg"
|
||||
inkscape:version="1.2.2 (b0a8486541, 2022-12-01)"
|
||||
xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
|
||||
xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
|
||||
xmlns="http://www.w3.org/2000/svg"
|
||||
xmlns:svg="http://www.w3.org/2000/svg"><defs
|
||||
id="defs45" /><sodipodi:namedview
|
||||
id="namedview43"
|
||||
pagecolor="#505050"
|
||||
bordercolor="#eeeeee"
|
||||
borderopacity="1"
|
||||
inkscape:showpageshadow="0"
|
||||
inkscape:pageopacity="0"
|
||||
inkscape:pagecheckerboard="0"
|
||||
inkscape:deskcolor="#505050"
|
||||
showgrid="false"
|
||||
inkscape:zoom="2.1882117"
|
||||
inkscape:cx="234.6665"
|
||||
inkscape:cy="234.6665"
|
||||
inkscape:window-width="2560"
|
||||
inkscape:window-height="1361"
|
||||
inkscape:window-x="0"
|
||||
inkscape:window-y="42"
|
||||
inkscape:window-maximized="1"
|
||||
inkscape:current-layer="Capa_1" />
|
||||
<g
|
||||
id="g10"
|
||||
style="fill:#333333">
|
||||
<g
|
||||
id="g8"
|
||||
style="fill:#333333">
|
||||
<g
|
||||
id="g6"
|
||||
style="fill:#333333">
|
||||
<path
|
||||
d="M234.667,170.667c-35.307,0-64,28.693-64,64s28.693,64,64,64s64-28.693,64-64S269.973,170.667,234.667,170.667z"
|
||||
id="path2"
|
||||
style="fill:#333333" />
|
||||
<path
|
||||
d="M234.667,74.667C128,74.667,36.907,141.013,0,234.667c36.907,93.653,128,160,234.667,160 c106.773,0,197.76-66.347,234.667-160C432.427,141.013,341.44,74.667,234.667,74.667z M234.667,341.333 c-58.88,0-106.667-47.787-106.667-106.667S175.787,128,234.667,128s106.667,47.787,106.667,106.667 S293.547,341.333,234.667,341.333z"
|
||||
id="path4"
|
||||
style="fill:#333333" />
|
||||
</g>
|
||||
</g>
|
||||
</g>
|
||||
<g
|
||||
id="g12">
|
||||
</g>
|
||||
<g
|
||||
id="g14">
|
||||
</g>
|
||||
<g
|
||||
id="g16">
|
||||
</g>
|
||||
<g
|
||||
id="g18">
|
||||
</g>
|
||||
<g
|
||||
id="g20">
|
||||
</g>
|
||||
<g
|
||||
id="g22">
|
||||
</g>
|
||||
<g
|
||||
id="g24">
|
||||
</g>
|
||||
<g
|
||||
id="g26">
|
||||
</g>
|
||||
<g
|
||||
id="g28">
|
||||
</g>
|
||||
<g
|
||||
id="g30">
|
||||
</g>
|
||||
<g
|
||||
id="g32">
|
||||
</g>
|
||||
<g
|
||||
id="g34">
|
||||
</g>
|
||||
<g
|
||||
id="g36">
|
||||
</g>
|
||||
<g
|
||||
id="g38">
|
||||
</g>
|
||||
<g
|
||||
id="g40">
|
||||
</g>
|
||||
</svg>
|
After Width: | Height: | Size: 2.1 KiB |
106
comictaggerlib/graphics/hidden.svg
Normal file
106
comictaggerlib/graphics/hidden.svg
Normal file
@ -0,0 +1,106 @@
|
||||
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
|
||||
<!-- Generator: Adobe Illustrator 19.0.0, SVG Export Plug-In . SVG Version: 6.00 Build 0) -->
|
||||
|
||||
<svg
|
||||
version="1.1"
|
||||
id="Capa_1"
|
||||
x="0px"
|
||||
y="0px"
|
||||
viewBox="0 0 469.44 469.44"
|
||||
style="enable-background:new 0 0 469.44 469.44;"
|
||||
xml:space="preserve"
|
||||
sodipodi:docname="hidden.svg"
|
||||
inkscape:version="1.2.2 (b0a8486541, 2022-12-01)"
|
||||
xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
|
||||
xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
|
||||
xmlns="http://www.w3.org/2000/svg"
|
||||
xmlns:svg="http://www.w3.org/2000/svg"><defs
|
||||
id="defs47" /><sodipodi:namedview
|
||||
id="namedview45"
|
||||
pagecolor="#505050"
|
||||
bordercolor="#eeeeee"
|
||||
borderopacity="1"
|
||||
inkscape:showpageshadow="0"
|
||||
inkscape:pageopacity="0"
|
||||
inkscape:pagecheckerboard="0"
|
||||
inkscape:deskcolor="#505050"
|
||||
showgrid="false"
|
||||
inkscape:zoom="2.187713"
|
||||
inkscape:cx="234.72"
|
||||
inkscape:cy="234.72"
|
||||
inkscape:window-width="2560"
|
||||
inkscape:window-height="1361"
|
||||
inkscape:window-x="0"
|
||||
inkscape:window-y="42"
|
||||
inkscape:window-maximized="1"
|
||||
inkscape:current-layer="Capa_1" />
|
||||
<g
|
||||
id="g12"
|
||||
style="fill:#333333">
|
||||
<g
|
||||
id="g10"
|
||||
style="fill:#333333">
|
||||
<g
|
||||
id="g8"
|
||||
style="fill:#333333">
|
||||
<path
|
||||
d="M231.147,160.373l67.2,67.2l0.32-3.52c0-35.307-28.693-64-64-64L231.147,160.373z"
|
||||
id="path2"
|
||||
style="fill:#333333" />
|
||||
<path
|
||||
d="M234.667,117.387c58.88,0,106.667,47.787,106.667,106.667c0,13.76-2.773,26.88-7.573,38.933l62.4,62.4 c32.213-26.88,57.6-61.653,73.28-101.333c-37.013-93.653-128-160-234.773-160c-29.867,0-58.453,5.333-85.013,14.933l46.08,45.973 C207.787,120.267,220.907,117.387,234.667,117.387z"
|
||||
id="path4"
|
||||
style="fill:#333333" />
|
||||
<path
|
||||
d="M21.333,59.253l48.64,48.64l9.707,9.707C44.48,145.12,16.64,181.707,0,224.053c36.907,93.653,128,160,234.667,160 c33.067,0,64.64-6.4,93.547-18.027l9.067,9.067l62.187,62.293l27.2-27.093L48.533,32.053L21.333,59.253z M139.307,177.12 l32.96,32.96c-0.96,4.587-1.6,9.173-1.6,13.973c0,35.307,28.693,64,64,64c4.8,0,9.387-0.64,13.867-1.6l32.96,32.96 c-14.187,7.04-29.973,11.307-46.827,11.307C175.787,330.72,128,282.933,128,224.053C128,207.2,132.267,191.413,139.307,177.12z"
|
||||
id="path6"
|
||||
style="fill:#333333" />
|
||||
</g>
|
||||
</g>
|
||||
</g>
|
||||
<g
|
||||
id="g14">
|
||||
</g>
|
||||
<g
|
||||
id="g16">
|
||||
</g>
|
||||
<g
|
||||
id="g18">
|
||||
</g>
|
||||
<g
|
||||
id="g20">
|
||||
</g>
|
||||
<g
|
||||
id="g22">
|
||||
</g>
|
||||
<g
|
||||
id="g24">
|
||||
</g>
|
||||
<g
|
||||
id="g26">
|
||||
</g>
|
||||
<g
|
||||
id="g28">
|
||||
</g>
|
||||
<g
|
||||
id="g30">
|
||||
</g>
|
||||
<g
|
||||
id="g32">
|
||||
</g>
|
||||
<g
|
||||
id="g34">
|
||||
</g>
|
||||
<g
|
||||
id="g36">
|
||||
</g>
|
||||
<g
|
||||
id="g38">
|
||||
</g>
|
||||
<g
|
||||
id="g40">
|
||||
</g>
|
||||
<g
|
||||
id="g42">
|
||||
</g>
|
||||
</svg>
|
After Width: | Height: | Size: 2.6 KiB |
@ -6,8 +6,9 @@ from functools import partial
|
||||
from typing import Any, NamedTuple
|
||||
|
||||
import settngs
|
||||
from PyQt5 import QtCore, QtWidgets
|
||||
from PyQt5 import QtCore, QtGui, QtWidgets
|
||||
|
||||
from comictaggerlib.graphics import graphics_path
|
||||
from comictalker.comictalker import ComicTalker
|
||||
|
||||
logger = logging.getLogger(__name__)
|
||||
@ -18,6 +19,42 @@ class TalkerTab(NamedTuple):
|
||||
widgets: dict[str, QtWidgets.QWidget]
|
||||
|
||||
|
||||
class PasswordEdit(QtWidgets.QLineEdit):
|
||||
"""
|
||||
Password LineEdit with icons to show/hide password entries.
|
||||
Taken from https://github.com/pythonguis/python-qtwidgets/tree/master/qtwidgets
|
||||
Based on this example https://kushaldas.in/posts/creating-password-input-widget-in-pyqt.html by Kushal Das.
|
||||
"""
|
||||
|
||||
def __init__(self, show_visibility=True, *args, **kwargs):
|
||||
super().__init__(*args, **kwargs)
|
||||
|
||||
self.visibleIcon = QtGui.QIcon(str(graphics_path / "eye.svg"))
|
||||
self.hiddenIcon = QtGui.QIcon(str(graphics_path / "hidden.svg"))
|
||||
|
||||
self.setEchoMode(QtWidgets.QLineEdit.Password)
|
||||
|
||||
if show_visibility:
|
||||
# Add the password hide/shown toggle at the end of the edit box.
|
||||
self.togglepasswordAction = self.addAction(self.visibleIcon, QtWidgets.QLineEdit.TrailingPosition)
|
||||
self.togglepasswordAction.setToolTip("Show password")
|
||||
self.togglepasswordAction.triggered.connect(self.on_toggle_password_Action)
|
||||
|
||||
self.password_shown = False
|
||||
|
||||
def on_toggle_password_Action(self):
|
||||
if not self.password_shown:
|
||||
self.setEchoMode(QtWidgets.QLineEdit.Normal)
|
||||
self.password_shown = True
|
||||
self.togglepasswordAction.setIcon(self.hiddenIcon)
|
||||
self.togglepasswordAction.setToolTip("Hide password")
|
||||
else:
|
||||
self.setEchoMode(QtWidgets.QLineEdit.Password)
|
||||
self.password_shown = False
|
||||
self.togglepasswordAction.setIcon(self.visibleIcon)
|
||||
self.togglepasswordAction.setToolTip("Show password")
|
||||
|
||||
|
||||
def generate_api_widgets(
|
||||
talker_id: str,
|
||||
sources: dict[str, QtWidgets.QWidget],
|
||||
@ -51,7 +88,8 @@ def generate_api_widgets(
|
||||
if talker_key.file:
|
||||
# record the current row so we know where to add the button
|
||||
btn_test_row = layout.rowCount()
|
||||
le_key = generate_textbox(talker_key, layout)
|
||||
le_key = generate_password_textbox(talker_key, layout)
|
||||
|
||||
# To enable setting and getting
|
||||
sources["tabs"][talker_id].widgets[f"talker_{talker_id}_{talker_id}_key"] = le_key
|
||||
|
||||
@ -118,6 +156,18 @@ def generate_textbox(option: settngs.Setting, layout: QtWidgets.QGridLayout) ->
|
||||
return widget
|
||||
|
||||
|
||||
def generate_password_textbox(option: settngs.Setting, layout: QtWidgets.QGridLayout) -> QtWidgets.QLineEdit:
|
||||
row = layout.rowCount()
|
||||
lbl = QtWidgets.QLabel(option.display_name)
|
||||
lbl.setToolTip(option.help)
|
||||
layout.addWidget(lbl, row, 0)
|
||||
widget = PasswordEdit()
|
||||
widget.setToolTip(option.help)
|
||||
layout.addWidget(widget, row, 1)
|
||||
|
||||
return widget
|
||||
|
||||
|
||||
def settings_to_talker_form(sources: dict[str, QtWidgets.QWidget], config: settngs.Config[settngs.Namespace]) -> None:
|
||||
# Set the active talker via id in sources combo box
|
||||
sources["cbx_select_talker"].setCurrentIndex(sources["cbx_select_talker"].findData(config[0].talker_source))
|
||||
|
Loading…
Reference in New Issue
Block a user