当前位置: 首页>>代码示例>>Python>>正文


Python FilesProp.getFilePropByType方法代码示例

本文整理汇总了Python中common.file_props.FilesProp.getFilePropByType方法的典型用法代码示例。如果您正苦于以下问题:Python FilesProp.getFilePropByType方法的具体用法?Python FilesProp.getFilePropByType怎么用?Python FilesProp.getFilePropByType使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在common.file_props.FilesProp的用法示例。


在下文中一共展示了FilesProp.getFilePropByType方法的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: on_remove_menuitem_activate

# 需要导入模块: from common.file_props import FilesProp [as 别名]
# 或者: from common.file_props.FilesProp import getFilePropByType [as 别名]
 def on_remove_menuitem_activate(self, widget):
     selected = self.tree.get_selection().get_selected()
     if not selected or not selected[1]:
         return
     s_iter = selected[1]
     sid = self.model[s_iter][C_SID]
     file_props = FilesProp.getFilePropByType(sid[0], sid[1:])
     self._remove_transfer(s_iter, sid, file_props)
     self.set_all_insensitive()
开发者ID:irl,项目名称:gajim,代码行数:11,代码来源:filetransfers_window.py

示例2: on_cleanup_button_clicked

# 需要导入模块: from common.file_props import FilesProp [as 别名]
# 或者: from common.file_props.FilesProp import getFilePropByType [as 别名]
 def on_cleanup_button_clicked(self, widget):
     i = len(self.model) - 1
     while i >= 0:
         iter_ = self.model.get_iter((i))
         sid = self.model[iter_][C_SID]
         file_props = FilesProp.getFilePropByType(sid[0], sid[1:])
         if is_transfer_stopped(file_props):
             self._remove_transfer(iter_, sid, file_props)
         i -= 1
     self.tree.get_selection().unselect_all()
     self.set_all_insensitive()
开发者ID:irl,项目名称:gajim,代码行数:13,代码来源:filetransfers_window.py

示例3: on_open_folder_menuitem_activate

# 需要导入模块: from common.file_props import FilesProp [as 别名]
# 或者: from common.file_props.FilesProp import getFilePropByType [as 别名]
 def on_open_folder_menuitem_activate(self, widget):
     selected = self.tree.get_selection().get_selected()
     if not selected or not selected[1]:
         return
     s_iter = selected[1]
     sid = self.model[s_iter][C_SID]
     file_props = FilesProp.getFilePropByType(sid[0], sid[1:])
     if not file_props.file_name:
         return
     path = os.path.split(file_props.file_name)[0]
     if os.path.exists(path) and os.path.isdir(path):
         helpers.launch_file_manager(path)
开发者ID:irl,项目名称:gajim,代码行数:14,代码来源:filetransfers_window.py

示例4: on_cancel_button_clicked

# 需要导入模块: from common.file_props import FilesProp [as 别名]
# 或者: from common.file_props.FilesProp import getFilePropByType [as 别名]
 def on_cancel_button_clicked(self, widget):
     selected = self.tree.get_selection().get_selected()
     if selected is None or selected[1] is None:
         return
     s_iter = selected[1]
     sid = self.model[s_iter][C_SID]
     file_props = FilesProp.getFilePropByType(sid[0], sid[1:])
     account = file_props.tt_account
     if account not in gajim.connections:
         return
     con = gajim.connections[account]
     # Check if we are in a IBB transfer
     if file_props.direction:
         con.CloseIBBStream(file_props)
     con.disconnect_transfer(file_props)
     self.set_status(file_props, 'stop')
开发者ID:irl,项目名称:gajim,代码行数:18,代码来源:filetransfers_window.py

示例5: on_pause_restore_button_clicked

# 需要导入模块: from common.file_props import FilesProp [as 别名]
# 或者: from common.file_props.FilesProp import getFilePropByType [as 别名]
 def on_pause_restore_button_clicked(self, widget):
     selected = self.tree.get_selection().get_selected()
     if selected is None or selected[1] is None:
         return
     s_iter = selected[1]
     sid = self.model[s_iter][C_SID]
     file_props = FilesProp.getFilePropByType(sid[0], sid[1:])
     if is_transfer_paused(file_props):
         file_props.last_time = time.time()
         file_props.paused = False
         types = {'r' : 'download', 's' : 'upload'}
         self.set_status(file_props, types[sid[0]])
         self.toggle_pause_continue(True)
         if file_props.continue_cb:
             file_props.continue_cb()
     elif is_transfer_active(file_props):
         file_props.paused = True
         self.set_status(file_props, 'pause')
         # reset that to compute speed only when we resume
         file_props.transfered_size = []
         self.toggle_pause_continue(False)
