コード例 #1
0
 def _prepare_history(self):
     '''clean up ouput'''
     self.nicebar.empty_queue()
     if self.contact:
         his_picture = self.contact.picture or utils.path_to_url(os.path.abspath(gui.theme.image_theme.user))
         my_picture = self.session.contacts.me.picture or utils.path_to_url(os.path.abspath(gui.theme.image_theme.user))
         self.text.clear(self.account, self.contact.nick, self.contact.display_name, my_picture, his_picture)
     else:
         self.text.clear()
コード例 #2
0
 def refresh_history(self):
     '''refresh the history according to the values on the calendars
     '''
     if self.contact:
         his_picture = self.contact.picture or utils.path_to_url(os.path.abspath(gui.theme.user))
         my_picture = self.session.contacts.me.picture or utils.path_to_url(os.path.abspath(gui.theme.user))
         self.text.clear(self.account, self.contact.nick, self.contact.display_name, my_picture, his_picture)
     else:
         self.text.clear()
     self.request_chats_between(1000, self._on_chats_ready)
コード例 #3
0
 def refresh_history(self):
     '''refresh the history according to the values on the calendars
     '''
     if self.contact:
         his_picture = self.contact.picture or utils.path_to_url(os.path.abspath(gui.theme.user))
         my_picture = self.session.contacts.me.picture or utils.path_to_url(os.path.abspath(gui.theme.user))
         self.text.clear(self.account, self.contact.nick, self.contact.display_name, my_picture, his_picture)
     else:
         self.text.clear()
     self.request_chats_between(1000, self._on_chats_ready)
コード例 #4
0
 def _prepare_history(self):
     '''clean up ouput'''
     self.nicebar.empty_queue()
     if self.contact:
         his_picture = self.contact.picture or utils.path_to_url(
             os.path.abspath(gui.theme.image_theme.user))
         my_picture = self.session.contacts.me.picture or utils.path_to_url(
             os.path.abspath(gui.theme.image_theme.user))
         self.text.clear(self.account, self.contact.nick,
                         self.contact.display_name, my_picture, his_picture)
     else:
         self.text.clear()
コード例 #5
0
ファイル: data.py プロジェクト: siweimei/backendcode
 def create_user(self, **json):
     # with (yield self.db.db()) as db:
     Rules.rule_usercreate(**json)
     account = json['account']
     #账户查重
     cnk_SQL = SQL_refector.user_get(account)
     cnk_res = yield self.db.query_one(cnk_SQL)
     if cnk_res:
         raise RuntimeError(errors.ACCOUNT_ALREADY_EXIST)
     account_hash = static.get_hash(account)
     table_num = str(static.get_table_num(account_hash))
     json['uid'] = account_hash
     json['tbn'] = static.USER_TABLE_BASE_NAME+'_'+str(table_num)
     #头像处理
     portrait_base64=json.get('portrait', None)
     if portrait_base64:
         path = os.path.join(static.config.PORTRAIT_PATH, table_num)
         filename = str(account_hash)+'.png'
         photopathname = utils.load_picture(path, filename, portrait_base64)
         photourl = utils.path_to_url(static.config.DATA_PATH, photopathname)
         json['photo_url'] = photourl
     #为birth添加默认值
     if len(json.get('birth', '')) < 3:
         json['birth']='1900-01-01'
         json['age'] = '0'
     SQL = SQL_refector.user_insert(**json)
     effect_row = yield self.db.execute(SQL)
     nickname = json.get('nickname', None)
     uid = json.get('uid', None)
     account = json.get('account', None)
     raise gen.Return((uid, nickname, account))
コード例 #6
0
ファイル: AdiumTextBox.py プロジェクト: 19MiRkO91/emesene
 def clear(self, source="", target="", target_display="", source_img="", target_img=""):
     """clear the content"""
     body = self.theme.get_body(source, target, target_display, source_img, target_img)
     self.load_string(body, "text/html", "utf-8", utils.path_to_url(self.theme.path))
     self.pending = []
     self.ready = False
     self.last_incoming = None
コード例 #7
0
ファイル: AdiumTextBox.py プロジェクト: AmiZya/emesene
 def clear(self, source="", target="", target_display="",
         source_img="", target_img=""):
     '''clear the content'''
     body = self.theme.get_body(source, target, target_display, source_img,
             target_img)
     self.delayed_call(self._load_string, body,
             "text/html", "utf-8", utils.path_to_url(self.theme.path))
コード例 #8
0
ファイル: AdiumTextBox.py プロジェクト: pedrolinhares/emesene
 def clear(self, source="", target="", target_display="",
         source_img="", target_img=""):
     '''clear the content'''
     body = self.theme.get_body(source, target, target_display, source_img,
             target_img)
     self.load_string(body,
             "text/html", "utf-8", utils.path_to_url(self.theme.path))
     self.pending = []
     self.ready = False
     self.last_incoming = None
コード例 #9
0
 def clear(self,
           source="",
           target="",
           target_display="",
           source_img="",
           target_img=""):
     '''clear the content'''
     body = self.theme.get_body(source, target, target_display, source_img,
                                target_img)
     self.delayed_call(self._load_string, body, "text/html", "utf-8",
                       utils.path_to_url(self.theme.path))
コード例 #10
0
ファイル: AdiumTextBox.py プロジェクト: hermanschmidt/emesene
    def __init__(self, config, add_emoticon_cb):
        """constructor"""
        gtk.ScrolledWindow.__init__(self)

        self.config = config

        self.set_policy(gtk.POLICY_AUTOMATIC, gtk.POLICY_AUTOMATIC)
        self.set_shadow_type(gtk.SHADOW_IN)
        self.loaded = False
        picture = utils.path_to_url(os.path.abspath(gui.theme.image_theme.user))

        self.view = OutputView(gui.theme.conv_theme, "", "", "", picture, picture, add_emoticon_cb)
        self.clear()
        self.view.show()
        self.add(self.view)
コード例 #11
0
ファイル: AdiumTextBox.py プロジェクト: EchoUSB/emesene
    def __init__(self, config, add_emoticon_cb):
        '''constructor'''
        gtk.ScrolledWindow.__init__(self)

        self.config = config

        self.set_policy(gtk.POLICY_AUTOMATIC, gtk.POLICY_AUTOMATIC)
        self.set_shadow_type(gtk.SHADOW_IN)
        self._texts = []
        self.loaded = False
        picture = utils.path_to_url(os.path.abspath(gui.theme.user))

        self.view = OutputView(gui.theme.conv_theme, "", "", "", picture,
                picture, add_emoticon_cb)
        self.view.connect('load-finished', self._loading_stop_cb)
        self.view.connect('console-message', self._error_cb)
        self.clear()
        self.view.show()
        self.add(self.view)
コード例 #12
0
ファイル: AdiumTextBox.py プロジェクト: pedrolinhares/emesene
    def __init__(self, config):
        '''constructor'''
        gtk.ScrolledWindow.__init__(self)

        self.config = config

        self.set_policy(gtk.POLICY_AUTOMATIC, gtk.POLICY_AUTOMATIC)
        self.set_shadow_type(gtk.SHADOW_IN)
        self._texts = []
        self.loaded = False
        picture = utils.path_to_url(os.path.abspath(gui.theme.user))

        self.view = OutputView(gui.theme.conv_theme, "", "", "", picture,
                picture)
        self.view.connect('load-finished', self._loading_stop_cb)
        self.view.connect('console-message', self._error_cb)
        self.clear()
        self.view.show()
        self.add(self.view)
