Skip to content

Commit

Permalink
Merge branch 'master' into release
Browse files Browse the repository at this point in the history
  • Loading branch information
yamahubuki committed Jul 22, 2021
2 parents fb8f197 + 5e768cf commit cbb895d
Show file tree
Hide file tree
Showing 40 changed files with 1,853 additions and 731 deletions.
10 changes: 5 additions & 5 deletions ConfigManager.py
Original file line number Diff line number Diff line change
Expand Up @@ -92,14 +92,14 @@ def getstring(self,section,key,default="",selection=None,*, raw=False, vars=None
return ""
else:
self.log.debug("add default value. at section "+section+", key "+key)
self[section][key]=default
ret=default
self[section][key]=str(default)
ret=str(default)
if selection==None:return ret

if selection!=None and ret not in selection:
self.log.debug("value "+ret+" not in selection. at section "+section+", key "+key)
self[section][key]=default
ret=default
self.log.debug("value "+str(ret)+" not in selection. at section "+section+", key "+key)
self[section][key]=str(default)
ret=str(default)
return ret

def add_section(self,name):
Expand Down
5 changes: 5 additions & 0 deletions DefaultSettings.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ def get():
"update" : True,
"auto_reload" : False,
"log_level":"20",
"keep_filter":"False",
}
config["view"]={
"font": "bold 'MS ゴシック' 22 windows-932",
Expand All @@ -37,6 +38,10 @@ def get():
"password" : "",
"use_always" : "false"
}
config["filter_status"]={
"auto_question" : "False",
"baton" : "False",
}
return config

initialValues={}
Expand Down
13 changes: 12 additions & 1 deletion app.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,10 @@

import AppBase
import constants
import update
import filter
import globalVars
import proxyUtil
import update

class Main(AppBase.MainBase):
def __init__(self):
Expand All @@ -33,6 +34,11 @@ def initialize(self):
# アップデートを実行
if self.config.getboolean("general", "update"):
globalVars.update.update(True)
# 設定されている場合には起動時にフィルタを適用
if self.config.getboolean("general","keep_filter",False):
self.log.debug("keepFilter:run")
filter.loadStatus()

# メインビューを表示
from views import main
self.hMainView=main.MainView()
Expand All @@ -59,6 +65,11 @@ def OnExit(self):
#設定の保存やリソースの開放など、終了前に行いたい処理があれば記述できる
#ビューへのアクセスや終了の抑制はできないので注意。

# フィルタの適用状態を保存
if self.config.getboolean("general","keep_filter",False):
self.log.debug("keepFilter:save")
filter.saveStatus()

import dao
dao.connectionFactory.getConnection().close()
self.log.info("DB connection closed.")
Expand Down
2 changes: 1 addition & 1 deletion appveyor-release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ deploy:
- provider: GitHub
description: "NPC official release"
auth_token:
secure: UcoHc3nVwi+4feNv3QuMZy2qgZmTVElAD9iMr9UxcEUTA0PP2beWDMuiNhBoNYeA
secure: iNSx8v6c+0TP9IyckinrvNWuX+hc7SKruOqRDl9GxdX59sZ2yqB8+UDAtqdPzKIg
artifact: /(NPC-.*\.zip)|(NPC-.*\.json)/
draft: true
prerelease: false
Expand Down
10 changes: 5 additions & 5 deletions appveyor.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@ skip_branch_with_pr: true
skip_tags: true

environment:
gitHubPassword:
secure: s4pKVblYXP+c03qM8gH8tQ==
githubToken:
secure: iNSx8v6c+0TP9IyckinrvNWuX+hc7SKruOqRDl9GxdX59sZ2yqB8+UDAtqdPzKIg
SCRIPT_PASSWORD:
secure: 9RvVUKVQ8MsoG5LOZ86VyFQF19JXXS33tDzomLH/jZM=
matrix:
Expand Down Expand Up @@ -44,9 +44,9 @@ after_test:
- "%PYTHON%\\python.exe tools\\build.py --appveyor"
- cmd: curl "https://actlab.org/git-release.php?repo_name=%APPVEYOR_REPO_NAME%&tag_name=NPC-latestcommit&password=%SCRIPT_PASSWORD%"
- cmd: git tag -d NPC-latestcommit
- cmd: git push -d https://actlab-auto:%gitHubPassword%@github.com/actlaboratory/NPC.git NPC-latestcommit
- cmd: git push -d https://actlab-auto:%githubToken%@github.com/actlaboratory/NPC.git NPC-latestcommit
- cmd: git tag NPC-latestcommit
- cmd: git push https://actlab-auto:%gitHubPassword%@github.com/actlaboratory/NPC.git NPC-latestcommit
- cmd: git push https://actlab-auto:%githubToken%@github.com/actlaboratory/NPC.git NPC-latestcommit



Expand All @@ -60,7 +60,7 @@ deploy:
Force update: true
description: 'automatic build from master branch'
auth_token:
secure: UcoHc3nVwi+4feNv3QuMZy2qgZmTVElAD9iMr9UxcEUTA0PP2beWDMuiNhBoNYeA
secure: iNSx8v6c+0TP9IyckinrvNWuX+hc7SKruOqRDl9GxdX59sZ2yqB8+UDAtqdPzKIg
artifact: NPC-snapshot.zip # upload all NuGet packages to release assets
draft: false
prerelease: false
Expand Down
5 changes: 3 additions & 2 deletions constants.py
Original file line number Diff line number Diff line change
Expand Up @@ -68,5 +68,6 @@
RECEIVED=0
ARCHIVED=1

#その他
SET_FILTER = wx.ID_OK+2
#ログインID種別設定
LOGIN_PEING=0
LOGIN_TWITTER=1
4 changes: 4 additions & 0 deletions defaultKeymap.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,10 +21,13 @@
"FILTER_AUTO_QUESTION":"",
"FILTER_BATON":"",
"FILTER_USER":"",
"FILTER_SEARCH":"ctrl+f/F3",
"FILTER_CLEAR":"",

"ACCOUNT_ANSWER":"",
"ACCOUNT_ARCHIVED":"",
"ACCOUNT_SENT_LIST":"",
"ACCOUNT_SETTINGS":"",

"OPTION_OPTION":"",
"OPTION_KEY_CONFIG":"",
Expand All @@ -36,6 +39,7 @@

defaultKeymap["USERLISTDIALOG"]={
"DELETE" : "delete",
"POPUP" : "Shift+F10",
}

defaultKeymap["CANDIDATEUSERLISTDIALOG"]={
Expand Down
8 changes: 8 additions & 0 deletions errorCodes.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,14 @@
TWITTER_ERROR=6
CANCELED=7

LOGIN_WRONG_PASSWORD=8 #ID/PW誤り
LOGIN_CONFIRM_NEEDED=9 #ユーザによる権限付与が必要
LOGIN_PEING_ERROR=10
LOGIN_TWITTER_ERROR=11
LOGIN_UNKNOWN_ERROR=12
LOGIN_RECAPTCHA_NEEDED=13


UPDATER_NEED_UPDATE = 200# アップデートが必要
UPDATER_LATEST = 204# アップデートが無い
UPDATER_VISIT_SITE = 205
Expand Down
56 changes: 55 additions & 1 deletion filter.py
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=[]

Expand All @@ -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):
Expand Down Expand Up @@ -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 modified locale/en-us/LC_MESSAGES/messages.mo
Binary file not shown.
Loading

0 comments on commit cbb895d

Please sign in to comment.