开发者ID:irl,项目名称:gajim,代码行数:23,代码来源:filetransfers_window.py

示例6: set_buttons_sensitive

# 需要导入模块: from common.file_props import FilesProp [as 别名]
# 或者: from common.file_props.FilesProp import getFilePropByType [as 别名]
 def set_buttons_sensitive(self, path, is_row_selected):
     """
     Make buttons/menuitems sensitive as appropriate to the state of file
     transfer located at path 'path'
     """
     if path is None:
         self.set_all_insensitive()
         return
     current_iter = self.model.get_iter(path)
     sid = self.model[current_iter][C_SID]
     file_props = FilesProp.getFilePropByType(sid[0], sid[1:])
     self.remove_menuitem.set_sensitive(is_row_selected)
     self.open_folder_menuitem.set_sensitive(is_row_selected)
     is_stopped = False
     if is_transfer_stopped(file_props):
         is_stopped = True
     self.cancel_button.set_sensitive(not is_stopped)
     self.cancel_menuitem.set_sensitive(not is_stopped)
     if not is_row_selected:
         # no selection, disable the buttons
         self.set_all_insensitive()
     elif not is_stopped:
         if is_transfer_active(file_props):
             # file transfer is active
             self.toggle_pause_continue(True)
             self.pause_button.set_sensitive(True)
         elif is_transfer_paused(file_props):
             # file transfer is paused
             self.toggle_pause_continue(False)
             self.pause_button.set_sensitive(True)
         else:
             self.pause_button.set_sensitive(False)
             self.pause_menuitem.set_sensitive(False)
             self.continue_menuitem.set_sensitive(False)
     else:
         self.pause_button.set_sensitive(False)
         self.pause_menuitem.set_sensitive(False)
         self.continue_menuitem.set_sensitive(False)
     return True
开发者ID:irl,项目名称:gajim,代码行数:41,代码来源:filetransfers_window.py

示例7: show_tooltip

# 需要导入模块: from common.file_props import FilesProp [as 别名]
# 或者: from common.file_props.FilesProp import getFilePropByType [as 别名]
 def show_tooltip(self, widget):
     self.tooltip.timeout = 0
     if self.height_diff == 0:
         self.tooltip.hide_tooltip()
         return
     pointer = self.tree.get_pointer()
     props = self.tree.get_path_at_pos(pointer[0],
             pointer[1] - self.height_diff)
     # check if the current pointer is at the same path
     # as it was before setting the timeout
     if props and self.tooltip.id == props[0]:
         iter_ = self.model.get_iter(props[0])
         sid = self.model[iter_][C_SID].decode('utf-8')
         file_props = FilesProp.getFilePropByType(sid[0], sid[1:])
         # bounding rectangle of coordinates for the cell within the treeview
         rect = self.tree.get_cell_area(props[0], props[1])
         # position of the treeview on the screen
         position = widget.window.get_origin()
         self.tooltip.show_tooltip(file_props, rect.height,
                                                 position[1] + rect.y + self.height_diff)
     else:
         self.tooltip.hide_tooltip()
开发者ID:jabber-at,项目名称:gajim,代码行数:24,代码来源:filetransfers_window.py

示例8: on_transfers_list_motion_notify_event

# 需要导入模块: from common.file_props import FilesProp [as 别名]
# 或者: from common.file_props.FilesProp import getFilePropByType [as 别名]
 def on_transfers_list_motion_notify_event(self, widget, event):
     pointer = self.tree.get_pointer()
     props = widget.get_path_at_pos(int(event.x), int(event.y))
     self.height_diff = pointer[1] - int(event.y)
     if self.tooltip.timeout > 0 or self.tooltip.shown:
         if not props or self.tooltip.id != props[0]:
             self.tooltip.hide_tooltip()
     if props:
         row = props[0]
         iter_ = None
         try:
             iter_ = self.model.get_iter(row)
         except Exception:
             self.tooltip.hide_tooltip()
             return
         sid = self.model[iter_][C_SID].decode('utf-8')
         file_props = FilesProp.getFilePropByType(sid[0], sid[1:])
         if file_props is not None:
             if self.tooltip.timeout == 0 or self.tooltip.id != props[0]:
                 self.tooltip.id = row
                 self.tooltip.timeout = gobject.timeout_add(500,
                         self.show_tooltip, widget)
