-
Notifications
You must be signed in to change notification settings - Fork 0
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
Showing
40 changed files
with
1,853 additions
and
731 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
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 |
---|---|---|
|
@@ -68,5 +68,6 @@ | |
RECEIVED=0 | ||
ARCHIVED=1 | ||
|
||
#その他 | ||
SET_FILTER = wx.ID_OK+2 | ||
#ログインID種別設定 | ||
LOGIN_PEING=0 | ||
LOGIN_TWITTER=1 |
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 |
---|---|---|
@@ -1,8 +1,10 @@ | ||
# NPC list filter | ||
# Copyright (C) 2021 yamahubuki <[email protected]> | ||
|
||
import constants | ||
import re | ||
|
||
import constants | ||
import globalVars | ||
|
||
enableFilters=[] | ||
|
||
|
@@ -19,6 +21,13 @@ def enable(self,status): | |
else: | ||
enableFilters = [x for x in enableFilters if type(x)!= type(self)] | ||
|
||
#現在有効になっていればTrue | ||
def isEnable(self): | ||
for f in getFilterList(): | ||
if type(self)==type(f): | ||
return True | ||
return False | ||
|
||
#フィルタが有効な場合にのみ呼び出される | ||
#与えられたanswerを画面に表示すべきならTrue | ||
def test(self,**args): | ||
|
@@ -51,6 +60,51 @@ def test(self,**args): | |
else: | ||
return True | ||
|
||
#検索条件に一致する回答のみを表示 | ||
class SearchFilter(FilterBase): | ||
def __init__(self,keyword="",type=0,isRe=False): | ||
self.keyword = keyword | ||
self.type = type | ||
self.isRe = isRe | ||
if isRe: | ||
self.ptn = re.compile(keyword) | ||
|
||
def test(self,**args): | ||
if self.isRe: | ||
if self.type == 0 and not self.ptn.search(args["q"]): | ||
return False | ||
elif self.type == 1 and not self.ptn.search(args["a"]): | ||
return False | ||
elif self.type == 2 and not (self.ptn.search(args["a"])!=None or self.ptn.search(args["q"])!=None): | ||
return False | ||
else: | ||
if self.type == 0 and not self.keyword in args["q"]: | ||
return False | ||
elif self.type == 1 and not self.keyword in args["a"]: | ||
return False | ||
elif self.type == 2 and not (self.keyword in args["q"] or self.keyword in args["a"]): | ||
return False | ||
return True | ||
|
||
|
||
def getFilterList(): | ||
return enableFilters | ||
|
||
# 適用状況を設定から読込 | ||
def loadStatus(): | ||
if globalVars.app.config.getboolean("filter_status","auto_question",False): | ||
AutoQuestionFilter().enable(True) | ||
if globalVars.app.config.getboolean("filter_status","baton",False): | ||
BatonFilter().enable(True) | ||
|
||
# 適用状況を保存 | ||
def saveStatus(): | ||
# いったんすべてFalseにしておく | ||
globalVars.app.config["filter_status"]["auto_question"]=False | ||
globalVars.app.config["filter_status"]["baton"]=False | ||
|
||
for f in getFilterList(): | ||
if type(f)==AutoQuestionFilter: | ||
globalVars.app.config["filter_status"]["auto_question"]=True | ||
elif type(f)==BatonFilter: | ||
globalVars.app.config["filter_status"]["baton"]=True |
Binary file not shown.
Oops, something went wrong.