Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
G
gajim-plugins
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Model registry
Operate
Environments
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
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
Evert Mouw
gajim-plugins
Commits
aaed66d2
Commit
aaed66d2
authored
13 years ago
by
Yann Leboulanger
Browse files
Options
Downloads
Patches
Plain Diff
fix some bugs and ability to configure board size
parent
bf328c0c
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
tictactoe/config_dialog.ui
+62
-0
62 additions, 0 deletions
tictactoe/config_dialog.ui
tictactoe/manifest.ini
+1
-1
1 addition, 1 deletion
tictactoe/manifest.ini
tictactoe/plugin.py
+36
-9
36 additions, 9 deletions
tictactoe/plugin.py
with
99 additions
and
10 deletions
tictactoe/config_dialog.ui
0 → 100644
+
62
−
0
View file @
aaed66d2
<?xml version="1.0" encoding="UTF-8"?>
<interface>
<requires
lib=
"gtk+"
version=
"2.16"
/>
<object
class=
"GtkWindow"
id=
"window1"
>
<property
name=
"can_focus"
>
False
</property>
<child>
<object
class=
"GtkVBox"
id=
"vbox1"
>
<property
name=
"visible"
>
True
</property>
<property
name=
"can_focus"
>
False
</property>
<child>
<object
class=
"GtkHBox"
id=
"hbox2"
>
<property
name=
"visible"
>
True
</property>
<property
name=
"can_focus"
>
False
</property>
<child>
<object
class=
"GtkLabel"
id=
"board_size_label"
>
<property
name=
"width_request"
>
133
</property>
<property
name=
"visible"
>
True
</property>
<property
name=
"can_focus"
>
False
</property>
<property
name=
"xalign"
>
0.029999999329447746
</property>
<property
name=
"label"
translatable=
"yes"
>
Board size
</property>
<property
name=
"ellipsize"
>
start
</property>
<property
name=
"single_line_mode"
>
True
</property>
<property
name=
"track_visited_links"
>
False
</property>
</object>
<packing>
<property
name=
"expand"
>
True
</property>
<property
name=
"fill"
>
True
</property>
<property
name=
"position"
>
0
</property>
</packing>
</child>
<child>
<object
class=
"GtkSpinButton"
id=
"board_size"
>
<property
name=
"visible"
>
True
</property>
<property
name=
"can_focus"
>
True
</property>
<property
name=
"has_tooltip"
>
True
</property>
<property
name=
"tooltip_text"
translatable=
"yes"
>
Preview size(10-512)
</property>
<property
name=
"invisible_char"
>
●
</property>
<property
name=
"width_chars"
>
6
</property>
<property
name=
"snap_to_ticks"
>
True
</property>
<property
name=
"numeric"
>
True
</property>
<signal
name=
"value-changed"
handler=
"board_size_value_changed"
swapped=
"no"
/>
</object>
<packing>
<property
name=
"expand"
>
False
</property>
<property
name=
"fill"
>
False
</property>
<property
name=
"position"
>
1
</property>
</packing>
</child>
</object>
<packing>
<property
name=
"expand"
>
True
</property>
<property
name=
"fill"
>
True
</property>
<property
name=
"position"
>
0
</property>
</packing>
</child>
<child>
<placeholder/>
</child>
</object>
</child>
</object>
</interface>
This diff is collapsed.
Click to expand it.
tictactoe/manifest.ini
+
1
−
1
View file @
aaed66d2
[info]
name:
Tic
tac
toe
short_name:
Tic
tac
toe
version:
0.
1
version:
0.
2
description:
Play
tic
tac
toe
authors
=
Yann Leboulanger <asterix@lagaule.org>
homepage
=
www.gajim.org
This diff is collapsed.
Click to expand it.
tictactoe/plugin.py
+
36
−
9
View file @
aaed66d2
...
...
@@ -32,6 +32,7 @@ from common import gajim
from
plugins
import
GajimPlugin
from
plugins.plugin
import
GajimPluginException
from
plugins.helpers
import
log_calls
,
log
from
plugins.gui
import
GajimPluginConfigDialog
import
common.xmpp
import
gtk
from
gtk
import
gdk
...
...
@@ -51,7 +52,7 @@ class TictactoePlugin(GajimPlugin):
@log_calls
(
'
TictactoePlugin
'
)
def
init
(
self
):
self
.
description
=
_
(
'
Play Tictactoe.
'
)
self
.
config_dialog
=
None
self
.
config_dialog
=
TictactoePluginConfigDialog
(
self
)
self
.
events_handlers
=
{
'
decrypted-message-received
'
:
(
ged
.
GUI1
,
self
.
_nec_decrypted_message_received
),
...
...
@@ -62,6 +63,9 @@ class TictactoePlugin(GajimPlugin):
'
chat_control_base_update_toolbar
'
:
(
self
.
update_button_state
,
None
),
}
self
.
config_default_values
=
{
'
board_size
'
:
(
5
,
''
),
}
self
.
controls
=
[]
@log_calls
(
'
TictactoePlugin
'
)
...
...
@@ -212,7 +216,8 @@ class Base(object):
def
stop_tictactoe
(
self
,
reason
=
None
):
self
.
tictactoe
.
end_game
(
reason
)
self
.
tictactoe
.
board
.
win
.
destroy
()
if
hasattr
(
self
.
tictactoe
,
'
board
'
):
self
.
tictactoe
.
board
.
win
.
destroy
()
self
.
tictactoe
=
None
def
disconnect_from_chat_control
(
self
):
...
...
@@ -229,15 +234,16 @@ class TicTacToeSession(stanza_session.StanzaSession):
gajim
.
get_jid_without_resource
(
str
(
jid
)))
self
.
name
=
contact
.
get_shown_name
()
self
.
base
=
None
self
.
control
=
None
# initiate a session
def
begin
(
self
,
rows
=
3
,
cols
=
3
,
role_s
=
'
x
'
):
self
.
rows
=
rows
self
.
cols
=
cols
def
begin
(
self
,
role_s
=
'
x
'
):
self
.
rows
=
self
.
base
.
plugin
.
config
[
'
board_size
'
]
self
.
cols
=
self
.
base
.
plugin
.
config
[
'
board_size
'
]
self
.
role_s
=
role_s
self
.
strike
=
3
self
.
strike
=
self
.
base
.
plugin
.
config
[
'
board_size
'
]
if
self
.
role_s
==
'
x
'
:
self
.
role_o
=
'
o
'
...
...
@@ -265,13 +271,13 @@ class TicTacToeSession(stanza_session.StanzaSession):
f
.
setValue
(
'
x
'
)
f
=
x
.
setField
(
'
rows
'
)
f
.
setType
(
'
text-single
'
)
f
.
setValue
(
'
3
'
)
f
.
setValue
(
str
(
self
.
base
.
plugin
.
config
[
'
board_size
'
])
)
f
=
x
.
setField
(
'
cols
'
)
f
.
setType
(
'
text-single
'
)
f
.
setValue
(
'
3
'
)
f
.
setValue
(
str
(
self
.
base
.
plugin
.
config
[
'
board_size
'
])
)
f
=
x
.
setField
(
'
strike
'
)
f
.
setType
(
'
text-single
'
)
f
.
setValue
(
'
3
'
)
f
.
setValue
(
str
(
self
.
base
.
plugin
.
config
[
'
board_size
'
])
)
game
.
addChild
(
node
=
x
)
...
...
@@ -715,3 +721,24 @@ class TicTacToeBoard:
def
cheated
(
self
):
self
.
state
==
'
cheated
'
self
.
win
.
queue_draw
()
class
TictactoePluginConfigDialog
(
GajimPluginConfigDialog
):
def
init
(
self
):
self
.
GTK_BUILDER_FILE_PATH
=
self
.
plugin
.
local_file_path
(
'
config_dialog.ui
'
)
self
.
xml
=
gtk
.
Builder
()
self
.
xml
.
set_translation_domain
(
'
gajim_plugins
'
)
self
.
xml
.
add_objects_from_file
(
self
.
GTK_BUILDER_FILE_PATH
,
[
'
vbox1
'
])
self
.
board_size_spinbutton
=
self
.
xml
.
get_object
(
'
board_size
'
)
self
.
board_size_spinbutton
.
get_adjustment
().
set_all
(
3
,
3
,
10
,
1
,
1
,
0
)
vbox
=
self
.
xml
.
get_object
(
'
vbox1
'
)
self
.
child
.
pack_start
(
vbox
)
self
.
xml
.
connect_signals
(
self
)
def
on_run
(
self
):
self
.
board_size_spinbutton
.
set_value
(
self
.
plugin
.
config
[
'
board_size
'
])
def
board_size_value_changed
(
self
,
spinbutton
):
self
.
plugin
.
config
[
'
board_size
'
]
=
int
(
spinbutton
.
get_value
())
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