本文整理汇总了Python中mforms.newButton函数的典型用法代码示例。如果您正苦于以下问题:Python newButton函数的具体用法?Python newButton怎么用?Python newButton使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了newButton函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: __init__
def __init__(self, editor, schema):
mforms.Splitter.__init__(self, True, False)
self.set_managed()
self.set_release_on_add()
self.schema = schema
self.editor = editor
self.summary_view = TableManager(editor, schema)
self.add(self.summary_view, 100, True)
self.node_name = self.summary_view.node_name
self.caption = self.summary_view.caption
self.summary_view.tree.add_changed_callback(self.table_selection_changed)
self.goback_btn = mforms.newButton()
self.goback_btn.set_text("< Summary List")
self.goback_btn.add_clicked_callback(self.switch_back)
self.summary_view.bbox.add(self.goback_btn, False, True)
self.goback_btn.show(False)
self.inspect_btn = mforms.newButton()
self.inspect_btn.set_text("Inspect Table")
self.inspect_btn.add_clicked_callback(self.summary_view.inspect_table)
self.summary_view.bbox.add_end(self.inspect_btn, False, True)
self.maintenance_btn = mforms.newButton()
self.maintenance_btn.set_text("Maintenance >")
self.maintenance_btn.add_clicked_callback(self.switch_maintenance)
self.summary_view.bbox.add(self.maintenance_btn, False, True)
self.right_view = None
示例2: review_sql_code
def review_sql_code(code):
form = mforms.Form(mforms.Form.main_form(), mforms.FormNormal)
form.set_title("Review SQL Code to Execute")
box = mforms.newBox(False)
box.set_padding(12)
form.set_content(box)
box.set_spacing(8)
box.add(mforms.newLabel("Review the SQL code to be executed."), False, True)
editor = mforms.CodeEditor()
box.add(editor, True, True)
editor.set_language(mforms.LanguageMySQL)
editor.set_text(code)
editor.set_features(mforms.FeatureReadOnly, True)
ok = mforms.newButton()
ok.set_text("Execute")
cancel = mforms.newButton()
cancel.set_text("Cancel")
bbox = mforms.newBox(True)
bbox.set_spacing(8)
bbox.add_end(ok, False, True)
bbox.add_end(cancel, False, True)
box.add_end(bbox, False, True)
form.set_size(500, 360)
return form.run_modal(ok, cancel)
示例3: __init__
def __init__(self, main, header_label, wide=False, no_buttons= False):
mforms.Box.__init__(self, False)
self.set_managed()
self.set_release_on_add()
self.skip_this_page = False
self.ui_created = False
self.main = main
self._identifier = " "+header_label
self.set_back_color("") # Make the page transparent.
self.container = mforms.newBox(True)
# Main content
self.content = mforms.newBox(False)
self.content.set_spacing(12)
self.content.set_padding(24)
if not wide:
self.content.set_size(800, -1)
self.container.add(self.content, False, True)
else:
self.container.add(self.content, True, True)
self.add(self.container, True, True)
if not no_buttons:
# Buttons at the bottom of the page:
self.button_box = mforms.newBox(True)
self.button_box.set_spacing(8)
self.button_box.set_padding(16)
if hasattr(self, "go_advanced"):
self.advanced_button = mforms.newButton()
self.advanced_button.set_text('Advanced >>')
self.advanced_button.add_clicked_callback(self.go_advanced)
self.button_box.add(self.advanced_button, False, True)
self.cancel_button = mforms.newButton()
self.cancel_button.set_text('Cancel')
self.button_box.add_end(self.cancel_button, False, True)
if hasattr(self, "go_cancel"):
self.cancel_button.add_clicked_callback(self.go_cancel)
else:
self.cancel_button.set_enabled(False)
self.next_button = mforms.newButton()
self.next_button.set_text('Next >')
self.next_button.add_clicked_callback(self.go_next)
self.button_box.add_end(self.next_button, False, True)
self.back_button = mforms.newButton()
self.back_button.set_text('< Back')
self.back_button.add_clicked_callback(self.go_back)
self.button_box.add_end(self.back_button, False, True)
self.add_end(self.button_box, False, True)
示例4: __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()
示例5: ui_ok_cancel_button
def ui_ok_cancel_button(self, box):
tBox = PropelForm.spaced_box(True)
#label = mforms.newLabel("remember to validate your changes by press OK, and save you .mwb file in MySQLWorkbench to save you Propel Utilty changes ;)")
#tBox.add(label, False, True)
self.cancelButton = mforms.newButton()
self.cancelButton.set_text("cancel")
tBox.add_end(self.cancelButton, False, True)
self.okButton = mforms.newButton()
self.okButton.set_text("ok")
tBox.add_end(self.okButton, False, True)
self.okButton.add_clicked_callback(self.save)
box.add_end(tBox, False, True)
示例6: create_ui
def create_ui(self):
dprint_ex(3, "Enter")
self.suspend_layout()
self.warning = not_running_warning_label()
self.add(self.warning, False, True)
self.connection_list = newTreeView(mforms.TreeDefault)
self.connection_list.add_column(mforms.StringColumnType, "Id", 50, False)
self.connection_list.add_column(mforms.StringColumnType, "User", 80, False)
self.connection_list.add_column(mforms.StringColumnType, "Host", 120, False)
self.connection_list.add_column(mforms.StringColumnType, "DB", 100, False)
self.connection_list.add_column(mforms.StringColumnType, "Command", 80, False)
self.connection_list.add_column(mforms.IntegerColumnType, "Time", 80, False)
self.connection_list.add_column(mforms.StringColumnType, "State", 80, False)
self.connection_list.add_column(mforms.StringColumnType, "Info", 300, False)
self.connection_list.end_columns()
self.connection_list.set_allow_sorting(True)
self.connection_list.add_changed_callback(weakcb(self, "connection_selected"))
#self.set_padding(8)
self.add(self.connection_list, True, True)
self.button_box = box = newBox(True)
self.add(box, False, True)
box.set_spacing(12)
box.set_padding(12)
refresh_button = newButton()
refresh_button.set_text("Refresh")
box.add_end(refresh_button, False, True)
refresh_button.add_clicked_callback(weakcb(self, "refresh"))
self.kill_button = newButton()
self.kill_button.set_text("Kill Connection")
box.add_end(self.kill_button, False, True)
self.kill_button.add_clicked_callback(weakcb(self, "kill_connection"))
self.killq_button = newButton()
self.killq_button.set_text("Kill Query")
box.add_end(self.killq_button, False, True)
self.killq_button.add_clicked_callback(weakcb(self, "kill_query"))
self.add(box, False, True)
self.resume_layout()
self.connection_selected()
dprint_ex(3, "Leave")
示例7: add_remove_behavior_button
def add_remove_behavior_button(self):
tBox = PropelForm.spaced_box(True)
self.widgets['selectBehaviors'] = mforms.newSelector(mforms.SelectorPopup)
self.widgets['selectBehaviors'].add_items(sorted(PropelBehavior.getBehaviorsDict(self.widgets['extra_behaviors_path'].get_string_value()).keys()))
tBox.add(self.widgets['selectBehaviors'], False, True)
addBehavior = mforms.newButton()
addBehavior.set_text("add selected behavior to selected table")
addBehavior.add_clicked_callback(lambda: self.add_behavior())
tBox.add(addBehavior, False, True)
removeBehavior = mforms.newButton()
removeBehavior.set_text("remove this behavior")
removeBehavior.add_clicked_callback(lambda: self.remove_behavior())
tBox.add(removeBehavior, False, True)
self.add_end(tBox, False, True)
示例8: add_remove_behavior_button
def add_remove_behavior_button(self):
tBox = PropelForm.spaced_box(True)
self.widgets['selectBehaviors'] = mforms.newSelector(mforms.SelectorPopup)
self.widgets['selectBehaviors'].add_items(PropelBehavior.fields['name']['items'])
tBox.add(self.widgets['selectBehaviors'], False, True)
addBehavior = mforms.newButton()
addBehavior.set_text("add selected behavior to selected table")
addBehavior.add_clicked_callback(lambda: self.add_behavior())
tBox.add(addBehavior, False, True)
removeBehavior = mforms.newButton()
removeBehavior.set_text("remove this behavior")
removeBehavior.add_clicked_callback(lambda: self.remove_behavior())
tBox.add(removeBehavior, False, True)
self.add_end(tBox, False, True)
示例9: __init__
def __init__(self, Title, Message):
mforms.Form.__init__(self, None, mforms.FormDialogFrame)
self.set_title(Title)
box = mforms.newBox(False)
self.set_content(box)
box.set_padding(12)
box.set_spacing(12)
label = mforms.newLabel(Message)
box.add(label, False, True)
self.cancelButton = mforms.newButton()
self.cancelButton.set_text("No")
box.add_end(self.cancelButton, False, True)
self.okButton = mforms.newButton()
self.okButton.set_text("Yes")
box.add_end(self.okButton, False, True)
示例10: __init__
def __init__(self, icon, title, text, button1, button2=None):
mforms.Table.__init__(self)
self.set_managed()
self.set_release_on_add()
self.set_padding(-1) # center contents
self.set_column_spacing(12)
self.set_row_spacing(12)
self.set_row_count(3)
self.set_column_count(2)
if icon:
image = mforms.newImageBox()
image.set_image(mforms.App.get().get_resource_path(icon))
self.add(image, 0, 1, 0, 3, 0)
self._label = mforms.newLabel(title)
self._label.set_style(mforms.BigBoldStyle)
self._label.set_text_align(mforms.MiddleCenter)
self.add(self._label, 1, 2, 0, 1, mforms.HFillFlag)
self.add(mforms.newLabel(text), 1, 2, 1, 2, mforms.HFillFlag)
if button1 or button2:
bbox = mforms.newBox(True)
bbox.set_spacing(12)
if button1:
button_caption, button_action = button1
self._button = mforms.newButton()
self._button.set_text(button_caption)
self._button.add_clicked_callback(button_action)
bbox.add_end(self._button, False, True)
else:
self._button = None
if button2:
button_caption, button_action = button2
self._alt_button = mforms.newButton()
self._alt_button.set_text(button_caption)
self._alt_button.add_clicked_callback(button_action)
bbox.add_end(self._alt_button, False, True)
else:
self._alt_button = None
if button1 or button2:
self.add(bbox, 1, 2, 2, 3, 0)
示例11: create_search_panel
def create_search_panel(self):
search_label = newLabel("Locate option:")
self.option_lookup_entry = newTextEntry()
self.option_lookup_entry.set_size(200,-1)
search_btn = newButton()
search_btn.set_text("Find")
search_btn.set_size(70, -1)
search_box = newBox(True)
search_box.set_padding(2)
search_box.set_spacing(4)
#search_box.set_size(300, -1)
search_box.add(search_label, False, False)
search_box.add(self.option_lookup_entry, False, True)
search_box.add(search_btn, False, False)
search_panel = newPanel(mforms.FilledPanel)
search_panel.add(search_box)
self.main_view.ui_profile.apply_style(search_panel, 'option-search-panel')
def lookup_option_wrapper():
self.locate_option(self.option_lookup_entry.get_string_value())
search_btn.add_clicked_callback(lookup_option_wrapper)
return search_panel
示例12: _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)
示例13: 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)
示例14: _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)
示例15: create_ui
def create_ui(self):
label = mforms.newLabel("Welcome to the MySQL Workbench Migration Wizard")
label.set_style(mforms.BigBoldStyle)
self.content.add(label, False, True)
self.content.set_spacing(12)
self.content.set_padding(20)
label = mforms.newLabel("This wizard will assist you in migrating tables and data from a supported database system to MySQL.\n"+
"You can also use this to copy databases from one MySQL instance to another.")
self.content.add(label, False, True)
label = mforms.newLabel("Prerequisites")
label.set_style(mforms.BoldStyle)
self.content.add(label, False, True)
label = mforms.newLabel("Before starting, check the following preparation steps:\n\n"+
"- The Migration Wizard uses ODBC to connect to the source database. You must have an ODBC driver for\n"
"the source database installed and configured, as Workbench does not bundle any such drivers.\n"
"For MySQL connections, the native client library is used.\n\n"+
"- Ensure you can connect to both source and target RDBMS servers.\n\n"+
"- Make sure you have privileges to read schema information and data from the source database and\n"+
"create objects and inserting data in the target MySQL server.\n\n"+
"- The max_allowed_packet option in the target MySQL server must be enough to fit\n"+
"the largest field value to be copied from source (especially BLOBs and large TEXT fields).\n\n"+
"\n"+
"The wizard supports migrating from specific database systems, but a \"generic\" RDBMS support is also provided.\n"+
"The generic support is capable of migrating tables from many RDBMS that can be connected to using ODBC,\n"+
"although certain type mappings may not be performed correctly. A manual mapping step is provided for\n"+
"reviewing and fixing any migration problems that could occur.")
self.content.add(label, False, True)
box = mforms.newBox(True)
box.add(mforms.newLabel(""), True, True)
button_start = mforms.newButton()
button_start.set_text("Start Migration")
button_start.add_clicked_callback(self.start)
box.add(button_start, True, True)
box.add(mforms.newLabel(""), True, True)
button_odbc = mforms.newButton()
button_odbc.set_text("Open ODBC Administrator")
button_odbc.add_clicked_callback(self.start_odbc)
box.add(button_odbc, True, True)
box.add(mforms.newLabel(""), True, True)
button_doc = mforms.newButton()
button_doc.set_text("View Documentation")
button_doc.add_clicked_callback(lambda: mforms.Utilities.open_url('http://dev.mysql.com/doc/workbench/en/wb-migration.html'))
box.add(button_doc, True, True)
box.add(mforms.newLabel(""), True, True)
self.content.add_end(box, False, True)