-
-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
f31420c
commit 668009f
Showing
6 changed files
with
94 additions
and
64 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
# Copyright: Ajatt-Tools and contributors; https://github.com/Ajatt-Tools | ||
# License: GNU AGPL, version 3 or later; http://www.gnu.org/licenses/agpl.html | ||
import json | ||
import pathlib | ||
|
||
from cropro.config import CroProConfig | ||
|
||
|
||
class NoAnkiConfig(CroProConfig): | ||
""" | ||
Loads the default config without starting Anki. | ||
""" | ||
|
||
def _set_underlying_dicts(self) -> None: | ||
path = pathlib.Path(__file__).parent.parent.joinpath("cropro", "config.json") | ||
with open(path) as f: | ||
self._default_config = self._config = json.load(f) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
# Copyright: Ajatt-Tools and contributors; https://github.com/Ajatt-Tools | ||
# License: GNU AGPL, version 3 or later; http://www.gnu.org/licenses/agpl.html | ||
|
||
from cropro.remote_search import CroProWebSearchClient | ||
from run.mock_config import NoAnkiConfig | ||
|
||
|
||
def main(): | ||
client = CroProWebSearchClient(NoAnkiConfig()) | ||
result = client.search_notes({"keyword": "人事"}) | ||
for note in result: | ||
print(note) | ||
|
||
|
||
if __name__ == "__main__": | ||
main() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
# Copyright: Ajatt-Tools and contributors; https://github.com/Ajatt-Tools | ||
# License: GNU AGPL, version 3 or later; http://www.gnu.org/licenses/agpl.html | ||
|
||
from aqt.qt import * | ||
|
||
from cropro.widgets.remote_search_opts import RemoteSearchOptions | ||
|
||
|
||
class App(QWidget): | ||
def __init__(self, parent=None): | ||
super().__init__(parent) | ||
self.setWindowTitle("Test") | ||
self.search_opts = RemoteSearchOptions() | ||
self.initUI() | ||
|
||
def initUI(self): | ||
self.setMinimumSize(640, 480) | ||
self.setLayout(layout := QVBoxLayout()) | ||
layout.addWidget(self.search_opts) | ||
layout.addStretch(1) | ||
|
||
def hideEvent(self, event: QHideEvent): | ||
print(self.search_opts.category_combo.currentText()) | ||
print(self.search_opts.sort_combo.currentText()) | ||
print(self.search_opts.jlpt_level_combo.currentText()) | ||
print(self.search_opts.wanikani_level_combo.currentText()) | ||
|
||
|
||
def main(): | ||
app = QApplication(sys.argv) | ||
ex = App() | ||
ex.show() | ||
app.exec() | ||
sys.exit() | ||
|
||
|
||
if __name__ == "__main__": | ||
main() |