开发者ID:jabber-at,项目名称:gajim,代码行数:24,代码来源:filetransfers_window.py

示例9: on_transfers_list_motion_notify_event

# 需要导入模块: from common.file_props import FilesProp [as 别名]
# 或者: from common.file_props.FilesProp import getFilePropByType [as 别名]
 def on_transfers_list_motion_notify_event(self, widget, event):
     w = self.tree.get_window()
     device = w.get_display().get_device_manager().get_client_pointer()
     pointer = w.get_device_position(device)
     props = widget.get_path_at_pos(int(event.x), int(event.y))
     self.height_diff = pointer[2] - int(event.y)
     if self.tooltip.timeout > 0:
         if not props or self.tooltip.id != props[0]:
             self.tooltip.hide_tooltip()
     if props:
         row = props[0]
         iter_ = None
         try:
             iter_ = self.model.get_iter(row)
         except Exception:
             self.tooltip.hide_tooltip()
             return
         sid = self.model[iter_][C_SID]
         file_props = FilesProp.getFilePropByType(sid[0], sid[1:])
         if file_props is not None:
             if self.tooltip.timeout == 0 or self.tooltip.id != props[0]:
                 self.tooltip.id = row
                 self.tooltip.timeout = GLib.timeout_add(500,
                     self.show_tooltip, widget)
开发者ID:irl,项目名称:gajim,代码行数:26,代码来源:filetransfers_window.py

示例10: set_progress

# 需要导入模块: from common.file_props import FilesProp [as 别名]
# 或者: from common.file_props.FilesProp import getFilePropByType [as 别名]
    def set_progress(self, typ, sid, transfered_size, iter_=None):
        """
        Change the progress of a transfer with new transfered size
        """
        file_props = FilesProp.getFilePropByType(typ, sid)
        full_size = file_props.size
        if full_size == 0:
            percent = 0
        else:
            percent = round(float(transfered_size) / full_size * 100, 1)
        if iter_ is None:
            iter_ = self.get_iter_by_sid(typ, sid)
        if iter_ is not None:
            just_began = False
            if self.model[iter_][C_PERCENT] == 0 and int(percent > 0):
                just_began = True
            text = self._format_percent(percent)
            if transfered_size == 0:
                text += '0'
            else:
                text += helpers.convert_bytes(transfered_size)
            text += '/' + helpers.convert_bytes(full_size)
            # Kb/s

            # remaining time
            if file_props.offset:
                transfered_size -= file_props.offset
                full_size -= file_props.offset

            if file_props.elapsed_time > 0:
                file_props.transfered_size.append((file_props.last_time, transfered_size))
            if len(file_props.transfered_size) > 6:
                file_props.transfered_size.pop(0)
            eta, speed = self._get_eta_and_speed(full_size, transfered_size,
                    file_props)

            self.model.set(iter_, C_PROGRESS, text)
            self.model.set(iter_, C_PERCENT, int(percent))
            text = self._format_time(eta)
            text += '\n'
            #This should make the string Kb/s,
            #where 'Kb' part is taken from %s.
            #Only the 's' after / (which means second) should be translated.
            text += _('(%(filesize_unit)s/s)') % {'filesize_unit':
                    helpers.convert_bytes(speed)}
            self.model.set(iter_, C_TIME, text)

            # try to guess what should be the status image
            if file_props.type_ == 'r':
                status = 'download'
            else:
                status = 'upload'
            if file_props.paused == True:
                status = 'pause'
            elif file_props.stalled == True:
                status = 'waiting'
            if file_props.connected == False:
                status = 'stop'
            self.model.set(iter_, 0, self.get_icon(status))
            if transfered_size == full_size:
                # If we are receiver and this is a jingle session
                if file_props.type_ == 'r' and  \
                      file_props.session_type == 'jingle' and file_props.hash_:
                    # Show that we are computing the hash
                    self.set_status(file_props, 'computing')
                else:
                    self.set_status(file_props, 'ok')
            elif just_began:
                path = self.model.get_path(iter_)
                self.select_func(path)
开发者ID:irl,项目名称:gajim,代码行数:72,代码来源:filetransfers_window.py


注:本文中的common.file_props.FilesProp.getFilePropByType方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。