Skip to content

Commit

Permalink
fixes huggingface token in preferences
Browse files Browse the repository at this point in the history
  • Loading branch information
w4ffl35 committed Oct 18, 2023
1 parent 695c44f commit cf67451
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 19 deletions.
18 changes: 18 additions & 0 deletions src/airunner/widgets/api_token/api_token_widget.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
from PyQt6.QtWidgets import QLineEdit

from airunner.widgets.api_token.templates.api_token_ui import Ui_api_token
from airunner.widgets.base_widget import BaseWidget


class APITokenWidget(BaseWidget):
widget_class_ = Ui_api_token

def __init__(self, *args, **kwargs):
super().__init__(*args, **kwargs)
self.ui.hf_api_key.blockSignals(True)
self.ui.hf_api_key.setEchoMode(QLineEdit.EchoMode.Password)
self.ui.hf_api_key.setText(self.settings_manager.hf_api_key)
self.ui.hf_api_key.blockSignals(False)

def action_text_edited_api_key(self, value):
self.settings_manager.set_value("hf_api_key", value)
18 changes: 0 additions & 18 deletions src/airunner/windows/hf_api_key_widget.py

This file was deleted.

4 changes: 3 additions & 1 deletion src/airunner/windows/settings/airunner_settings.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
from PyQt6.QtCore import Qt, QSize
from PyQt6.QtGui import QStandardItemModel, QStandardItem, QBrush, QColor, QPainter
from PyQt6.QtWidgets import QStyledItemDelegate, QStyleOptionViewItem, QLabel, QWidget, QVBoxLayout, QPlainTextEdit

from airunner.widgets.api_token.api_token_widget import APITokenWidget
from airunner.widgets.export_preferences.export_preferences_widget import ExportPreferencesWidget
from airunner.widgets.grid_preferences.grid_preferences_widget import GridPreferencesWidget

Expand Down Expand Up @@ -236,7 +238,7 @@ def show_content(self, section, display_name, name, description):
"export_preferences": ExportPreferencesWidget,
"grid": GridPreferencesWidget,
"memory": MemoryPreferencesWidget,
# "hf_api_key": HFAPIKeyWidget,
"hf_api_key": APITokenWidget,
}
if name in widgets:
widget_object = widgets[name]()
Expand Down

0 comments on commit cf67451

Please sign in to comment.