本文整理汇总了Python中scc.osd.OSDWindow.parse_argumets方法的典型用法代码示例。如果您正苦于以下问题:Python OSDWindow.parse_argumets方法的具体用法?Python OSDWindow.parse_argumets怎么用?Python OSDWindow.parse_argumets使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类scc.osd.OSDWindow
的用法示例。
在下文中一共展示了OSDWindow.parse_argumets方法的11个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: parse_argumets
# 需要导入模块: from scc.osd import OSDWindow [as 别名]
# 或者: from scc.osd.OSDWindow import parse_argumets [as 别名]
def parse_argumets(self, argv):
if not OSDWindow.parse_argumets(self, argv):
return False
if not self.config:
self.config = Config()
try:
self.items = MenuData.from_args(self.args.items)
self._menuid = None
except ValueError:
print >>sys.stderr, '%s: error: invalid number of arguments' % (sys.argv[0])
return False
self._text.set_label(self.args.text)
if self.args.feedback_amplitude:
side = "LEFT"
self.feedback = side, int(self.args.feedback_amplitude)
# Create buttons that are displayed on screen
items = self.items.generate(self)
self.items = []
for item in items:
item.widget = self.generate_widget(item)
if item.widget is not None:
self.items.append(item)
self.pack_items(self.parent, self.items)
if len(self.items) == 0:
print >>sys.stderr, '%s: error: no items in menu' % (sys.argv[0])
return False
return True
示例2: parse_argumets
# 需要导入模块: from scc.osd import OSDWindow [as 别名]
# 或者: from scc.osd.OSDWindow import parse_argumets [as 别名]
def parse_argumets(self, argv):
if not OSDWindow.parse_argumets(self, argv):
print "failed to parse args"
return False
if not self.parse_menu():
print "failed to parse menu"
return False
if not self.config:
self.config = Config()
self._cancel_with = self.args.cancel_with
self._timeout = self.args.timeout
# Create buttons that are displayed on screen
items = self.items.generate(self)
self.items = []
self._button_index = 0
for item in items:
item.widget = self.generate_widget(item)
if item.widget is not None:
self.items.append(item)
self.pack_items(self.parent, self.items)
if len(self.items) == 0:
print >>sys.stderr, '%s: error: no items in menu' % (sys.argv[0])
return False
return True
示例3: parse_argumets
# 需要导入模块: from scc.osd import OSDWindow [as 别名]
# 或者: from scc.osd.OSDWindow import parse_argumets [as 别名]
def parse_argumets(self, argv):
if not OSDWindow.parse_argumets(self, argv):
return False
self.text = self.args.text
self.timeout = self.args.t
self.size = self.args.s
return True
示例4: parse_argumets
# 需要导入模块: from scc.osd import OSDWindow [as 别名]
# 或者: from scc.osd.OSDWindow import parse_argumets [as 别名]
def parse_argumets(self, argv):
if not OSDWindow.parse_argumets(self, argv):
return False
if not self.parse_menu():
return False
if not self.config:
self.config = Config()
# Parse simpler arguments
self._size = self.args.size
# Create buttons that are displayed on screen
items = self.items.generate(self)
self.items = []
for item in items:
item.widget = self.generate_widget(item)
if item.widget is not None:
self.items.append(item)
self.pack_items(self.parent, self.items)
if len(self.items) == 0:
print >>sys.stderr, '%s: error: no items in menu' % (sys.argv[0])
return False
if self.args.print_items:
max_id_len = max(*[ len(x.id) for x in self.items ])
row_format ="{:>%s}:\t{}" % (max_id_len,)
for item in self.items:
print row_format.format(item.id, item.label)
return True
示例5: parse_argumets
# 需要导入模块: from scc.osd import OSDWindow [as 别名]
# 或者: from scc.osd.OSDWindow import parse_argumets [as 别名]
def parse_argumets(self, argv):
if not OSDWindow.parse_argumets(self, argv):
return False
self.position = (self.position[0] - self.BORDER_WIDTH,
self.position[1] - self.BORDER_WIDTH)
self.size = (self.args.width + 2 * self.BORDER_WIDTH,
self.args.height + 2 * self.BORDER_WIDTH)
return True
示例6: parse_argumets
# 需要导入模块: from scc.osd import OSDWindow [as 别名]
# 或者: from scc.osd.OSDWindow import parse_argumets [as 别名]
def parse_argumets(self, argv):
if not OSDWindow.parse_argumets(self, argv):
return False
if not self.config:
self.config = Config()
if self.args.from_profile:
try:
self._menuid = self.args.items[0]
self.items = MenuData.from_profile(self.args.from_profile, self._menuid)
except IOError:
print >>sys.stderr, '%s: error: profile file not found' % (sys.argv[0])
return False
except ValueError:
print >>sys.stderr, '%s: error: menu not found' % (sys.argv[0])
return False
elif self.args.from_file:
#try:
data = json.loads(open(self.args.from_file, "r").read())
self._menuid = self.args.from_file
self.items = MenuData.from_json_data(data)
#except:
# print >>sys.stderr, '%s: error: failed to load menu file' % (sys.argv[0])
# return False
else:
try:
self.items = MenuData.from_args(self.args.items)
self._menuid = None
except ValueError:
print >>sys.stderr, '%s: error: invalid number of arguments' % (sys.argv[0])
return False
# Parse simpler arguments
self._control_with = self.args.control_with
self._confirm_with = self.args.confirm_with
self._cancel_with = self.args.cancel_with
print "_control_with", self._control_with
if self.args.use_cursor:
self.enable_cursor()
# Create buttons that are displayed on screen
self.items = self.items.generate(self)
for item in self.items:
item.widget = self.generate_widget(item)
self.pack_items(self.parent, self.items)
if len(self.items) == 0:
print >>sys.stderr, '%s: error: no items in menu' % (sys.argv[0])
return False
if self.args.print_items:
max_id_len = max(*[ len(x.id) for x in self.items ])
row_format ="{:>%s}:\t{}" % (max_id_len,)
for item in self.items:
print row_format.format(item.id, item.label)
return True
示例7: parse_argumets
# 需要导入模块: from scc.osd import OSDWindow [as 别名]
# 或者: from scc.osd.OSDWindow import parse_argumets [as 别名]
def parse_argumets(self, argv):
if not OSDWindow.parse_argumets(self, argv):
return False
if not self.config:
self.use_config(Config())
# Parse simpler arguments
self._control_with = self.args.control_with
return True
示例8: parse_argumets
# 需要导入模块: from scc.osd import OSDWindow [as 别名]
# 或者: from scc.osd.OSDWindow import parse_argumets [as 别名]
def parse_argumets(self, argv):
if not OSDWindow.parse_argumets(self, argv):
return False
if not self.config:
self.config = Config()
if self.args.feedback_amplitude:
side = "LEFT"
self.feedback = side, int(self.args.feedback_amplitude)
# Create buttons that are displayed on screen
return True
示例9: parse_argumets
# 需要导入模块: from scc.osd import OSDWindow [as 别名]
# 或者: from scc.osd.OSDWindow import parse_argumets [as 别名]
def parse_argumets(self, argv):
if not OSDWindow.parse_argumets(self, argv):
return False
if self.args.from_profile:
try:
self._menuid = self.args.items[0]
self.items = MenuData.from_profile(self.args.from_profile, self._menuid)
except IOError:
print >>sys.stderr, '%s: error: profile file not found' % (sys.argv[0])
return False
except ValueError:
print >>sys.stderr, '%s: error: menu not found' % (sys.argv[0])
return False
elif self.args.from_file:
try:
data = json.loads(open(self.args.from_file, "r").read())
self._menuid = self.args.from_file
self.items = MenuData.from_json_data(data)
except:
print >>sys.stderr, '%s: error: failed to loade menu file' % (sys.argv[0])
return False
else:
try:
self.items = MenuData.from_args(self.args.items)
self._menuid = None
except ValueError:
print >>sys.stderr, '%s: error: invalid number of arguments' % (sys.argv[0])
return False
# Parse simpler arguments
self._control_with = self.args.control_with
self._confirm_with = self.args.confirm_with
self._cancel_with = self.args.cancel_with
if self.args.use_cursor:
self.f.add(self.cursor)
self.f.show_all()
self._use_cursor = True
# Create buttons that are displayed on screen
for item in self.items:
item.widget = Gtk.Button.new_with_label(item.label)
item.widget.set_name("osd-menu-item")
item.widget.set_relief(Gtk.ReliefStyle.NONE)
self.pack_items(self.parent, self.items)
if len(self.items) == 0:
print >>sys.stderr, '%s: error: no items in menu' % (sys.argv[0])
return False
return True
示例10: parse_argumets
# 需要导入模块: from scc.osd import OSDWindow [as 别名]
# 或者: from scc.osd.OSDWindow import parse_argumets [as 别名]
def parse_argumets(self, argv):
if not OSDWindow.parse_argumets(self, argv):
return False
self._cancel_with = self.args.cancel_with
return True
示例11: parse_argumets
# 需要导入模块: from scc.osd import OSDWindow [as 别名]
# 或者: from scc.osd.OSDWindow import parse_argumets [as 别名]
def parse_argumets(self, argv):
if not OSDWindow.parse_argumets(self, argv):
return False
return True