Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
J
Jeopardy
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Service Desk
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Operations
Operations
Incidents
Environments
Analytics
Analytics
CI / CD
Repository
Value Stream
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Hacksaar
Jeopardy
Commits
e38c0a02
Commit
e38c0a02
authored
Nov 17, 2015
by
Agrigor
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Added some new Start_GUI functions
parent
a8c6dfde
Changes
5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
96 additions
and
16 deletions
+96
-16
.directory
.directory
+8
-0
client/GUIs/start.ui
client/GUIs/start.ui
+48
-4
client/client.py
client/client.py
+1
-1
client/gui.py
client/gui.py
+38
-10
server/server_local.py
server/server_local.py
+1
-1
No files found.
.directory
0 → 100644
View file @
e38c0a02
[Dolphin]
PreviewsShown=true
Timestamp=2015,11,17,0,56,35
Version=3
ViewMode=1
[Settings]
HiddenFilesShown=true
client/GUIs/start.ui
View file @
e38c0a02
...
...
@@ -10,7 +10,7 @@
<x>
0
</x>
<y>
0
</y>
<width>
339
</width>
<height>
2
62
</height>
<height>
2
99
</height>
</rect>
</property>
<property
name=
"windowTitle"
>
...
...
@@ -99,7 +99,7 @@
<item>
<widget
class=
"QLineEdit"
name=
"I_NamePlayer1"
>
<property
name=
"enabled"
>
<bool>
tru
e
</bool>
<bool>
fals
e
</bool>
</property>
<property
name=
"text"
>
<string/>
...
...
@@ -150,7 +150,7 @@
</item>
</layout>
</widget>
<widget
class=
"QWidget"
name=
""
>
<widget
class=
"QWidget"
name=
"
layoutWidget
"
>
<property
name=
"geometry"
>
<rect>
<x>
11
</x>
...
...
@@ -184,7 +184,7 @@
<item>
<widget
class=
"QSlider"
name=
"I_NumberOfPlayers"
>
<property
name=
"enabled"
>
<bool>
tru
e
</bool>
<bool>
fals
e
</bool>
</property>
<property
name=
"minimum"
>
<number>
1
</number>
...
...
@@ -202,11 +202,55 @@
</item>
</layout>
</widget>
<widget
class=
"QLabel"
name=
"O_Msg"
>
<property
name=
"geometry"
>
<rect>
<x>
10
</x>
<y>
260
</y>
<width>
321
</width>
<height>
31
</height>
</rect>
</property>
<property
name=
"frameShape"
>
<enum>
QFrame::NoFrame
</enum>
</property>
<property
name=
"frameShadow"
>
<enum>
QFrame::Raised
</enum>
</property>
<property
name=
"text"
>
<string/>
</property>
<property
name=
"alignment"
>
<set>
Qt::AlignCenter
</set>
</property>
</widget>
<widget
class=
"KSeparator"
name=
"kseparator"
>
<property
name=
"geometry"
>
<rect>
<x>
10
</x>
<y>
250
</y>
<width>
321
</width>
<height>
20
</height>
</rect>
</property>
<property
name=
"frameShadow"
>
<enum>
QFrame::Sunken
</enum>
</property>
</widget>
<zorder>
splitter
</zorder>
<zorder>
layoutWidget
</zorder>
<zorder>
layoutWidget
</zorder>
<zorder>
I_Start
</zorder>
<zorder>
O_Msg
</zorder>
<zorder>
kseparator
</zorder>
</widget>
<customwidgets>
<customwidget>
<class>
KSeparator
</class>
<extends>
QFrame
</extends>
<header>
kseparator.h
</header>
</customwidget>
</customwidgets>
<tabstops>
<tabstop>
I_IPAdress
</tabstop>
<tabstop>
I_Connect
</tabstop>
...
...
client/client.py
View file @
e38c0a02
#!/usr/bin/python
#!/usr/bin/python
3
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# ~~~~~~~~~~~~~~~~~~~~~~~~ IMPORT LIBRARIES ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
...
...
client/gui.py
View file @
e38c0a02
#!/usr/bin/python
#!/usr/bin/python
3
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# ~~~~~~~~~~~~~~~~~~~~~~~~ IMPORT LIBRARIES ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
...
...
@@ -53,6 +53,19 @@ class Player:
self
.
Points
=
0
self
.
Name
=
name
def
get_Points
(
self
):
return
self
.
Points
def
set_Points
(
self
,
newPoints
):
self
.
Points
=
newPoints
def
get_Name
(
self
):
return
self
.
Name
def
set_Name
(
self
,
newName
):
self
.
Name
=
newName
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ MAIN ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
...
...
@@ -84,26 +97,38 @@ class StartGUI:
self
.
__UI_Start
.
connect
(
self
.
__UI_Start
.
I_Connect
,
SIGNAL
(
"clicked()"
),
self
.
connect
)
self
.
__UI_Start
.
connect
(
self
.
__UI_Start
.
I_Start
,
SIGNAL
(
"clicked()"
),
self
.
start
)
self
.
__UI_Start
.
connect
(
self
.
__UI_Start
.
I_NumberOfPlayers
,
SIGNAL
(
"valueChanged(int)"
),
self
.
show_names_input
)
self
.
__UI_Start
.
connect
(
self
.
__UI_Start
.
I_NamePlayer1
,
SIGNAL
(
"textChanged(QString)"
),
self
.
name_player_1_changed
)
self
.
__UI_Start
.
connect
(
self
.
__UI_Start
.
I_NumberOfPlayers
,
SIGNAL
(
"valueChanged(int)"
),
self
.
show_names_input_field
)
self
.
__UI_Start
.
connect
(
self
.
__UI_Start
.
I_NamePlayer1
,
SIGNAL
(
"textChanged(QString)"
),
self
.
name_player_changed
)
self
.
__UI_Start
.
connect
(
self
.
__UI_Start
.
I_NamePlayer2
,
SIGNAL
(
"textChanged(QString)"
),
self
.
name_player_changed
)
self
.
__UI_Start
.
connect
(
self
.
__UI_Start
.
I_NamePlayer3
,
SIGNAL
(
"textChanged(QString)"
),
self
.
name_player_changed
)
self
.
__UI_Start
.
connect
(
self
.
__UI_Start
.
I_NamePlayer4
,
SIGNAL
(
"textChanged(QString)"
),
self
.
name_player_changed
)
self
.
__UI_Start
.
show
()
def
name_player_1_changed
(
self
,
name
):
if
int
(
self
.
__UI_Start
.
O_NumberOfPlayers
.
text
())
==
1
and
self
.
socketCreated
and
len
(
str
(
self
.
__UI_Start
.
I_NamePlayer1
.
text
()))
>
1
:
def
name_player_changed
(
self
,
name
):
sender
=
self
.
__UI_Start
.
sender
()
self
.
__UI_Start
.
O_Msg
.
setText
(
str
(
sender
.
text
()))
# TODO
if
len
(
str
(
sender
.
text
()))
>
1
:
self
.
__UI_Start
.
I_Start
.
setDisabled
(
False
)
else
:
self
.
__UI_Start
.
I_Start
.
setDisabled
(
True
)
def
show_names_input
(
self
,
number
):
def
show_names_input
_field
(
self
,
number
):
number
-=
1
playerInputs
=
[
self
.
__UI_Start
.
I_NamePlayer1
,
self
.
__UI_Start
.
I_NamePlayer2
,
self
.
__UI_Start
.
I_NamePlayer3
,
self
.
__UI_Start
.
I_NamePlayer4
]
for
i
in
range
(
len
(
playerInputs
)):
if
i
<=
number
:
if
i
<=
number
and
self
.
socketCreated
:
playerInputs
[
i
].
setDisabled
(
False
)
else
:
playerInputs
[
i
].
setDisabled
(
True
)
if
number
>=
1
:
self
.
__UI_Start
.
O_Msg
.
setText
(
str
(
number
+
1
)
+
" Players"
)
else
:
self
.
__UI_Start
.
O_Msg
.
setText
(
"1 Player"
)
def
start
(
self
):
namesOfPlayers
=
[
str
(
self
.
__UI_Start
.
I_NamePlayer1
.
text
()),
...
...
@@ -115,13 +140,16 @@ class StartGUI:
def
connect
(
self
):
self
.
UDP
=
Comunication
(
str
(
self
.
__UI_Start
.
I_IPAdress
.
text
()),
PORT
)
if
self
.
UDP
.
check_ip
():
if
self
.
UDP
.
check_ip
()
and
not
self
.
socketCreated
:
self
.
UDP
.
create_client_socket
()
self
.
socketCreated
=
True
self
.
__UI_Start
.
I_Connect
.
setDisabled
(
True
)
self
.
__UI_Start
.
O_Msg
.
setText
(
"Connected"
)
self
.
__UI_Start
.
I_NumberOfPlayers
.
setDisabled
(
False
)
self
.
__UI_Start
.
I_NamePlayer1
.
setDisabled
(
False
)
else
:
print
(
"First argument was n
o valid IP-address"
)
self
.
__UI_Start
.
O_Msg
.
setText
(
"N
o valid IP-address"
)
self
.
socketCreated
=
False
sys
.
exit
(
1
)
def
cleanup
(
self
):
if
self
.
socketCreated
:
...
...
server/server_local.py
View file @
e38c0a02
#!/usr/bin/python
#!/usr/bin/python
3
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# ~~~~~~~~~~~~~~~~~~~~~~~~ IMPORT LIBRARIES ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment