本文整理汇总了Python中pyotherside.send函数的典型用法代码示例。如果您正苦于以下问题:Python send函数的具体用法?Python send怎么用?Python send使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了send函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: reporthook
def reporthook(blocknum, blocksize, totalsize):
readsofar = blocknum * blocksize
if totalsize > 0:
percent = (readsofar * 1e2 / totalsize) / 2.
pyotherside.send("on-progress", percent)
else:
sys.stderr.write("read %d\n" % (readsofar,))
示例2: update_all_shows_episodes
def update_all_shows_episodes(self, show_list = []):
self.isUpdating = True
pyotherside.send('updating', self.isUpdating)
show_list = show_list or self.series_list
async_worker = AsyncWorker(False)
update_images_worker = AsyncWorker(True)
i = 0
n_shows = len(show_list)
for i in range(n_shows):
update_ended_shows = Settings().getConf(Settings.UPDATE_ENDED_SHOWS)
show = show_list[i]
if show.status and show.status == 'Ended' and not update_ended_shows:
async_item = AsyncItem(self._empty_callback, (),
self._set_show_episodes_complete_cb,
(show, update_images_worker, i == n_shows - 1))
async_worker.queue.put(async_item)
continue
pyotherside.send('episodesListUpdating', show.get_name())
show.set_updating(True)
async_item = AsyncItem(self.thetvdb.get_show_and_episodes,
(show.thetvdb_id, show.language,),
self._set_show_episodes_complete_cb,
(show, update_images_worker, i == n_shows - 1))
async_worker.queue.put(async_item)
async_item = AsyncItem(self._set_show_images,
(show,),
None,)
update_images_worker.queue.put(async_item)
async_worker.start()
return async_worker
示例3: exportBookmarkstoSailfishBrowser
def exportBookmarkstoSailfishBrowser(bookmarks, sPath):
bookmark_list = []
home = os.environ['HOME']
path = '/.local/share/'
browser = 'org.sailfishos/sailfish-browser/'
timestamp = str(datetime.datetime.now().timestamp())
backup = sPath + '/bookmarks.json.bak' + timestamp
try:
bookmark_obj = json.loads(bookmarks)
with open(home + path + browser + 'bookmarks.json', 'r') as f:
exist_bookmarks = json.load(f)
exist_urls = []
for ebm in exist_bookmarks:
bookmark_list.append(ebm)
exist_urls.append(ebm['url'])
for bm in bookmark_obj:
if bm['url'] not in exist_urls:
bookmark = {
'favicon': 'icon-launcher-bookmark',
'hasTouchIcon': False,
'title': bm['title'],
'url': bm['url']
}
bookmark_list.append(bookmark)
os.renames(home + path + browser + 'bookmarks.json', backup)
with open(home + path + browser + 'bookmarks.json', 'w') as f:
json.dump(bookmark_list, f)
except:
pyotherside.send(traceback.print_exc())
示例4: _send_defaults
def _send_defaults(self):
"""Send default configuration to QML."""
pyotherside.send("set-attribution", self.tilesource.attribution)
pyotherside.send("set-auto-center", poor.conf.auto_center)
pyotherside.send("set-gps-update-interval", poor.conf.gps_update_interval)
pyotherside.send("set-center", *poor.conf.center)
pyotherside.send("set-zoom-level", poor.conf.zoom)
示例5: _threadStatusCB
def _threadStatusCB(self, threadName, threadStatus):
# check if the event corresponds to some of the
# in-progress search threads
recipient = self._threadsInProgress.get(threadName)
if recipient:
statusId = SEARCH_STATUS_PREFIX + recipient
pyotherside.send(statusId, threadStatus)
示例6: _search_finished_callback
def _search_finished_callback(self, tvdbshows, error):
if not error:
for show_id, show in tvdbshows:
self._cached_tvdb_shows[show_id] = show
self.search_results.append(show)
self.searching = False
pyotherside.send('searching', self.searching)
示例7: download
def download(url):
'''Downloads specified file at specific url'''
u = req.urlopen(url)
if os.path.exists('retroarch_v1.0'):
return False
else:
with open('retroarch.zip', 'wb') as f:
meta = u.info()
meta_func = meta.getheaders if hasattr(meta, 'getheaders') else meta.get_all
meta_length = meta_func("Content-Length")
file_size = None
if meta_length:
file_size = int(meta_length[0])
file_size_dl = 0
block_sz = 8192
while True:
buff = u.read(block_sz)
if not buff:
break
file_size_dl += len(buff)
f.write(buff)
status = ""
if file_size:
status += "{0:6.2f}".format(file_size_dl * 100 / file_size)
status += chr(13)
pyotherside.send('download', status)
print('RetroArch was successfully downloaded')
return True
示例8: paxel
def paxel(url, name,output, blocks=8):
size = GetUrlFileSize( url )
ranges = SpliteBlocks( size, blocks )
threadname = [ "thread_%d" % i for i in range(0, blocks) ]
filename = [ "tmpfile_%d" % i for i in range(0, blocks) ]
tasks = []
for i in range(0,blocks):
task = AxelPython( threadname[i], url, filename[i], ranges[i] )
task.setDaemon( True )
task.start()
tasks.append( task )
time.sleep(1)
while islive(tasks):
downloaded = sum( [task.downloaded for task in tasks] )
process = downloaded/float(size)*100
pyotherside.send("progress",name,process)
time.sleep( 0.3 )
filehandle = open( output, 'wb+' )
for i in filename:
f = open( i, 'rb' )
filehandle.write( f.read() )
f.close()
try:
os.remove(i)
pass
except:
pass
filehandle.close()
示例9: set_watched
def set_watched(self, watched):
if (self.watched == watched):
return
self.watched = watched
pyotherside.send('watchedChanged', self.watched)
pyotherside.send('infoMarkupChanged')
SeriesManager().updated()
示例10: _update_tile
def _update_tile(self, tilesource, zoom, display_zoom, scale_factor, tile,
timestamp):
"""Download missing tile and ask QML to render it."""
key = tilesource.tile_key(tile)
item = self.tilecollection.get(key)
if item is not None:
return pyotherside.send("show-tile", item.uid)
path = tilesource.download(tile)
if path is None: return
uri = poor.util.path2uri(path) if os.path.isabs(path) else path
corners = tilesource.tile_corners(tile)
xmin, xmax, ymin, ymax = self._bbox
# Abort if map moved so that tile is no longer in view.
if xmax <= corners[2][0] or xmin >= corners[0][0]: return
if ymax <= corners[2][1] or ymin >= corners[0][1]: return
item = self.tilecollection.get_free(
key, path, xmin, xmax, ymin, ymax, display_zoom, corners)
pyotherside.send("render-tile", dict(display_zoom=display_zoom,
nex=corners[0][0],
nwx=corners[3][0],
nwy=corners[3][1],
scale=scale_factor*tilesource.scale,
half_zoom=tilesource.half_zoom,
smooth=tilesource.smooth,
swy=corners[2][1],
type=tilesource.type,
uid=item.uid,
uri=uri,
z=tilesource.z,
zoom=zoom))
示例11: run
def run(self):
self.must_run = True
while self.must_run:
sleep(0.1)
if get_presence_auth_user() is None:
save_auth_user = load_presence_auth_user()
logger.debug("No auth user set")
if save_auth_user is not None:
logger.debug("Try to set the last one: "+ str(save_auth_user))
if save_auth_user in [i['name'] for i in load_presences()]:
set_presence_auth_user(save_auth_user)
# emit signal to select the auth user the auth_user list
pyotherside.send('set_selected_auth_user', save_auth_user)
# Process received sms queue
if not recv_sms_q.empty():
new_sms = recv_sms_q.get()
status = self.sms_received(new_sms['phone_number'],
new_sms['message'])
if status:
recv_sms_q.task_done()
# Process sms to send queue
if not send_sms_q.empty():
new_sms = send_sms_q.get()
self.send_sms(new_sms['to'],
new_sms['message'])
send_sms_q.task_done()
logger.debug("Scheduler stopped")
示例12: getAuthorizationUrl
def getAuthorizationUrl():
try:
redirect_url = auth.get_authorization_url()
return redirect_url
except tweepy.TweepError:
pyotherside.send("Error! Failed to get request token.")
return ""
示例13: initialize
def initialize(self, progname):
assert self.core is None, 'Already initialized'
self.core = core.Core(progname=progname)
pyotherside.send('podcast-list-changed')
self.core.config.add_observer(self._config_option_changed)
示例14: unistall
def unistall(rpmname,version):
p = subprocess.Popen("pkcon remove "+rpmname,shell=True,stdout=subprocess.PIPE, stderr=subprocess.STDOUT)
#0则安装成功
retval = p.wait()
print("removed,",rpmname)
pyotherside.send("status","4",rpmname,version)
return p.returncode
示例15: set_title
def set_title(self, future=None):
title = get_conv_name(self.conv, show_unread=False,
truncate=True)
pyotherside.send('set-conversation-title', self.conv.id_, title, get_unread_messages_count(self.conv),
self.status_message)
if future:
future.result()