Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
S
Statistical_Grammar_Checker
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Iterations
Wiki
Requirements
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Test cases
Artifacts
Deploy
Releases
Package registry
Container registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Code review analytics
Issue analytics
Insights
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
NLP_WS_2021
Statistical_Grammar_Checker
Commits
53a71a13
Commit
53a71a13
authored
3 years ago
by
Heiko Raible
Browse files
Options
Downloads
Patches
Plain Diff
Update main.py
parent
d8fa6177
No related branches found
No related tags found
1 merge request
!13
Update main.py
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
deployment/main.py
+11
-3
11 additions, 3 deletions
deployment/main.py
with
11 additions
and
3 deletions
deployment/main.py
+
11
−
3
View file @
53a71a13
...
...
@@ -13,6 +13,7 @@ class StatisticalGrammarChecker(wx.App):
frame
.
Show
()
return
True
class
Frame
(
wx
.
Frame
):
"""
Main Frame
...
...
@@ -23,7 +24,7 @@ class Frame(wx.Frame):
def
__init__
(
self
):
# init
style
=
wx
.
SYSTEM_MENU
|
wx
.
CAPTION
|
wx
.
MINIMIZE_BOX
|
wx
.
MAXIMIZE_BOX
|
wx
.
CLOSE_BOX
|
wx
.
CLIP_CHILDREN
|
wx
.
RESIZE_BORDER
super
(
Frame
,
self
).
__init__
(
parent
=
None
,
title
=
"
Statistical Grammar Checker
"
,
style
=
style
,
size
=
(
600
,
6
00
))
super
(
Frame
,
self
).
__init__
(
parent
=
None
,
title
=
"
Statistical Grammar Checker
"
,
style
=
style
,
size
=
(
600
,
5
00
))
# create panels
self
.
sizer
=
wx
.
BoxSizer
()
...
...
@@ -34,6 +35,7 @@ class Frame(wx.Frame):
# center frame
self
.
Center
()
class
Panel
(
wx
.
Panel
):
def
__init__
(
self
,
parent
):
super
(
Panel
,
self
).
__init__
(
parent
)
...
...
@@ -59,7 +61,7 @@ class Panel(wx.Panel):
# create sizer
vboxsizer
=
wx
.
BoxSizer
(
wx
.
VERTICAL
)
example_text
=
"
We has all learned a lot in the last semester!
"
example_text
=
""
self
.
text_input
=
RichTextCtrl
(
parent
=
self
,
value
=
example_text
,
style
=
wx
.
TE_MULTILINE
)
vboxsizer
.
Add
(
self
.
text_input
,
proportion
=
1
,
flag
=
wx
.
EXPAND
|
wx
.
ALL
-
wx
.
BOTTOM
,
border
=
5
)
...
...
@@ -75,7 +77,10 @@ class Panel(wx.Panel):
# THREADS
def
grammar_check_thread
(
self
):
# disable button
wx
.
CallAfter
(
self
.
button
.
SetLabel
,
"
checking..
"
)
wx
.
CallAfter
(
self
.
button
.
Enable
,
False
)
# variables
output_text
=
""
# get input
input_text
=
self
.
text_input
.
GetValue
()
...
...
@@ -104,6 +109,9 @@ class Panel(wx.Panel):
for
color
,
highlights_list
in
highlights
.
items
():
for
highlight
in
highlights_list
:
wx
.
CallAfter
(
self
.
text_output
.
SetStyle
,
highlight
[
0
],
highlight
[
1
],
wx
.
TextAttr
(
colText
=
wx
.
WHITE
,
colBack
=
wx
.
Colour
(
150
,
0
,
0
)
if
color
==
"
red
"
else
wx
.
Colour
(
0
,
150
,
0
)))
# re-enable button
wx
.
CallAfter
(
self
.
button
.
SetLabel
,
"
grammar check!
"
)
wx
.
CallAfter
(
self
.
button
.
Enable
,
True
)
if
__name__
==
"
__main__
"
:
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment