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
6c5cd8de
Commit
6c5cd8de
authored
Jul 27, 2015
by
Agrigor
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
First GUI implementation
parent
e4fd944b
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
43 additions
and
40 deletions
+43
-40
client/GUIs/start.ui
client/GUIs/start.ui
+14
-26
client/gui.py
client/gui.py
+29
-14
No files found.
client/GUIs/start.ui
View file @
6c5cd8de
...
...
@@ -41,7 +41,7 @@
<property
name=
"orientation"
>
<enum>
Qt::Horizontal
</enum>
</property>
<widget
class=
"QWidget"
name=
""
>
<widget
class=
"QWidget"
name=
"
layoutWidget
"
>
<layout
class=
"QVBoxLayout"
name=
"Input_IPAddress"
>
<item>
<widget
class=
"QLabel"
name=
"O_Name_IPAddress_Edit"
>
...
...
@@ -56,10 +56,10 @@
<string>
IPv4-Adresse
</string>
</property>
<property
name=
"inputMask"
>
<string
>
000.000.000.000;0
</string
>
<string
/
>
</property>
<property
name=
"text"
>
<string
>
...
</string
>
<string
/
>
</property>
<property
name=
"maxLength"
>
<number>
15
</number>
...
...
@@ -67,11 +67,8 @@
<property
name=
"cursorPosition"
>
<number>
0
</number>
</property>
<property
name=
"alignment"
>
<set>
Qt::AlignCenter
</set>
</property>
<property
name=
"placeholderText"
>
<string
>
000000000000
</string
>
<string
/
>
</property>
</widget>
</item>
...
...
@@ -83,13 +80,13 @@
</property>
</widget>
</widget>
<widget
class=
"QWidget"
name=
""
>
<widget
class=
"QWidget"
name=
"
layoutWidget
"
>
<property
name=
"geometry"
>
<rect>
<x>
10
</x>
<y>
110
</y>
<width>
321
</width>
<height>
10
1
</height>
<height>
10
2
</height>
</rect>
</property>
<layout
class=
"QVBoxLayout"
name=
"Input_PlayerNames"
>
...
...
@@ -135,13 +132,13 @@
</item>
</layout>
</widget>
<widget
class=
"QWidget"
name=
""
>
<widget
class=
"QWidget"
name=
"
layoutWidget
"
>
<property
name=
"geometry"
>
<rect>
<x>
10
</x>
<y>
60
</y>
<width>
321
</width>
<height>
4
4
</height>
<height>
4
5
</height>
</rect>
</property>
<layout
class=
"QVBoxLayout"
name=
"Input_NumberOfPlayers"
>
...
...
@@ -167,7 +164,7 @@
</layout>
</item>
<item>
<widget
class=
"QSlider"
name=
"I_
AnzahlSpieler
"
>
<widget
class=
"QSlider"
name=
"I_
NumberOfPlayers
"
>
<property
name=
"minimum"
>
<number>
1
</number>
</property>
...
...
@@ -184,24 +181,15 @@
</item>
</layout>
</widget>
<zorder>
I_IPAdress
</zorder>
<zorder>
I_Connect
</zorder>
<zorder>
I_AnzahlSpieler
</zorder>
<zorder>
O_NumberOfPlayers
</zorder>
<zorder>
O_Name_IPAddress_Edit
</zorder>
<zorder>
O_Name_NumberOfPlayers_Edit
</zorder>
<zorder>
I_AnzahlSpieler
</zorder>
<zorder>
I_AnzahlSpieler
</zorder>
<zorder>
I_NamePlayer1
</zorder>
<zorder>
I_NamePlayer2
</zorder>
<zorder>
I_NamePlayer3
</zorder>
<zorder>
I_NamePlayer4
</zorder>
<zorder>
splitter
</zorder>
<zorder>
layoutWidget
</zorder>
<zorder>
layoutWidget
</zorder>
<zorder>
I_OK_Button
</zorder>
</widget>
<tabstops>
<tabstop>
I_IPAdress
</tabstop>
<tabstop>
I_Connect
</tabstop>
<tabstop>
I_
AnzahlSpieler
</tabstop>
<tabstop>
I_
NumberOfPlayers
</tabstop>
<tabstop>
I_NamePlayer1
</tabstop>
<tabstop>
I_NamePlayer2
</tabstop>
<tabstop>
I_NamePlayer3
</tabstop>
...
...
@@ -210,7 +198,7 @@
<resources/>
<connections>
<connection>
<sender>
I_
AnzahlSpieler
</sender>
<sender>
I_
NumberOfPlayers
</sender>
<signal>
valueChanged(int)
</signal>
<receiver>
O_NumberOfPlayers
</receiver>
<slot>
setNum(int)
</slot>
...
...
client/gui.py
View file @
6c5cd8de
...
...
@@ -8,6 +8,9 @@
import
sys
import
threading
import
socket
from
PyQt4.QtCore
import
*
from
PyQt4.QtGui
import
*
from
PyQt4.uic
import
*
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
...
...
@@ -51,20 +54,34 @@ class Comunication:
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
class
Client
:
def
__init__
(
self
,
ip
,
port
):
self
.
UDP
=
Comunication
(
ip
,
port
)
self
.
U
DP
.
create_client_socket
(
)
class
GUI
:
def
__init__
(
self
):
self
.
app
=
QApplication
(
sys
.
argv
)
self
.
U
I_Start
=
loadUi
(
"GUIs/start.ui"
)
def
main
(
self
):
try
:
threading
.
Event
().
wait
()
finally
:
self
.
cleanup
()
self
.
socketCreated
=
False
self
.
UI_Start
.
connect
(
self
.
UI_Start
.
I_Connect
,
SIGNAL
(
"clicked()"
),
self
.
connect
)
self
.
UI_Start
.
show
()
self
.
app
.
exec_
()
self
.
app
.
aboutToQuit
(
self
.
cleanup
())
def
connect
(
self
):
self
.
ip
=
str
(
self
.
UI_Start
.
I_IPAdress
.
text
())
self
.
UDP
=
Comunication
(
self
.
ip
,
PORT
)
if
self
.
UDP
.
check_ip
():
self
.
UDP
.
create_client_socket
()
self
.
socketCreated
=
True
else
:
print
(
"First argument was no valid IP-address"
)
self
.
socketCreated
=
False
sys
.
exit
(
1
)
def
cleanup
(
self
):
self
.
UDP
.
cleanup
()
print
(
"
\n
Bye Bye"
)
if
self
.
socketCreated
:
self
.
UDP
.
cleanup
()
print
(
"Bye Bye"
)
sys
.
exit
(
0
)
...
...
@@ -74,9 +91,7 @@ class Client:
# Start Client
client
=
Client
(
IP
,
PORT
)
client
.
main
()
client
=
GUI
()
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ END ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
...
...
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