some fixes and image

This commit is contained in:
ingvar1995 2016-07-12 13:48:59 +03:00
parent 4f42098d56
commit bae87c8d72
7 changed files with 23 additions and 16 deletions

View File

@ -298,7 +298,7 @@ def group_message(window, tray):
def wrapped(tox, group_number, peer_id, message_type, message, length, user_data):
profile = Profile.get_instance()
settings = Settings.get_instance()
message = str(message, 'utf-8')
message = str(message[:length], 'utf-8')
invoke_in_main_thread(profile.new_message, group_number, message_type, message, True)
if not window.isActiveWindow():
bl = settings['notify_all_gc'] or profile.name in message

View File

@ -150,3 +150,14 @@ class Contact(basecontact.BaseContact):
messages = property(get_messages)
# -----------------------------------------------------------------------------------------------------------------
# Number (can be used in toxcore)
# -----------------------------------------------------------------------------------------------------------------
def get_number(self):
return self._number
def set_number(self, value):
self._number = value
number = property(get_number, set_number)

View File

@ -175,15 +175,3 @@ class Friend(contact.Contact):
def set_alias(self, alias):
self._alias = bool(alias)
# -----------------------------------------------------------------------------------------------------------------
# Friend's number (can be used in toxcore)
# -----------------------------------------------------------------------------------------------------------------
def get_number(self):
return self._number
def set_number(self, value):
self._number = value
number = property(get_number, set_number)

BIN
toxygen/images/group.png Executable file

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.0 KiB

View File

@ -475,6 +475,8 @@ class MainWindow(QtGui.QMainWindow):
def send_file(self):
self.menu.hide()
if not self.profile.is_active_a_friend():
return
if self.profile.active_friend + 1:
choose = QtGui.QApplication.translate("MainWindow", 'Choose file', None, QtGui.QApplication.UnicodeUTF8)
name = QtGui.QFileDialog.getOpenFileName(self, choose, options=QtGui.QFileDialog.DontUseNativeDialog)
@ -483,6 +485,8 @@ class MainWindow(QtGui.QMainWindow):
def send_screenshot(self, hide=False):
self.menu.hide()
if not self.profile.is_active_a_friend():
return
if self.profile.active_friend + 1:
self.sw = ScreenShotWindow(self)
self.sw.show()
@ -501,6 +505,8 @@ class MainWindow(QtGui.QMainWindow):
def send_sticker(self):
self.menu.hide()
if not self.profile.is_active_a_friend():
return
if self.profile.active_friend + 1:
self.sticker = StickerWindow(self)
self.sticker.setGeometry(QtCore.QRect(self.x() if Settings.get_instance()['mirror_mode'] else 270 + self.x(),

View File

@ -64,6 +64,7 @@ class Profile(basecontact.BaseContact, Singleton):
friend = Friend(i, message_getter, name, status_message, item, tox_id)
friend.set_alias(alias)
self._friends_and_gc.append(friend)
# TODO: list of gc
self.filtration(self._show_online)
# -----------------------------------------------------------------------------------------------------------------
@ -444,13 +445,14 @@ class Profile(basecontact.BaseContact, Singleton):
self.create_message_item(text, t, MESSAGE_OWNER['NOT_SENT'], message_type)
self._screen.messageEdit.clear()
self._messages.scrollToBottom()
friend_or_gc.append_message(TextMessage(text, MESSAGE_OWNER['NOT_SENT'], t, message_type))
else:
self.split_and_send(friend_or_gc.number, message_type, text.encode('utf-8'), True)
if friend_or_gc.number == self.get_active_number() and not self.is_active_a_friend():
self.create_message_item(text, t, MESSAGE_OWNER['ME'], message_type)
self._screen.messageEdit.clear()
self._messages.scrollToBottom()
friend_or_gc.append_message(TextMessage(text, MESSAGE_OWNER['NOT_SENT'], t, message_type))
friend_or_gc.append_message(TextMessage(text, MESSAGE_OWNER['ME'], t, message_type))
def delete_message(self, time):
friend = self._friends_and_gc[self._active_friend_or_gc]
@ -1234,7 +1236,7 @@ class Profile(basecontact.BaseContact, Singleton):
except Exception as ex: # something is wrong
log('Accept friend request failed! ' + str(ex))
message_getter = None
gc = GroupChat(self._tox, message_getter, num, name, topic, item, tox_id)
gc = GroupChat(self._tox, num, message_getter, name, topic, item, tox_id)
self._friends_and_gc.append(gc)
def create_gc(self, name, is_public, password):

View File

@ -1900,7 +1900,7 @@ class Tox:
buff = create_string_buffer(TOX_GROUP_CHAT_ID_SIZE)
result = Tox.libtoxcore.tox_group_get_chat_id(self._tox_pointer, groupnumber,
buff, byref(error))
return bin_to_string(buff[:TOX_GROUP_CHAT_ID_SIZE], TOX_GROUP_CHAT_ID_SIZE)
return bin_to_string(buff, TOX_GROUP_CHAT_ID_SIZE)
def group_get_number_groups(self):
"""