本文整理汇总了Python中mforms.newLabel函数的典型用法代码示例。如果您正苦于以下问题:Python newLabel函数的具体用法?Python newLabel怎么用?Python newLabel使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了newLabel函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: create_options
def create_options(self, box, options):
optlist = []
for option in options:
cont = None
if option.paramType == "boolean":
opt = mforms.newCheckBox()
opt.set_active(self.defaultValue == "1")
box.add(opt, False, True)
getter = opt.get_string_value
elif option.paramType == "string":
hbox = mforms.newBox(True)
hbox.set_spacing(8)
hbox.add(mforms.newLabel(option.caption), False, True)
opt = mforms.newTextEntry()
opt.set_value(option.defaultValue)
hbox.add(opt, True, True)
l = mforms.newLabel(option.description)
l.set_style(mforms.SmallHelpTextStyle)
hbox.add(l, False, True)
box.add(hbox, False, True)
cont = hbox
getter = opt.get_string_value
else:
grt.send_error("MigrationWizard", "migrationOption() for source has an invalid parameter of type %s (%s)" % (option.paramType, option.name))
continue
optlist.append((cont or opt, option.name, getter))
return optlist
示例2: _add_script_checkbox_option
def _add_script_checkbox_option(self, box, name, caption, path_caption, browser_caption):
check = mforms.newCheckBox()
check.set_text(caption)
box.add(check, False, True)
vbox = mforms.newBox(False)
vbox.set_spacing(4)
file_box = mforms.newBox(True)
file_box.set_spacing(4)
file_box.add(mforms.newLabel(path_caption), False, True)
file_entry = mforms.newTextEntry()
file_entry.add_changed_callback(lambda self=self, option=name: setattr(self, name+"_check_duplicate", True))
file_box.add(file_entry, True, True)
check.add_clicked_callback(lambda box=vbox, check=check: box.set_enabled(check.get_active()))
button = mforms.newButton()
button.set_text("Browse...")
button.add_clicked_callback(lambda option=name, title=browser_caption: self._browse_files(option, title))
file_box.add(button, False, True)
vbox.add(file_box, False, True)
label = mforms.newLabel("You should edit this file to add the source and target server passwords before running it.")
label.set_style(mforms.SmallHelpTextStyle)
vbox.add(label, False, True)
vbox.set_enabled(False)
box.add(vbox, False, True)
setattr(self, name+"_check_duplicate", False)
setattr(self, name+"_checkbox", check)
setattr(self, name+"_entry", file_entry)
示例3: run_version_select_form
def run_version_select_form(version):
form = Form(Form.main_form())
top_vbox = newBox(False)
top_vbox.set_padding(16)
top_vbox.set_spacing(16)
info_hbox = newBox(True)
info_hbox.set_spacing(16)
img_box = newImageBox()
img_box.set_image("warning_icon.png")
right_vbox = newBox(False)
right_vbox.set_spacing(12)
warn_label = newLabel("Server version %s is not supported by Workbench\nconfiguration file management tool." % ".".join(map(lambda x: str(x), version)))
right_vbox.add(warn_label, False, False)
warn_label = newLabel("Although, you can select different server version\nfor the tool to use. Suggested version "
"is given\nbelow. You can either pick version or type one."
)
right_vbox.add(warn_label, False, False)
warn_label = newLabel("Valid version formats are X.Y.ZZ or X.Y.\nAll other variants will resort to default - 5.1.")
right_vbox.add(warn_label, False, False)
if (type(version) is not tuple):
version = (5,1)
dprint_ex(1, "Given version is not a valid tuple object")
try:
version_maj = int(version[0]) + int(version[1]) / 10.0
except (ValueError, IndexError), e:
version_maj = 5.1
示例4: create_ui
def create_ui(self):
message = "The wizard was successful. "
if self.update_connection:
message += "Click on the finish button to update the connection. "
message += "To setup the server, you should \ncopy the following files to a <directory> inside %s:\n\n" % self.main.conn.parameterValues['hostName']
message += " - %s\n" % str(os.path.join(self.main.results_path, "ca-cert.pem")).replace('\\', '/')
message += " - %s\n" % str(os.path.join(self.main.results_path, "server-cert.pem")).replace('\\', '/')
message += " - %s\n" % str(os.path.join(self.main.results_path, "server-key.pem")).replace('\\', '/')
message += "\n\nand edit the config file to use the following parameters:"
label = mforms.newLabel(message)
self.content.add(label, False, True)
f = open(os.path.join(self.main.results_path, "my.cnf.sample"), "r")
config_file = mforms.newTextBox(mforms.VerticalScrollBar)
config_file.set_value(f.read())
config_file.set_size(-1, 150)
self.content.add(config_file, False, True)
f.close()
label = mforms.newLabel("A copy of this file can be found in:\n%s" % str(os.path.join(self.main.results_path, "my.cnf.sample").replace('\\', '/')))
self.content.add(label, False, True)
return
示例5: _add_script_radiobutton_option
def _add_script_radiobutton_option(self, box, name, caption, path_caption, browser_caption, label_caption, rid):
holder = mforms.newBox(False)
holder.set_spacing(4)
radio = mforms.newRadioButton(rid)
radio.set_text(caption)
holder.add(radio, False, True)
vbox = mforms.newBox(False)
vbox.set_spacing(4)
file_box = mforms.newBox(True)
file_box.set_spacing(4)
file_box.add(mforms.newLabel(path_caption), False, True)
file_entry = mforms.newTextEntry()
file_entry.add_changed_callback(lambda self=self, option=name: setattr(self, name + "_check_duplicate", True))
file_box.add(file_entry, True, True)
radio.add_clicked_callback(self._script_radio_option_callback)
button = mforms.newButton()
button.set_text("Browse...")
button.add_clicked_callback(lambda option=name, title=browser_caption: self._browse_files(option, title))
file_box.add(button, False, True)
vbox.add(file_box, False, True)
label = mforms.newLabel(label_caption)
label.set_style(mforms.SmallHelpTextStyle)
vbox.add(label, False, True)
vbox.set_enabled(False)
holder.add(vbox, False, True)
box.add(holder, False, True)
setattr(self, name + "_check_duplicate", False)
setattr(self, name + "_radiobutton", radio)
setattr(self, name + "_entry", file_entry)
setattr(self, name + "_vbox", vbox)
示例6: __init__
def __init__(self, owner):
mforms.Box.__init__(self, True)
self.set_release_on_add()
self.set_managed()
self.owner = owner
self.set_spacing(35)
self.icon = mforms.newImageBox()
self.icon.set_image(mforms.App.get().get_resource_path("mysql-logo-00.png"))
self.add(self.icon, False, True)
vbox = mforms.newBox(False)
self.vbox = vbox
self.add(vbox, True, True)
vbox.set_spacing(2)
vbox.add(mforms.newLabel("Connection Name"), False, True)
self.connection_name = mforms.newLabel("?")
self.connection_name.set_style(mforms.VeryBigStyle)
vbox.add(self.connection_name, False, True)
self.info_table = None
示例7: setup_info_table
def setup_info_table(self, info_table, info, params):
info_table.set_row_count(len(info)+1)
for i, item in enumerate(info):
(label, value_source) = item
if callable(value_source):
value = value_source(*params)
else:
value = value_source
if self.controls.has_key(label):
info_table.remove(self.controls[label][0])
else:
info_table.add(mforms.newLabel(label), 0, 1, i, i+1, mforms.HFillFlag)
if type(value) is bool or value is None:
b = StateIcon()
b.set_state(value)
info_table.add(b, 1, 2, i, i+1, mforms.HFillFlag|mforms.HExpandFlag)
self.controls[label] = (b, value_source)
elif type(value) is tuple:
b = StateIcon()
b.set_state(value[0])
if value[0] and value[1]:
b.set_text(value[1])
info_table.add(b, 1, 2, i, i+1, mforms.HFillFlag|mforms.HExpandFlag)
self.controls[label] = (b, value_source)
else:
l2 = mforms.newLabel(value or "")
l2.set_style(mforms.BoldStyle)
l2.set_color("#1c1c1c")
info_table.add(l2, 1, 2, i, i+1, mforms.HFillFlag|mforms.HExpandFlag)
self.controls[label] = (l2, value_source)
info_table.add(mforms.newLabel(""), 0, 1, len(info), len(info)+1, mforms.HFillFlag) # blank space
return info_table
示例8: make_command_box
def make_command_box(callable, title, desc, tooltip, options = None, extra_options = None):
l = mforms.newLabel(title)
l.set_style(mforms.BoldStyle)
self.content.add(l, False, True)
l = mforms.newLabel(desc)
self.content.add(l, False, True)
if extra_options:
self.content.add(extra_options, False, True)
hb = mforms.newBox(True)
hb.set_spacing(12)
l = mforms.newImageBox()
l.set_image(mforms.App.get().get_resource_path("mini_notice.png"))
l.set_tooltip(tooltip)
hb.add(l, False, True)
for o in options:
hb.add(o, False, True)
btn = mforms.newButton()
btn.add_clicked_callback(callable)
btn.set_text(title.strip())
hb.add_end(btn, False, True)
self._buttons.append(btn)
self.content.add(hb, False, True)
示例9: create_ui
def create_ui(self):
if self.main.import_page.importer_time:
itime = float("%d.%d" % (self.main.import_page.importer_time.seconds, self.main.import_page.importer_time.microseconds))
self.content.add(mforms.newLabel(str("File %s was imported in %.3f s" % (self.get_path(), itime))), False, True)
self.content.add(mforms.newLabel(str("Table %s was created" % self.main.content_preview_page.table_name.get_string_value())), False, True)
示例10: setup_info_table
def setup_info_table(self, info_table, info):
info_table.set_row_count(len(info)+1)
for i, item in enumerate(info):
(label, value) = item
if self.controls.has_key(label):
info_table.remove(self.controls[label])
else:
info_table.add(mforms.newLabel(label), 0, 1, i, i+1, mforms.HFillFlag)
if type(value) is bool or value is None:
b = self.mkswitch(value)
info_table.add(b, 1, 2, i, i+1, mforms.HFillFlag|mforms.HExpandFlag)
self.controls[label] = b
elif type(value) is tuple:
b = self.mkswitch(value[0], value[1] if value[0] else None)
info_table.add(b, 1, 2, i, i+1, mforms.HFillFlag|mforms.HExpandFlag)
self.controls[label] = b
else:
l2 = mforms.newLabel(value or "")
l2.set_style(mforms.BoldStyle)
l2.set_color("#1c1c1c")
info_table.add(l2, 1, 2, i, i+1, mforms.HFillFlag|mforms.HExpandFlag)
self.controls[label] = l2
info_table.add(mforms.newLabel(""), 0, 1, len(info), len(info)+1, mforms.HFillFlag) # blank space
return info_table
示例11: create_ui
def create_ui(self):
self.suspend_layout()
self.set_spacing(16)
label = mforms.newLabel("Table Data Export allows you to easily export data into csv, json datafiles.\n")
label.set_style(mforms.BoldInfoCaptionStyle)
self.content.add(label, False, False)
entry_box = mforms.newBox(True)
entry_box.set_spacing(5)
entry_box.add(mforms.newLabel("File Path:"), False, True)
self.exportfile_path = mforms.newTextEntry()
self.exportfile_path.add_changed_callback(lambda entry=self.exportfile_path: self.entry_changed(entry))
entry_box.add(self.exportfile_path, True, True)
if last_location != None:
self.exportfile_path.set_value(last_location)
self.confirm_file_overwrite = True
self.get_module(True)
browse_btn = mforms.newButton()
browse_btn.set_text("Browse...")
browse_btn.add_clicked_callback(self.browse)
entry_box.add(browse_btn, False, False)
self.content.add(entry_box, False, True)
radio_box = mforms.newBox(True)
radio_box.set_spacing(8)
for format in self.main.formats:
fradio = mforms.newRadioButton(1)
fradio.set_text(format.title)
fradio.set_active(bool(self.active_module and self.active_module.name == format.name))
fradio.add_clicked_callback(lambda f = format: self.output_type_changed(f))
radio_box.add(fradio, False, False)
self.radio_opts.append({'radio':fradio, 'name': format.name})
self.content.add(radio_box, False, False)
self.optpanel = mforms.newPanel(mforms.TitledBoxPanel)
self.optpanel.set_title("Options:")
self.content.add(self.optpanel, False, True)
self.optpanel.show(False)
self.export_local_box = mforms.newBox(False)
self.export_local_cb = mforms.newCheckBox()
self.export_local_cb.set_text("Export to local machine")
self.export_local_cb.set_active(True)
self.export_local_box.add(self.export_local_cb, False, True)
l = mforms.newLabel("""If checked rows will be exported on the location that started Workbench.\nIf not checked, rows will be exported on the server.\nIf server and computer that started Workbench are different machines, import of that file can be done manual way only.""")
l.set_style(mforms.SmallHelpTextStyle)
self.export_local_box.add(l, False, True)
self.content.add(self.export_local_box, False, True)
self.resume_layout()
self.load_module_options()
示例12: stradd
def stradd(table, y, label, value):
t = mforms.newLabel(label)
table.add(t, 0, 1, y, y+1, mforms.HFillFlag)
t = mforms.newLabel(value)
t.set_style(mforms.BoldStyle)
t.set_color("#555555")
table.add(t, 1, 2, y, y+1, mforms.HFillFlag)
return t
示例13: make_line
def make_line(self, caption, name):
i = len(self.labels)
l = mforms.newLabel(caption)
l.set_text_align(mforms.MiddleLeft)
l.set_style(mforms.BoldStyle)
self.add(l, 0, 1, i, i+1, mforms.HFillFlag|mforms.HExpandFlag)
l = mforms.newLabel("")
self.add(l, 1, 2, i, i+1, mforms.HFillFlag|mforms.HExpandFlag)
self.labels[name] = l
示例14: add_label_row
def add_label_row(self, row, label, help):
control = mforms.newTextEntry()
self.table.add(mforms.newLabel(label, True), 0, 1, row, row+1, mforms.HFillFlag)
self.table.add(control, 1, 2, row, row+1, mforms.HFillFlag|mforms.HExpandFlag)
l = mforms.newLabel(help)
l.set_style(mforms.SmallHelpTextStyle)
self.table.add(l, 2, 3, row, row+1, mforms.HFillFlag)
control.set_size(100, -1)
return row+1, control
示例15: __init__
def __init__(self, conn):
mforms.Form.__init__(self, None)
self._conn = conn
self.set_title("Password Expired")
vbox = mforms.newBox(False)
vbox.set_padding(20)
vbox.set_spacing(18)
user = conn.parameterValues["userName"]
l = newLabel("Password for MySQL account '%s'@%s expired.\nPlease pick a new password:" % (user, conn.hostIdentifier.replace("[email protected]", "")))
l.set_style(mforms.BoldStyle)
vbox.add(l, False, True)
box = mforms.newTable()
box.set_padding(1)
box.set_row_count(3)
box.set_column_count(2)
box.set_column_spacing(7)
box.set_row_spacing(8)
hbox = mforms.newBox(True)
hbox.set_spacing(12)
icon = mforms.newImageBox()
icon.set_image(mforms.App.get().get_resource_path("wb_lock.png"))
hbox.add(icon, False, True)
hbox.add(box, True, True)
vbox.add(hbox, False, True)
self.old_password = mforms.newTextEntry(mforms.PasswordEntry)
box.add(newLabel("Old Password:", True), 0, 1, 0, 1, mforms.HFillFlag)
box.add(self.old_password, 1, 2, 0, 1, mforms.HFillFlag|mforms.HExpandFlag)
self.password = mforms.newTextEntry(mforms.PasswordEntry)
box.add(newLabel("New Password:", True), 0, 1, 1, 2, mforms.HFillFlag)
box.add(self.password, 1, 2, 1, 2, mforms.HFillFlag|mforms.HExpandFlag)
self.confirm = mforms.newTextEntry(mforms.PasswordEntry)
box.add(newLabel("Confirm:", True), 0, 1, 2, 3, mforms.HFillFlag)
box.add(self.confirm, 1, 2, 2, 3, mforms.HFillFlag|mforms.HExpandFlag)
bbox = newBox(True)
bbox.set_spacing(8)
self.ok = newButton()
self.ok.set_text("OK")
self.cancel = newButton()
self.cancel.set_text("Cancel")
mforms.Utilities.add_end_ok_cancel_buttons(bbox, self.ok, self.cancel)
vbox.add_end(bbox, False, True)
self.set_content(vbox)
self.set_size(500, 260)
self.center()