本文整理汇总了Python中stream.Stream.is_online方法的典型用法代码示例。如果您正苦于以下问题:Python Stream.is_online方法的具体用法?Python Stream.is_online怎么用?Python Stream.is_online使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类stream.Stream
的用法示例。
在下文中一共展示了Stream.is_online方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: add_link
# 需要导入模块: from stream import Stream [as 别名]
# 或者: from stream.Stream import is_online [as 别名]
def add_link( self, url ):
"""
Adds a link to the link widget.
Only adds if its not already present.
"""
if url not in self.links:
self.links.add( url )
rowCounts = self.links_ui.rowCount()
nextRow = rowCounts + 1
nextPosition = rowCounts # row count is the length, but position is zero-based
self.links_ui.setRowCount( nextRow )
urlEntry = QTableWidgetItem( url )
statusEntry = QTableWidgetItem( '' )
statusEntry.setTextAlignment( Qt.AlignCenter )
urlEntry.setFlags( urlEntry.flags() & ~Qt.ItemIsEditable ) # not editable
statusEntry.setFlags( statusEntry.flags() & ~Qt.ItemIsEditable ) # not editable
self.links_ui.setItem( nextPosition, 0, urlEntry )
self.links_ui.setItem( nextPosition, 1, statusEntry )
# check if online
stream = Stream( url.split() )
stream.is_online( statusEntry )
示例2: check_if_online
# 需要导入模块: from stream import Stream [as 别名]
# 或者: from stream.Stream import is_online [as 别名]
def check_if_online( self ):
"""
Check if any of the streams saved is online
"""
for row in range( self.links_ui.rowCount() ):
urlItem = self.links_ui.item( row, 0 )
statusItem = self.links_ui.item( row, 1 )
url = urlItem.text()
splitUrl = url.split()
stream = Stream( splitUrl )
stream.is_online( statusItem )