Skip to content

Commit

Permalink
checkbox again
Browse files Browse the repository at this point in the history
  • Loading branch information
tastysugar committed Mar 18, 2023
1 parent 832a0ed commit a116975
Showing 1 changed file with 11 additions and 17 deletions.
28 changes: 11 additions & 17 deletions OKPLogic.py
Original file line number Diff line number Diff line change
Expand Up @@ -335,6 +335,7 @@ def updateTemplate(self):
conf = defaultdict(bool, self.conf['template'][selected])
self.checkboxDmhyPublish.setChecked(conf['checkDmhy'])
self.checkboxNyaaPublish.setChecked(conf['checkNyaa'])
self.checkboxBangumiPublish.setChecked(conf['checkBangumi'])
self.checkboxAcgripPublish.setChecked(conf['checkAcgrip'])
self.checkboxAcgnxasiaPublish.setChecked(conf['checkAcgnxasia'])
self.checkboxAcgnxglobalPublish.setChecked(conf['checkAcgnxglobal'])
Expand Down Expand Up @@ -369,53 +370,46 @@ def setTitleText(self):
self.textTitle.setText(title)

def selectCookiesChangeHandler(self, event):
print(event)
if event == "":
return

cookies = self.profile['profiles'][event]['cookies']
try:
template = self.conf['template'][event]
except:
template = defaultdict(lambda : False)


if not re.search(r"https:\/\/share\.dmhy\.org", cookies):
self.checkboxDmhyPublish.setChecked(False)
self.checkboxDmhyPublish.setCheckable(False)
else:
self.checkboxDmhyPublish.setChecked(template['checkDmhy'])
self.checkboxDmhyPublish.setCheckable(True)

if not re.search(r"https:\/\/nyaa\.si", cookies):
self.checkboxNyaaPublish.setChecked(False)
self.checkboxNyaaPublish.setCheckable(False)
else:
self.checkboxNyaaPublish.setChecked(template['checkNyaa'])
self.checkboxNyaaPublish.setCheckable(True)

if not re.search(r"https:\/\/acg\.rip", cookies):
self.checkboxAcgripPublish.setChecked(False)
self.checkboxAcgripPublish.setCheckable(False)
else:
self.checkboxAcgripPublish.setChecked(template['checkAcgrip'])
self.checkboxAcgripPublish.setCheckable(True)

if not re.search(r"https:\/\/bangumi\.moe", cookies):
self.checkboxBangumiPublish.setChecked(False)
self.checkboxBangumiPublish.setCheckable(False)
else:
self.checkboxBangumiPublish.setChecked(template['checkBangumi'])
self.checkboxBangumiPublish.setCheckable(True)

if not re.search(r"https:\/\/share\.acgnx\.se", cookies):
self.checkboxAcgnxasiaPublish.setChecked(False)
self.checkboxAcgnxasiaPublish.setCheckable(False)
else:
self.checkboxAcgnxasiaPublish.setChecked(template['checkAcgnxasia'])
self.checkboxAcgnxasiaPublish.setCheckable(True)

if not re.search(r"https:\/\/acgnx\.se", cookies):
self.checkboxAcgnxglobalPublish.setChecked(False)
self.checkboxAcgnxglobalPublish.setCheckable(False)
else:
self.checkboxAcgnxglobalPublish.setChecked(template['checkAcgnxglobal'])
self.checkboxAcgnxglobalPublish.setCheckable(True)


Expand Down Expand Up @@ -704,7 +698,7 @@ def publishRun(self):
cookies = self.profile['profiles'][self.menuSelectCookies.currentText()]['cookies']
profile = self.profile['profiles'][self.menuSelectCookies.currentText()]

if self.checkboxDmhyPublish.isChecked():
if self.checkboxDmhyPublish.isChecked() and self.checkboxDmhyPublish.isCheckable():
intro_templates.append(
{
'site': 'dmhy',
Expand All @@ -713,7 +707,7 @@ def publishRun(self):
}
)

if self.checkboxNyaaPublish.isChecked():
if self.checkboxNyaaPublish.isChecked() and self.checkboxNyaaPublish.isCheckable():
intro_templates.append(
{
'site': 'nyaa',
Expand All @@ -722,7 +716,7 @@ def publishRun(self):
}
)

if self.checkboxAcgripPublish.isChecked():
if self.checkboxAcgripPublish.isChecked() and self.checkboxAcgripPublish.isCheckable():
intro_templates.append(
{
'site': 'acgrip',
Expand All @@ -731,7 +725,7 @@ def publishRun(self):
}
)

if self.checkboxBangumiPublish.isChecked():
if self.checkboxBangumiPublish.isChecked() and self.checkboxBangumiPublish.isCheckable():
intro_templates.append(
{
'site': 'bangumi',
Expand All @@ -740,7 +734,7 @@ def publishRun(self):
}
)

if self.checkboxAcgnxasiaPublish.isChecked():
if self.checkboxAcgnxasiaPublish.isChecked() and self.checkboxAcgnxasiaPublish.isCheckable():
intro_templates.append(
{
'site': 'acgnx_asia',
Expand All @@ -749,7 +743,7 @@ def publishRun(self):
}
)

if self.checkboxAcgnxglobalPublish.isChecked():
if self.checkboxAcgnxglobalPublish.isChecked() and self.checkboxAcgnxglobalPublish.isCheckable():
intro_templates.append(
{
'site': 'acgnx_global',
Expand Down

0 comments on commit a116975

Please sign in to comment.