Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
gajim
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
Weblate
gajim
Commits
4458db5d
Commit
4458db5d
authored
15 years ago
by
Yann Leboulanger
Browse files
Options
Downloads
Patches
Plain Diff
[Yrogirg & I] add a first quote ability. see #2943
parent
e4029ddd
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
src/chat_control.py
+7
-0
7 additions, 0 deletions
src/chat_control.py
src/conversation_textview.py
+19
-3
19 additions, 3 deletions
src/conversation_textview.py
with
26 additions
and
3 deletions
src/chat_control.py
+
7
−
0
View file @
4458db5d
...
@@ -200,6 +200,8 @@ class ChatControlBase(MessageControl):
...
@@ -200,6 +200,8 @@ class ChatControlBase(MessageControl):
# Create textviews and connect signals
# Create textviews and connect signals
self
.
conv_textview
=
ConversationTextview
(
self
.
account
)
self
.
conv_textview
=
ConversationTextview
(
self
.
account
)
id_
=
self
.
conv_textview
.
connect
(
'
quote
'
,
self
.
on_quote
)
self
.
handlers
[
id_
]
=
self
.
conv_textview
.
tv
id_
=
self
.
conv_textview
.
tv
.
connect
(
'
key_press_event
'
,
id_
=
self
.
conv_textview
.
tv
.
connect
(
'
key_press_event
'
,
self
.
_conv_textview_key_press_event
)
self
.
_conv_textview_key_press_event
)
self
.
handlers
[
id_
]
=
self
.
conv_textview
.
tv
self
.
handlers
[
id_
]
=
self
.
conv_textview
.
tv
...
@@ -370,6 +372,11 @@ class ChatControlBase(MessageControl):
...
@@ -370,6 +372,11 @@ class ChatControlBase(MessageControl):
menu
.
show_all
()
menu
.
show_all
()
def
on_quote
(
self
,
widget
,
text
):
text
=
'
>
'
+
text
.
replace
(
'
\n
'
,
'
\n
>
'
)
+
'
\n
'
message_buffer
=
self
.
msg_textview
.
get_buffer
()
message_buffer
.
insert_at_cursor
(
text
)
# moved from ChatControl
# moved from ChatControl
def
_on_banner_eventbox_button_press_event
(
self
,
widget
,
event
):
def
_on_banner_eventbox_button_press_event
(
self
,
widget
,
event
):
'''
If right-clicked, show popup
'''
'''
If right-clicked, show popup
'''
...
...
This diff is collapsed.
Click to expand it.
src/conversation_textview.py
+
19
−
3
View file @
4458db5d
...
@@ -154,9 +154,15 @@ class TextViewImage(gtk.Image):
...
@@ -154,9 +154,15 @@ class TextViewImage(gtk.Image):
return
False
return
False
class
ConversationTextview
:
class
ConversationTextview
(
gobject
.
GObject
)
:
'''
Class for the conversation textview (where user reads already said
'''
Class for the conversation textview (where user reads already said
messages) for chat/groupchat windows
'''
messages) for chat/groupchat windows
'''
__gsignals__
=
dict
(
quote
=
(
gobject
.
SIGNAL_RUN_LAST
|
gobject
.
SIGNAL_ACTION
,
None
,
# return value
(
str
,
)
# arguments
)
)
FOCUS_OUT_LINE_PIXBUF
=
gtk
.
gdk
.
pixbuf_new_from_file
(
os
.
path
.
join
(
FOCUS_OUT_LINE_PIXBUF
=
gtk
.
gdk
.
pixbuf_new_from_file
(
os
.
path
.
join
(
gajim
.
DATA_DIR
,
'
pixmaps
'
,
'
muc_separator.png
'
))
gajim
.
DATA_DIR
,
'
pixmaps
'
,
'
muc_separator.png
'
))
...
@@ -170,6 +176,7 @@ class ConversationTextview:
...
@@ -170,6 +176,7 @@ class ConversationTextview:
def
__init__
(
self
,
account
,
used_in_history_window
=
False
):
def
__init__
(
self
,
account
,
used_in_history_window
=
False
):
'''
if used_in_history_window is True, then we do not show
'''
if used_in_history_window is True, then we do not show
Clear menuitem in context menu
'''
Clear menuitem in context menu
'''
gobject
.
GObject
.
__init__
(
self
)
self
.
used_in_history_window
=
used_in_history_window
self
.
used_in_history_window
=
used_in_history_window
# no need to inherit TextView, use it as atrribute is safer
# no need to inherit TextView, use it as atrribute is safer
...
@@ -688,9 +695,15 @@ class ConversationTextview:
...
@@ -688,9 +695,15 @@ class ConversationTextview:
item
=
gtk
.
SeparatorMenuItem
()
item
=
gtk
.
SeparatorMenuItem
()
menu
.
prepend
(
item
)
menu
.
prepend
(
item
)
self
.
selected_phrase
=
helpers
.
reduce_chars_newlines
(
if
not
self
.
used_in_history_window
:
item
=
gtk
.
MenuItem
(
_
(
'
_Quote
'
))
id_
=
item
.
connect
(
'
activate
'
,
self
.
on_quote
)
self
.
handlers
[
id_
]
=
item
menu
.
prepend
(
item
)
_selected_phrase
=
helpers
.
reduce_chars_newlines
(
self
.
selected_phrase
,
25
,
2
)
self
.
selected_phrase
,
25
,
2
)
item
=
gtk
.
MenuItem
(
_
(
'
_Actions for
"
%s
"'
)
%
self
.
selected_phrase
)
item
=
gtk
.
MenuItem
(
_
(
'
_Actions for
"
%s
"'
)
%
_
selected_phrase
)
menu
.
prepend
(
item
)
menu
.
prepend
(
item
)
submenu
=
gtk
.
Menu
()
submenu
=
gtk
.
Menu
()
item
.
set_submenu
(
submenu
)
item
.
set_submenu
(
submenu
)
...
@@ -753,6 +766,9 @@ class ConversationTextview:
...
@@ -753,6 +766,9 @@ class ConversationTextview:
menu
.
show_all
()
menu
.
show_all
()
def
on_quote
(
self
,
widget
):
self
.
emit
(
'
quote
'
,
self
.
selected_phrase
)
def
on_textview_button_press_event
(
self
,
widget
,
event
):
def
on_textview_button_press_event
(
self
,
widget
,
event
):
# If we clicked on a taged text do NOT open the standard popup menu
# If we clicked on a taged text do NOT open the standard popup menu
# if normal text check if we have sth selected
# if normal text check if we have sth selected
...
...
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