MCPcopy Index your code
hub / github.com/PySimpleGUI/PySimpleGUI / _github_issue_post_validate

Function _github_issue_post_validate

DemoPrograms/Demo_Post_An_Issue.py:124–170  ·  view source on GitHub ↗
(values, checklist, issue_types)

Source from the content-addressed store, hash-verified

122#########################################################################################################
123
124def _github_issue_post_validate(values, checklist, issue_types):
125 issue_type = None
126 for itype in issue_types:
127 if values[itype]:
128 issue_type = itype
129 break
130 if issue_type is None:
131 sg.popup_error('Must choose issue type')
132 return False
133 if values['-OS WIN-']:
134 operating_system = 'Windows'
135 os_ver = values['-OS WIN VER-']
136 elif values['-OS LINUX-']:
137 operating_system = 'Linux'
138 os_ver = values['-OS LINUX VER-']
139 elif values['-OS MAC-']:
140 operating_system = 'Mac'
141 os_ver = values['-OS MAC VER-']
142 elif values['-OS OTHER-']:
143 operating_system = 'Other'
144 os_ver = values['-OS OTHER VER-']
145 else:
146 sg.popup_error('Must choose Operating System')
147 return False
148
149 if os_ver == '':
150 sg.popup_error('Must fill in an OS Version')
151 return False
152
153 checkboxes = any([ values[('-CB-', i)] for i in range(len(checklist))])
154 if not checkboxes:
155 sg.popup_error('None of the checkboxes were checked.... you need to have tried something...anything...')
156 return False
157
158 title = values['-TITLE-'].strip()
159 if len(title) == 0:
160 sg.popup_error("Title can't be blank")
161 return False
162 elif title[1:len(title)-1] == issue_type:
163 sg.popup_error("Title can't be blank (only the type of issue isn't enough)")
164 return False
165
166 if len(values['-ML DETAILS-']) < 4:
167 sg.popup_error("A little more details would be awesome")
168 return False
169
170 return True
171
172
173

Callers 1

main_open_github_issueFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected