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


Python util.csv函数代码示例

本文整理汇总了Python中xpra.util.csv函数的典型用法代码示例。如果您正苦于以下问题:Python csv函数的具体用法?Python csv怎么用?Python csv使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


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

示例1: run

 def run(self, *args):
     if len(args)==1 and args[0]=="status":
         from xpra.log import get_all_loggers
         return "logging is enabled for: %s" % str(list([str(x) for x in get_all_loggers() if x.is_debug_enabled()]))
     if len(args)<2:
         self.raise_error("not enough arguments")
     log_cmd = args[0]
     if log_cmd not in ("enable", "disable"):
         self.raise_error("only 'enable' and 'disable' verbs are supported")
     #support both separate arguments and csv:
     categories = []
     for x in args[1:]:
         categories += [v.strip() for v in x.split(",")]
     from xpra.log import add_debug_category, add_disabled_category, enable_debug_for, disable_debug_for
     if log_cmd=="enable":
         add_debug_category(*categories)
         loggers = enable_debug_for(*categories)
     else:
         assert log_cmd=="disable"
         add_disabled_category(*categories)
         loggers = disable_debug_for(*categories)
     if not loggers:
         log.info("no loggers matching: %s", csv(categories))
     else:
         log.info("%sd debugging for: %s", log_cmd, csv(loggers))
     return "logging %sd for %s" % (log_cmd, csv(loggers))
开发者ID:svn2github,项目名称:Xpra,代码行数:26,代码来源:control_command.py

示例2: init_video_decoder_option

 def init_video_decoder_option(self, decoder_name):
     decoder_module = get_codec(decoder_name)
     log("init_video_decoder_option(%s)", decoder_name)
     log(" module=%s", decoder_module)
     if not decoder_module:
         log(" video decoder %s could not be loaded:", decoder_name)
         log(" %s", get_codec_error(decoder_name))
         return
     decoder_type = decoder_module.get_type()
     try:
         decoder_module.init_module()
         self._cleanup_modules.append(decoder_module)
     except Exception as e:
         log("exception in %s module initialization %s: %s", decoder_type, decoder_module.init_module, e, exc_info=True)
         log.warn("Warning: cannot use %s module %s: %s", decoder_type, decoder_module, e, exc_info=True)
         return
     encodings = decoder_module.get_encodings()
     log(" %s encodings=%s", decoder_type, csv(encodings))
     for encoding in encodings:
         colorspaces = decoder_module.get_input_colorspaces(encoding)
         log(" %s input colorspaces for %s: %s", decoder_type, encoding, csv(colorspaces))
         for colorspace in colorspaces:
             output_colorspace = decoder_module.get_output_colorspace(encoding, colorspace)
             log(" %s output colorspace for %s/%s: %s", decoder_type, encoding, colorspace, output_colorspace)
             try:
                 assert decoder_module.Decoder
                 self.add_decoder(encoding, colorspace, decoder_name, decoder_module)
             except Exception as e:
                 log.warn("failed to add decoder %s: %s", decoder_module, e)
开发者ID:svn2github,项目名称:Xpra,代码行数:29,代码来源:video_helper.py

示例3: select_clipboard_menu_option

 def select_clipboard_menu_option(self, item=None, label=None, labels=[]):
     #ensure that only the matching menu item is selected,
     #(can be specified as a menuitem object, or using its label)
     #all the other menu items whose labels are specified will be made inactive
     #(we use a flag to prevent reentry)
     clipboardlog("select_clipboard_menu_option(%s, %s, %s) clipboard_change_pending=%s", item, label, labels, self._clipboard_change_pending)
     if self._clipboard_change_pending:
         return None
     clipboard = self.get_menu("Clipboard")
     if not clipboard:
         log.error("Error: cannot locate Clipboard menu object!")
         return None
     all_items = [x for x in clipboard.get_submenu().get_children() if x.get_label() in labels]
     selected_items = [x for x in all_items if x==item] + [x for x in all_items if x.get_label()==label]
     if not selected_items:
         log.error("Error: cannot find any clipboard menu options to match '%s'", label)
         log.error(" all menu items: %s", csv(all_items))
         log.error(" selected: %s", csv(selected_items))
         return None
     self._clipboard_change_pending = True
     sel = selected_items[0]
     if not label:
         label = sel.get_label()
     for x in all_items:
         active = x.get_label()==label
         if x.get_active()!=active:
             x.set_active(active)
     self._clipboard_change_pending = False
     return label
开发者ID:svn2github,项目名称:Xpra,代码行数:29,代码来源:osx_menu.py

示例4: _print_file

 def _print_file(self, filename, mimetype, options):
     printer = options.strget("printer")
     title   = options.strget("title")
     copies  = options.intget("copies", 1)
     if title:
         printlog.info(" sending '%s' to printer '%s'", title, printer)
     else:
         printlog.info(" sending to printer '%s'", printer)
     from xpra.platform.printing import print_files, printing_finished, get_printers
     printers = get_printers()
     def delfile():
         if not DELETE_PRINTER_FILE:
             return
         try:
             os.unlink(filename)
         except:
             printlog("failed to delete print job file '%s'", filename)
         return False
     if not printer:
         printlog.error("Error: the printer name is missing")
         printlog.error(" printers available: %s", csv(printers.keys()) or "none")
         delfile()
         return
     if printer not in printers:
         printlog.error("Error: printer '%s' does not exist!", printer)
         printlog.error(" printers available: %s", csv(printers.keys()) or "none")
         delfile()
         return
     try:
         job_options = options.get("options")
         job_options["copies"] = copies
         job = print_files(printer, [filename], title, job_options)
     except Exception as e:
         printlog("print_files%s", (printer, [filename], title, options), exc_info=True)
         printlog.error("Error: cannot print file '%s'", os.path.basename(filename))
         printlog.error(" %s", e)
         delfile()
         return
     printlog("printing %s, job=%s", filename, job)
     if job<=0:
         printlog("printing failed and returned %i", job)
         delfile()
         return
     start = time.time()
     def check_printing_finished():
         done = printing_finished(job)
         printlog("printing_finished(%s)=%s", job, done)
         if done:
             delfile()
             return False
         if time.time()-start>10*60:
             printlog.warn("print job %s timed out", job)
             delfile()
             return False
         return True #try again..
     if check_printing_finished():
         self.timeout_add(10000, check_printing_finished)
开发者ID:svn2github,项目名称:Xpra,代码行数:57,代码来源:file_transfer.py

示例5: set_modules

 def set_modules(self, video_encoders=[], csc_modules=[], video_decoders=[]):
     assert not self._initialized, "too late to set modules, the helper is already initialized!"
     def filt(name, inlist, all_list):
         notfound = [x for x in inlist if x and x not in all_list]
         if notfound:
             log.warn("ignoring unknown %s: %s", name, ", ".join(notfound))
         return [x for x in inlist if x in all_list]
     self.video_encoders = filt("video encoders" , video_encoders,   ALL_VIDEO_ENCODER_OPTIONS)
     self.csc_modules    = filt("csc modules"    , csc_modules,      ALL_CSC_MODULE_OPTIONS)
     self.video_decoders = filt("video decoders" , video_decoders,   ALL_VIDEO_DECODER_OPTIONS)
     log("VideoHelper.set_modules(%s, %s, %s) video encoders=%s, csc=%s, video decoders=%s",
         csv(video_encoders), csv(csc_modules), csv(video_decoders), csv(self.video_encoders), csv(self.csc_modules), csv(self.video_decoders))
开发者ID:svn2github,项目名称:Xpra,代码行数:12,代码来源:video_helper.py

示例6: main

def main():
    global pygst_version, gst_version, gst_vinfo
    from xpra.platform import program_context
    from xpra.log import enable_color
    with program_context("GStreamer-Info", "GStreamer Information"):
        enable_color()
        if "-v" in sys.argv or "--verbose" in sys.argv:
            log.enable_debug()
        import_gst()
        print("Loaded Python GStreamer version %s for Python %s.%s" % (gst_vinfo, sys.version_info[0], sys.version_info[1]))
        apn = get_all_plugin_names()
        print("GStreamer plugins found: %s" % csv(apn))
        print("")
        print("GStreamer version: %s" % ".".join([str(x) for x in gst_version]))
        print("PyGStreamer version: %s" % ".".join([str(x) for x in pygst_version]))
        print("")
        encs = [x for x in CODEC_ORDER if has_encoder(x)]
        decs = [x for x in CODEC_ORDER if has_decoder(x)]
        print("encoders:           %s" % csv(encs))
        print("decoders:           %s" % csv(decs))
        print("muxers:             %s" % csv(get_muxers()))
        print("demuxers:           %s" % csv(get_demuxers()))
        print("stream compressors: %s" % csv(get_stream_compressors()))
        print("source plugins:     %s" % csv([x for x in get_source_plugins() if x in apn]))
        print("sink plugins:       %s" % csv([x for x in get_sink_plugins() if x in apn]))
        print("default sink:       %s" % get_default_sink())
开发者ID:svn2github,项目名称:Xpra,代码行数:26,代码来源:gstreamer_util.py

示例7: init_csc_options

 def init_csc_options(self):
     log("init_csc_options()")
     log(" will try csc modules: %s", csv(self.csc_modules))
     for x in self.csc_modules:
         try:
             mod = get_csc_module_name(x)
             self.init_csc_option(mod)
         except:
             log.warn("init_csc_options() cannot add %s csc", x, exc_info=True)
     log(" csc specs: %s", csv(self._csc_encoder_specs))
     for src_format, d in sorted(self._csc_encoder_specs.items()):
         log(" %s - %s options:", src_format, len(d))
         for dst_format, specs in sorted(d.items()):
             log("  * %s via: %s", dst_format, csv(sorted(spec.codec_type for spec in specs)))
开发者ID:svn2github,项目名称:Xpra,代码行数:14,代码来源:video_helper.py

示例8: get_client_backlog

 def get_client_backlog(self):
     packets_backlog, pixels_backlog, bytes_backlog = 0, 0, 0
     if len(self.damage_ack_pending)>0:
         sent_before = time.time()-(self.target_latency+0.020)
         dropped_acks_time = time.time()-60      #1 minute
         drop_missing_acks = []
         for sequence, (start_send_at, start_bytes, end_send_at, end_bytes, pixels) in self.damage_ack_pending.items():
             if end_send_at==0 or start_send_at>sent_before:
                 continue
             if start_send_at<dropped_acks_time:
                 drop_missing_acks.append(sequence)
             else:
                 packets_backlog += 1
                 pixels_backlog += pixels
                 bytes_backlog += (end_bytes - start_bytes)
         log("get_client_backlog missing acks: %s", drop_missing_acks)
         #this should never happen...
         if len(drop_missing_acks)>0:
             log.error("Error: expiring %i missing damage ACK%s,", len(drop_missing_acks), engs(drop_missing_acks))
             log.error(" connection may be closed or closing,")
             log.error(" sequence numbers missing: %s", csv(drop_missing_acks))
             for sequence in drop_missing_acks:
                 try:
                     del self.damage_ack_pending[sequence]
                 except:
                     pass
     return packets_backlog, pixels_backlog, bytes_backlog
开发者ID:ljmljz,项目名称:xpra,代码行数:27,代码来源:window_stats.py

示例9: enable_selections

 def enable_selections(self, selections):
     #when clients first connect or later through the "clipboard-enable-selections" packet,
     #they can tell us which clipboard selections they want enabled
     #(ie: OSX and win32 only use "CLIPBOARD" by default, and not "PRIMARY" or "SECONDARY")
     log("enabling selections: %s", csv(selections))
     for selection, proxy in self._clipboard_proxies.items():
         proxy.set_enabled(selection in selections)
开发者ID:svn2github,项目名称:Xpra,代码行数:7,代码来源:clipboard_base.py

示例10: filter_mappings

 def filter_mappings(mappings, drop_extra_keys=False):
     filtered = {}
     invalid_keysyms = set()
     for keycode, entries in mappings.items():
         mods = modifiers_for(entries)
         if len(mods)>1:
             log.warn("Warning: keymapping removed an invalid keycode entry:")
             log.warn(" keycode %s points to %i modifiers: %s", keycode, len(mods), csv(list(mods)))
             log.warn(" from definition: %s", csv(list(entries)))
             continue
         #now remove entries for keysyms we don't have:
         f_entries = set([(keysym, index) for keysym, index in entries if keysym and X11Keyboard.parse_keysym(keysym) is not None])
         for keysym, _ in entries:
             if keysym and X11Keyboard.parse_keysym(keysym) is None:
                 invalid_keysyms.add(keysym)
         if len(f_entries)==0:
             log("keymapping removed invalid keycode entry %s pointing to only unknown keysyms: %s", keycode, entries)
             continue
         if drop_extra_keys:
             noopt = [keysym for keysym, index in entries if (X11Keyboard.parse_keysym(keysym) is not None and keysym not in OPTIONAL_KEYS)]
             if len(noopt)==0:
                 log("keymapping removed keycode entry %s pointing to optional keys: %s", keycode, entries)
                 continue
         filtered[keycode] = f_entries
     if invalid_keysyms:
         log.warn("the following keysyms are invalid and have not been mapped: %s", ", ".join((str(x) for x in invalid_keysyms)))
     return filtered
开发者ID:svn2github,项目名称:Xpra,代码行数:27,代码来源:xkbhelper.py

示例11: get_layout_spec

 def get_layout_spec(self):
     layout = None
     layouts = []
     variant = None
     variants = None
     try:
         l = win32api.GetKeyboardLayoutList()
         log("win32api.GetKeyboardLayoutList()=%s", csv(hex(v) for v in l))
         for hkl in l:
             kbid = hkl & 0xffff
             if kbid in WIN32_LAYOUTS:
                 code, _, _, _, _layout, _variants = WIN32_LAYOUTS.get(kbid)
                 log("found keyboard layout '%s' with variants=%s, code '%s' for kbid=%i (%#x)", _layout, _variants, code, kbid, hkl)
                 if _layout not in layouts:
                     layouts.append(_layout)
     except Exception as e:
         log.error("Error: failed to detect keyboard layouts: %s", e)
     try:
         hkl = win32api.GetKeyboardLayout(0)
         log("win32api.GetKeyboardLayout(0)=%#x", hkl)
         kbid = hkl & 0xffff
         if kbid in WIN32_LAYOUTS:
             code, _, _, _, layout, variants = WIN32_LAYOUTS.get(kbid)
             log("found keyboard layout '%s' with variants=%s, code '%s' for kbid=%i (%#x)", layout, variants, code, kbid, hkl)
         if not layout:
             log("unknown keyboard layout for kbid: %i (%#x)", kbid, hkl)
         else:
             layouts.append(layout)
     except Exception as e:
         log.error("Error: failed to detect keyboard layout: %s", e)
     return layout,layouts,variant,variants
开发者ID:svn2github,项目名称:Xpra,代码行数:31,代码来源:keyboard.py

示例12: stop

 def stop(self):
     log("BonjourPublishers.stop(): %s" % csv(self.publishers))
     for publisher in self.publishers:
         try:
             publisher.stop()
         except Exception as e:
             log.error("Error stopping publisher %s:", publisher)
             log.error(" %s" % publisher, e)
开发者ID:svn2github,项目名称:Xpra,代码行数:8,代码来源:pybonjour_publisher.py

示例13: get_keymap_spec

 def get_keymap_spec(self):
     _print, query, query_struct = self.keyboard.get_keymap_spec()
     if self.layout_option:
         query_struct["layout"] = self.layout_option
     if self.layouts_option:
         query_struct["layouts"] = csv(self.layouts_option)
     if self.variant_option:
         query_struct["variant"] = self.variant_option
     if self.variants_option:
         query_struct["variants"] = csv(self.variants_option)
     if self.options:
         if self.options.lower()=="none":
             query_struct["options"] = ""
         else:
             query_struct["options"] = self.options
     if self.layout_option or self.layouts_option or self.variant_option or self.variants_option or self.options:
         query = xkbmap_query_tostring(query_struct)
     return _print, query, query_struct
开发者ID:svn2github,项目名称:Xpra,代码行数:18,代码来源:keyboard_helper.py

示例14: init_video_encoders_options

 def init_video_encoders_options(self):
     log("init_video_encoders_options()")
     log(" will try video encoders: %s", csv(self.video_encoders))
     for x in self.video_encoders:
         try:
             mods = get_encoder_module_names(x)
             log(" modules for %s: %s", x, csv(mods))
             for mod in mods:
                 try:
                     self.init_video_encoder_option(mod)
                     break
                 except Exception as e:
                     log(" init_video_encoder_option(%s) error", mod, exc_info=True)
                     log.warn("Warning: cannot load %s video encoder:", mod)
                     log.warn(" %s", e)
         except Exception as e:
             log.warn("Warning: cannot add %s encoder: %s", x, e)
     log("found %i video encoder%s: %s", len(self._video_encoder_specs), engs(self._video_encoder_specs), csv(self._video_encoder_specs))
开发者ID:svn2github,项目名称:Xpra,代码行数:18,代码来源:video_helper.py

示例15: init_video_decoders_options

 def init_video_decoders_options(self):
     log("init_video_decoders_options()")
     log(" will try video decoders: %s", csv(self.video_decoders))
     for x in self.video_decoders:
         try:
             mod = get_decoder_module_name(x)
             self.init_video_decoder_option(mod)
         except:
             log.warn("Warning: cannot add %s decoder", x, exc_info=True)
     log("found %s video decoder%s: %s", len(self._video_decoder_specs), engs(self._video_decoder_specs), csv(self._video_decoder_specs))
开发者ID:svn2github,项目名称:Xpra,代码行数:10,代码来源:video_helper.py


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