本文整理汇总了Python中kano.gtk3.buttons.KanoButton.set_margin方法的典型用法代码示例。如果您正苦于以下问题:Python KanoButton.set_margin方法的具体用法?Python KanoButton.set_margin怎么用?Python KanoButton.set_margin使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类kano.gtk3.buttons.KanoButton
的用法示例。
在下文中一共展示了KanoButton.set_margin方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: FeedbackWindow
# 需要导入模块: from kano.gtk3.buttons import KanoButton [as 别名]
# 或者: from kano.gtk3.buttons.KanoButton import set_margin [as 别名]
class FeedbackWindow(MainWindow):
CLOSE_FEEDBACK = 0
KEEP_OPEN = 1
LAUNCH_WIFI = 2
WIDTH = 400
def __init__(self, bug_report=False):
'''
Initialises the window, creating a report or contact window
'''
MainWindow.__init__(self, subject='Kano Desktop Feedback Widget')
self.bug_report = bug_report
if self.bug_report:
self.report_window()
else:
self.contact_window()
def contact_window(self):
'''
Contact Us window
Contains text view and a Send button
'''
# delete the directory containing all the info we'll send, and recreate
delete_tmp_dir()
create_tmp_dir()
ApplicationWindow.__init__(
self,
_('Contact Us'), # noqa: F821
self.WIDTH,
0.35
)
screen = Gdk.Screen.get_default()
specific_provider = Gtk.CssProvider()
specific_provider.load_from_path(Media.media_dir() + 'css/style.css')
style_context = Gtk.StyleContext()
style_context.add_provider_for_screen(screen, specific_provider,
Gtk.STYLE_PROVIDER_PRIORITY_USER)
# Make sure this window has no icon in the task bar
# so it plays nice with kdesk-blur
self.set_property('skip-taskbar-hint', True)
self._grid = Gtk.Grid()
# Create top bar
self._top_bar = TopBar(
title=_("Contact Us"), # noqa: F821
window_width=self.WIDTH,
has_buttons=False
)
self._top_bar.set_close_callback(Gtk.main_quit)
self.set_decorated(True)
self.set_titlebar(self._top_bar)
# Create Text view
self._text = Gtk.TextView()
self._text.set_editable(True)
self._text.set_wrap_mode(Gtk.WrapMode.WORD_CHAR)
self._text.set_size_request(self.WIDTH, -1)
self._textbuffer = self._text.get_buffer()
self._textbuffer.set_text(
_("Type your feedback here!") # noqa: F821
)
self._clear_buffer_handler_id = self._textbuffer.connect(
"insert-text", self.clear_buffer
)
scrolledwindow = ScrolledWindow()
scrolledwindow.set_vexpand(True)
scrolledwindow.set_policy(Gtk.PolicyType.NEVER,
Gtk.PolicyType.AUTOMATIC)
scrolledwindow.apply_styling_to_widget()
scrolledwindow.add(self._text)
scrolledwindow.set_margin_left(2)
scrolledwindow.set_margin_right(2)
scrolledwindow.set_margin_top(2)
scrolledwindow.set_margin_bottom(2)
# Very hacky way to get a border: create a grey event box
# which is a little bigger than the widget below
border = Gtk.EventBox()
border.get_style_context().add_class("grey")
border.add(scrolledwindow)
self._grid.attach(border, 0, 0, 1, 1)
border.set_margin_left(20)
border.set_margin_right(20)
border.set_margin_top(10)
border.set_margin_bottom(20)
# Create send button
self._send_button = KanoButton(
_("SEND") # noqa: F821
)
self._send_button.set_sensitive(False)
self._send_button.connect("button_press_event", self.send_feedback)
self._send_button.pack_and_align()
self._send_button.align.set_padding(10, 10, 0, 0)
#.........这里部分代码省略.........