def on_open(widget, file_props): dialog.destroy() 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) self.tree.get_selection().unselect_all()
def on_open(widget, file_props): dialog.destroy() if 'file-name' not in file_props: return (path, file) = os.path.split(file_props['file-name']) if os.path.exists(path) and os.path.isdir(path): helpers.launch_file_manager(path) self.tree.get_selection().unselect_all()
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)
def on_open_folder_menuitem_activate(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].decode('utf-8') file_props = self.files_props[sid[0]][sid[1:]] if not file_props.has_key('file-name'): return (path, file) = os.path.split(file_props['file-name']) if os.path.exists(path) and os.path.isdir(path): helpers.launch_file_manager(path)
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][Column.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)
def on_open_folder_menuitem_activate(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].decode('utf-8') file_props = self.files_props[sid[0]][sid[1:]] if 'file-name' not in file_props: return (path, file) = os.path.split(file_props['file-name']) if os.path.exists(path) and os.path.isdir(path): helpers.launch_file_manager(path)
def show_completed(self, jid, file_props): ''' show a dialog saying that file (file_props) has been transferred''' self.window.present() self.window.window.focus() if file_props['type'] == 'r': # file path is used below in 'Save in' (file_path, file_name) = os.path.split(file_props['file-name']) else: file_name = file_props['name'] sectext = '\t' + _('Filename: %s') % \ gtkgui_helpers.escape_for_pango_markup(file_name) sectext += '\n\t' + _('Size: %s') % \ helpers.convert_bytes(file_props['size']) if file_props['type'] == 'r': jid = unicode(file_props['sender']).split('/')[0] sender_name = gajim.get_first_contact_instance_from_jid( file_props['tt_account'], jid).name sender = gtkgui_helpers.escape_for_pango_markup(sender_name) else: #You is a reply of who sent a file sender = _('You') sectext += '\n\t' +_('Sender: %s') % sender sectext += '\n\t' +_('Recipient: ') if file_props['type'] == 's': jid = unicode(file_props['receiver']).split('/')[0] receiver_name = gajim.get_first_contact_instance_from_jid( file_props['tt_account'], jid).name recipient = gtkgui_helpers.escape_for_pango_markup(receiver_name) else: #You is a reply of who received a file recipient = _('You') sectext += recipient if file_props['type'] == 'r': sectext += '\n\t' +_('Saved in: %s') % \ gtkgui_helpers.escape_for_pango_markup(file_path) dialog = dialogs.HigDialog(None, gtk.MESSAGE_INFO, gtk.BUTTONS_NONE, _('File transfer completed'), sectext) if file_props['type'] == 'r': dialog.add_buttons(_('_Open Containing Folder'), gtk.RESPONSE_ACCEPT) dialog.add_buttons(gtk.STOCK_OK, gtk.RESPONSE_OK) dialog.show_all() response = dialog.run() dialog.destroy() if response == gtk.RESPONSE_ACCEPT: if not file_props.has_key('file-name'): return (path, file) = os.path.split(file_props['file-name']) if os.path.exists(path) and os.path.isdir(path): helpers.launch_file_manager(path) self.tree.get_selection().unselect_all()
def on_open_menuitem_activate(self, menu, data): filepath = data["filepath"] helpers.launch_file_manager(filepath)