コード例 #13
0
ファイル: Conversation.py プロジェクト: MechanisM/emesene
    def __init__(self, session, cid, update_win, tab_label, members=None):
        '''constructor'''
        gtk.VBox.__init__(self)
        gui.Conversation.__init__(self, session, cid, update_win, members)
        self.set_border_width(2)

        self.typing_timeout = None
        self.tab_label = tab_label

        self._header_visible = session.config.b_show_header
        self._image_visible = session.config.b_show_info
        self._toolbar_visible = session.config.b_show_toolbar

        self.panel = gtk.VPaned()

        self.show_avatar_in_taskbar = self.session.config.get_or_set(
                                                    'b_show_avatar_in_taskbar',
                                                    True)

        Header = extension.get_default('conversation header')
        OutputText = extension.get_default('conversation output')
        InputText = extension.get_default('conversation input')
        ContactInfo = extension.get_default('conversation info')
        ConversationToolbar = extension.get_default(
            'conversation toolbar')
        TransfersBar = extension.get_default('filetransfer pool')
        CallWidget = extension.get_default('call widget')

        self.below_conversation = None
        BelowConversation = extension.get_default('below conversation')
        if BelowConversation is not None:
            self.below_conversation = BelowConversation(self, session)

        self.header = Header(session, members)
        toolbar_handler = gui.base.ConversationToolbarHandler(self.session,
            gui.theme, self)
        self.toolbar = ConversationToolbar(toolbar_handler, self.session)
        self.toolbar.set_property('can-focus', False)
        outputview_handler = gui.base.OutputViewHandler(self)
        self.output = OutputText(self.session.config, outputview_handler)
        if self.session.conversation_start_locked:
            self.output.lock()

        self.output.set_size_request(-1, 30)
        self.input = InputText(self.session, self._on_send_message,
                               self.cycle_history, self.on_drag_data_received,
                               self._send_typing_notification)
        self.output.set_size_request(-1, 25)
        self.input.set_size_request(-1, 25)
        self.info = ContactInfo(self.session, self.members)
        self.transfers_bar = TransfersBar(self.session)
        self.call_widget = CallWidget(self.session)

        frame_input = gtk.Frame()
        frame_input.set_shadow_type(gtk.SHADOW_IN)

        input_box = gtk.VBox()
        input_box.pack_start(self.toolbar, False)
        input_box.pack_start(self.input, True, True)

        frame_input.add(input_box)

        self.panel.pack1(self.output, True, False)
        self.panel.pack2(frame_input, False, False)

        if not check_gtk3():
            self.panel_signal_id = self.panel.connect_after('expose-event',
                    self.update_panel_position)
        else:
            self.panel_signal_id = self.panel.connect_after('draw',
                    self.update_panel_position)
        self.panel.connect('button-release-event', self.on_input_panel_resize)

        self.hbox = gtk.HBox()
        if self.session.config.get_or_set('b_avatar_on_left', False):
            self.hbox.pack_start(self.info, False)
            self.hbox.pack_start(self.panel, True, True)
        else:
            self.hbox.pack_start(self.panel, True, True)
            self.hbox.pack_start(self.info, False)

        self.pack_start(self.header, False)
        self.pack_start(self.hbox, True, True)
        self.pack_start(self.transfers_bar, False)
        if self.below_conversation is not None:
            self.pack_start(self.below_conversation, False)

        if len(self.members) == 0:
            self.header.information = ('connecting', 'creating conversation')
        else:
            #update adium theme header/footer
            account = self.members[0]
            contact = self.session.contacts.safe_get(account)
            his_picture = contact.picture or utils.path_to_url(os.path.abspath(gui.theme.image_theme.user))
            nick = contact.nick
            display_name = contact.display_name
            self.set_sensitive(not contact.blocked, True)
            my_picture = self.session.contacts.me.picture or utils.path_to_url(os.path.abspath(gui.theme.image_theme.user))
            self.output.clear(account, nick, display_name, 
                              my_picture, his_picture)

        self._load_style()
        self.subscribe_signals()
        extension.subscribe(self.on_below_conversation_changed, 'below conversation')
        extension.subscribe(self.on_conversation_info_extension_changed, 'conversation info')

        self.tab_index = -1 # used to select an existing conversation