Python gi.repository.Gtk 模块,VBox() 实例源码

我们从Python开源项目中,提取了以下50个代码示例,用于说明如何使用gi.repository.Gtk.VBox()

项目:ubi-virtual-assistant    作者:Alzemand    | 项目源码 | 文件源码
def __init__(self,title,parent,max_value):
        #
        Gtk.Dialog.__init__(self,title,parent)
        self.set_position(Gtk.WindowPosition.CENTER_ALWAYS)
        self.set_size_request(330, 40)
        self.set_resizable(False)
        self.connect('destroy', self.close)
        #
        vbox1 = Gtk.VBox(spacing = 5)
        vbox1.set_border_width(5)
        self.get_content_area().add(vbox1)
        #
        self.progressbar = Gtk.ProgressBar()
        vbox1.pack_start(self.progressbar,True,True,0)
        #
        self.show_all()
        #
        self.max_value=max_value
        self.value=0.0
        self.map()
        while Gtk.events_pending():
            Gtk.main_iteration()
项目:ubi-virtual-assistant    作者:Alzemand    | 项目源码 | 文件源码
def __init__(self,title,parent,max_value):
        #
        Gtk.Dialog.__init__(self,title,parent)
        self.set_position(Gtk.WindowPosition.CENTER_ALWAYS)
        self.set_size_request(330, 40)
        self.set_resizable(False)
        self.connect('destroy', self.close)
        #
        vbox1 = Gtk.VBox(spacing = 5)
        vbox1.set_border_width(5)
        self.get_content_area().add(vbox1)
        #
        self.progressbar = Gtk.ProgressBar()
        vbox1.pack_start(self.progressbar,True,True,0)
        #
        self.show_all()
        #
        self.max_value=max_value
        self.value=0.0
        self.map()
        while Gtk.events_pending():
            Gtk.main_iteration()
项目:PyIDE    作者:raggesilver    | 项目源码 | 文件源码
def __init__(self, parent):
        self.parent = parent
        self.language = 'Plain'
        self.curLinter = None

        self.lintersObj = {
            'c': LinterClang(self.parent, self)
        }

        self.linterPopover = Gtk.Popover()

        self.errorsLbl = Gtk.Label('Errors: 0')
        self.statusLbl = Gtk.Label('Status: OK')
        self.linterPopoverBox = Gtk.VBox()
        self.linterPopoverBox.set_border_width(10)

        self.linterPopoverBox.pack_start(self.errorsLbl, False, False, 0)
        self.linterPopoverBox.pack_start(self.statusLbl, False, False, 0)

        self.linterPopover.add(self.linterPopoverBox)

        ##
项目:Solfege    作者:RannyeriDev    | 项目源码 | 文件源码
def __init__(self, statistics, heading):
        Gtk.ScrolledWindow.__init__(self)
        self.set_policy(Gtk.PolicyType.AUTOMATIC, Gtk.PolicyType.AUTOMATIC)
        self.vbox = Gtk.VBox(False, 0)
        self.vbox.set_spacing(gu.PAD)
        self.vbox.set_border_width(gu.PAD)
        self.add_with_viewport(self.vbox)
        hbox = Gtk.HBox(False, 0)
        hbox.set_spacing(gu.hig.SPACE_SMALL)
        im = Gtk.Image.new_from_file("graphics/applications-system.svg")
        self.g_settings_button = b = Gtk.Button()
        b.connect('clicked', self.on_delete_statistics)
        b.add(im)
        hbox.pack_start(b, False, False, 0)
        self.g_heading = Gtk.Label(label=heading)
        self.g_heading.set_alignment(0.0, 0.5)
        self.g_heading.set_name("StatisticsH1")
        hbox.pack_start(self.g_heading, False, False, 0)
        self.vbox.pack_start(hbox, False, False, 0)
        self.m_statistics = statistics
        self.g_tables = Gtk.VBox(False, 0)
        self.g_tables.show()
        self.vbox.pack_start(self.g_tables, True, True, 0)
        self.show_all()
项目:Solfege    作者:RannyeriDev    | 项目源码 | 文件源码
def hig_category_vbox(title, spacing=6):
    """
    spacing  the space to put between children. HIG say is should be 6, but
    while packing Gtk.LinkButtons there is too much space between the links
    when packing with 6 pixels. So I added the spacing parameter.
    Return a tuple of two boxes:
    box1 -- a box containing everything including the title. Useful
            if you have to hide a category.
    box2    The box you should pack your stuff in.
    """
    vbox = Gtk.VBox(False, 0)
    vbox.set_spacing(hig.SPACE_SMALL)
    label = Gtk.Label(label='<span weight="bold">%s</span>' % title)
    label.set_use_markup(True)
    label.set_alignment(0.0, 0.0)
    vbox.pack_start(label, False, False, 0)
    hbox = Gtk.Box(False, 0)
    vbox.pack_start(hbox, False, False, 0)
    fill = Gtk.Label(label="    ")
    hbox.pack_start(fill, False, False, 0)
    category_content_vbox = Gtk.VBox(False, 0)
    hbox.pack_start(category_content_vbox, True, True, 0)
    category_content_vbox.set_spacing(spacing)
    vbox.show_all()
    return vbox, category_content_vbox
项目:Solfege    作者:RannyeriDev    | 项目源码 | 文件源码
def __init__(self, parent):
        Gtk.Window.__init__(self)
        self.set_title(_("GNU Solfege lesson file editor") )
        self.set_default_size(400, 400)
        self.g_parent = parent
        self.vbox = Gtk.VBox()
        self.vbox.set_spacing(8)
        self.add(self.vbox)
        self.connect('delete_event', self.delete_cb)
        self.g_htmlwidget = htmlwidget.HtmlWidget(None, None)
        self.vbox.pack_start(self.g_htmlwidget, True, True, 0)
        self.vbox.pack_start(Gtk.HSeparator(), False)
        bbox = Gtk.HButtonBox()
        bbox.set_border_width(8)
        self.vbox.pack_start(bbox, False)
        b = Gtk.Button(stock=Gtk.STOCK_CLOSE)
        b.connect('clicked', self.close_cb)
        bbox.pack_start(b, True, True, 0)
        self.show_all()
        self.set_focus(b)
项目:Solfege    作者:RannyeriDev    | 项目源码 | 文件源码
def __init__(self, datadir):
        Gtk.Window.__init__(self)
        self.icons = stock.EditorIconFactory(self, datadir)
        self.connect('destroy', lambda w: Gtk.main_quit())
        self.g_help_window = None
        # toplevel_vbox:
        #   -menubar
        #   -toolbar
        #   -notebook
        #   -statusbar
        self.toplevel_vbox = Gtk.VBox()
        self.add(self.toplevel_vbox)
        self.create_menu_and_toolbar()
        self.g_notebook = Gtk.Notebook()
        self.toplevel_vbox.pack_start(self.g_notebook, True, True, 0)
        self.vbox = Gtk.VBox()
        self.toplevel_vbox.pack_start(self.vbox, True, True, 0)
        self.create_mainwin_ui()
        self.show_all()
项目:Solfege    作者:RannyeriDev    | 项目源码 | 文件源码
def __init__(self, exname, name, sizegroup):
        Gtk.VBox.__init__(self)
        cfg.ConfigUtils.__dict__['__init__'](self, exname)
        self.m_name = name
        hbox = gu.bHBox(self)
        hbox.set_spacing(gu.PAD_SMALL)

        self.g_button = Gtk.Button(
              soundcard.instrument_names[self.get_int(self.m_name)])
        self.g_button.connect('clicked', self.on_btnclick)
        hbox.pack_start(self.g_button, True, True, 0)
        g = Gtk.VolumeButton()
        g.props.value = self.get_int('%s_volume' % name) / MAX_VOLUME

        def ff(volumebutton, value):
            self.set_int('%s_volume' % name, int(value * MAX_VOLUME))
        g.connect('value-changed', ff)
        hbox.pack_start(g, False, False, 0)

        self.g_menu = MidiInstrumentMenu(self.on_instrument_selected)
        self.m_instrument = self.get_int('preferred_instrument')

        hbox = Gtk.HBox()
        hbox.set_spacing(6)
        self.pack_start(hbox, True, True, 0)
项目:Solfege    作者:RannyeriDev    | 项目源码 | 文件源码
def __init__(self, model, parent):
        Gtk.VBox.__init__(self)
        self.set_spacing(gu.hig.SPACE_MEDIUM)
        self.m_model = model
        self.m_parent = parent
        assert isinstance(model, pd.Column)
        self.g_section_box = Gtk.VBox()
        self.g_section_box.set_spacing(gu.hig.SPACE_MEDIUM)
        self.pack_start(self.g_section_box, False, False, 0)
        for section in model:
            assert isinstance(section, pd.LinkList)
            gui_section = Section(section, self)
            self.g_section_box.pack_start(gui_section, False, False, 0)
        hbox = Gtk.HBox()
        self.pack_start(hbox, False, False, 0)
        b = Gtk.Button(_("Add section"))
        hbox.pack_start(b, False, False, 0)
        b.connect('clicked', self.on_add_section)
        b = Gtk.Button(stock=Gtk.STOCK_PASTE)
        b.connect('clicked', self.on_paste)
        Editor.clipboard.register_paste_button(b, pd.LinkList)
        hbox.pack_start(b, False, False, 0)
项目:Solfege    作者:RannyeriDev    | 项目源码 | 文件源码
def __init__(self):
        Gtk.Window.__init__(self)
        vbox = Gtk.VBox()
        self.add(vbox)
        self.set_default_size(600, 400)
        self.w = RhythmWidget()
        s = elems.Score()
        s.add_staff(staff_class=elems.RhythmStaff)
        s.add_bar(elems.TimeSignature(3, 4))
        s.add_bar(elems.TimeSignature(3, 4))
        s.voice11.fill_with_skips()
        self.w.set_score(s)
        vbox.pack_start(self.w, True, True, 0)
        #
        c = RhythmWidgetController(self.w)
        vbox.pack_start(c, False, False, 0)
        c.show()
        c.set_editable(True)
        self.connect('delete_event', self.quit)
项目:Solfege    作者:RannyeriDev    | 项目源码 | 文件源码
def __init__(self):
        Gtk.Window.__init__(self, Gtk.WindowType.POPUP)
        self.set_position(Gtk.WindowPosition.CENTER)
        self.set_resizable(True)
        frame = Gtk.Frame()
        frame.set_shadow_type(Gtk.ShadowType.OUT)
        self.add(frame)
        vbox = Gtk.VBox()
        vbox.set_border_width(20)
        frame.add(vbox)
        l = Gtk.Label(label=_("Starting GNU Solfege %s") % buildinfo.VERSION_STRING)
        l.set_name("Heading1")
        vbox.pack_start(l, True, True, 0)
        l = Gtk.Label(label="http://www.solfege.org")
        vbox.pack_start(l, True, True, 0)
        self.g_infolabel = Gtk.Label(label='')
        vbox.pack_start(self.g_infolabel, True, True, 0)
        self.show_all()
项目:pedro    作者:saandial    | 项目源码 | 文件源码
def main():
    win = Gtk.Window()
    win.connect('destroy', Gtk.main_quit)
    win.set_default_size(Width, Height)

    global drawingarea
    drawingarea = Gtk.DrawingArea()
    drawingarea.connect('draw', draw)

    drawing_event_box = Gtk.EventBox()
    drawing_event_box.add(drawingarea)
    drawing_event_box.connect('button-press-event', mouse_pressed)
    drawing_event_box.connect('motion-notify-event', mouse_dragged)

    check_useIk = Gtk.CheckButton("Lock Forearm & Hand")
    check_useIk.set_active(True)
    check_useIk.connect("toggled", check_toggled)

    box = Gtk.VBox()
    box.pack_start(check_useIk, False, True, 0)
    box.pack_start(drawing_event_box, True, True, 0)
    win.add(box)
    win.show_all()
    Gtk.main()
项目:apart-gtk    作者:alexheretic    | 项目源码 | 文件源码
def __init__(self,
                 final_message: Dict,
                 progress_view: 'ProgressAndHistoryView',
                 core: ApartCore,
                 z_options: List[str]):
        FinishedJob.__init__(self,
                             final_message,
                             progress_view,
                             core,
                             icon_name='dialog-error',
                             z_options=z_options)
        self.fail_reason = key_and_val('Failed', self.msg['error'])
        self.stats = Gtk.VBox()
        self.stats.add(self.fail_reason)
        self.stats.add(self.duration)
        self.stats.get_style_context().add_class('finished-job-stats')
        self.stats.show_all()
        self.extra.add(self.stats)
项目:apart-gtk    作者:alexheretic    | 项目源码 | 文件源码
def __init__(self, final_message:
                 Dict,
                 progress_view: 'ProgressAndHistoryView',
                 core: ApartCore,
                 z_options: List[str]):
        FinishedJob.__init__(self, final_message, progress_view, core, icon_name='dialog-error',
                             z_options=z_options)

        self.fail_reason = key_and_val('Failed', self.msg['error'])
        self.image_source = key_and_val('Restoring from', self.msg['source'])
        self.stats = Gtk.VBox()
        for stat in [self.fail_reason, self.image_source, self.duration]:
            self.stats.add(stat)
        self.stats.get_style_context().add_class('finished-job-stats')
        self.stats.show_all()
        self.extra.add(self.stats)
        # naive rerun is unsafe for restore jobs as /dev/abc1 may refer to different partition
        # than when last run
        self.rerun_btn.destroy()
项目:apart-gtk    作者:alexheretic    | 项目源码 | 文件源码
def __init__(self,
                 final_message: Dict,
                 progress_view: 'ProgressAndHistoryView',
                 core: ApartCore,
                 z_options: List[str]):
        FinishedJob.__init__(self, final_message,
                             progress_view,
                             core,
                             icon_name='object-select-symbolic',
                             forget_on_rerun=False,
                             z_options=z_options)

        self.stats = Gtk.VBox()
        self.image_source = key_and_val('Restored from', self.msg['source'])
        for stat in [self.image_source, self.duration]:
            self.stats.add(stat)
        self.stats.get_style_context().add_class('finished-job-stats')
        self.stats.show_all()
        self.extra.add(self.stats)
        # naive rerun is unsafe for restore jobs as /dev/abc1 may refer to different partition
        # than when last run
        self.rerun_btn.destroy()
项目:Remarkable    作者:jamiemcg    | 项目源码 | 文件源码
def on_menuitem_custom_activate(self, widget):
        self.custom_window = Gtk.Window()
        self.custom_window.set_default_size(640, 480)
        self.custom_window.set_position(Gtk.WindowPosition.CENTER)
        self.custom_window.set_title("Custom CSS")

        self.custom_vbox = Gtk.VBox()
        self.custom_scroller = Gtk.ScrolledWindow()
        self.custom_button = Gtk.Button("Apply")
        self.custom_vbox.pack_end(self.custom_button, False, False, 0)
        self.custom_text_view = Gtk.TextView()
        self.custom_text_buffer = Gtk.TextBuffer()
        self.custom_text_buffer.set_text(self.custom_css)
        self.custom_text_view.set_buffer(self.custom_text_buffer)
        self.custom_scroller.add(self.custom_text_view)
        self.custom_vbox.pack_start(self.custom_scroller, True, True, 0)
        self.custom_window.add(self.custom_vbox)
        self.custom_window.show_all()
        self.custom_button.connect("clicked", self.apply_custom_css, self.custom_window, self.custom_text_buffer)
项目:hackfair-speech    作者:DjangoGirlsSeoul    | 项目源码 | 文件源码
def __init__(self):
        window = Gtk.Window(Gtk.WindowType.TOPLEVEL)
        window.set_title("Audio-Player")
        window.set_default_size(300, -1)
        window.connect("destroy", Gtk.main_quit, "WM destroy")
        vbox = Gtk.VBox()
        window.add(vbox)
        self.entry = Gtk.Entry()
        vbox.pack_start(self.entry, False, True, 0)
        self.button = Gtk.Button("Start")
        self.button.connect("clicked", self.start_stop)
        vbox.add(self.button)
        window.show_all()

        self.player = Gst.ElementFactory.make("playbin", "player")
        fakesink = Gst.ElementFactory.make("fakesink", "fakesink")
        self.player.set_property("video-sink", fakesink)
        bus = self.player.get_bus()
        bus.add_signal_watch()
        bus.connect("message", self.on_message)
项目:ghetto_omr    作者:pohzhiee    | 项目源码 | 文件源码
def __init__(self,MainGrid):
        Gtk.VBox.__init__(self)

        self.btn1=Gtk.Button()
        self.btn1.set_image(Gtk.Image.new_from_icon_name("filenew",Gtk.IconSize.DIALOG))
        self.btn1.set_name("button1")
        self.add(self.btn1)
        #
        # self.win_width = MainGrid.window.win_width
        # self.win_height = MainGrid.window.win_height
        # wid = self.win_width * 0.1
        # hei = self.win_height
        # print "requested width: ",wid
        # print "requested height: ",hei
        # print "-----------------------------"
        # self.set_size_request(wid, hei)
项目:hachoir3    作者:vstinner    | 项目源码 | 文件源码
def __init__(self):
        self.main_window = Gtk.Window()
        self.main_window.set_border_width(5)
        self.main_window.connect("destroy", self._destroy)

        self.main_vbox = Gtk.VBox()

        self.select_hbox = Gtk.HBox()
        self.select_button = Gtk.Button("Select")
        self.select_button.connect("clicked", self._select_clicked)
        self.select_hbox.pack_start(self.select_button, False, True, 0)
        self.file_combo = Gtk.ComboBoxText()
        self.file_combo.connect("changed", self._file_combo_changed)
        self.select_hbox.pack_start(self.file_combo, True, True, 0)
        self.main_vbox.pack_start(self.select_hbox, False, True, 0)

        self.metadata_table = Gtk.Table(1, 1)
        self.metadata_table.attach(
            Gtk.Label("Select a file to view metadata information..."), 0, 1, 0, 1)
        self.main_vbox.pack_start(self.metadata_table, True, True, 0)

        self.main_window.add(self.main_vbox)
        self.main_window.show_all()
项目:x-mario-center    作者:fossasia    | 项目源码 | 文件源码
def __init__(self, addons_manager):
        Gtk.VBox.__init__(self)
        self.set_spacing(12)

        self.addons_manager = addons_manager
        self.cache = self.addons_manager.view.cache
        self.db = self.addons_manager.view.db
        self.icons = self.addons_manager.view.icons
        self.recommended_addons = None
        self.suggested_addons = None

        self.label = Gtk.Label()
        self.label.set_alignment(0, 0.5)

        markup = '<big><b>%s</b></big>' % _('Add-ons')
        self.label.set_markup(markup)
        self.pack_start(self.label, False, False, 0)
项目:x-mario-center    作者:fossasia    | 项目源码 | 文件源码
def __init__(self, label_text=""):
        Gtk.Viewport.__init__(self)
        self.spinner = Gtk.Spinner()
        self.spinner.set_size_request(48, 48)

        # use a table for the spinner (otherwise the spinner is massive!)
        spinner_table = Gtk.Table(3, 3, False)
        self.spinner_label = Gtk.Label()
        self.spinner_label.set_markup('<big>%s</big>' % label_text)
        spinner_vbox = Gtk.VBox()
        spinner_vbox.pack_start(self.spinner, True, True, 0)
        spinner_vbox.pack_start(self.spinner_label, True, True, 10)
        spinner_table.attach(spinner_vbox, 1, 2, 1, 2,
            Gtk.AttachOptions.EXPAND, Gtk.AttachOptions.EXPAND)

        #~ self.modify_bg(Gtk.StateType.NORMAL, Gdk.Color(1.0, 1.0, 1.0))
        self.add(spinner_table)
        self.set_shadow_type(Gtk.ShadowType.NONE)
项目:x-mario-center    作者:fossasia    | 项目源码 | 文件源码
def get_test_buttons_window():
    win = Gtk.Window()
    win.set_size_request(200, 200)

    vb = Gtk.VBox(spacing=12)
    win.add(vb)

    link = Link("<small>test link</small>", uri="www.google.co.nz")
    vb.pack_start(link, False, False, 0)

    button = Gtk.Button()
    button.set_label("channels")
    channels_button = ChannelSelector(button)
    channels_button.parent_style_type = Gtk.Window
    channels_button.set_build_func(_build_channels_list)
    hb = Gtk.HBox()
    hb.pack_start(button, False, False, 0)
    hb.pack_start(channels_button, False, False, 0)
    vb.pack_start(hb, False, False, 0)

    win.show_all()
    win.connect("destroy", Gtk.main_quit)
    return win
项目:x-mario-center    作者:fossasia    | 项目源码 | 文件源码
def __init__(self, label_text=""):
        Gtk.Viewport.__init__(self)
        self.spinner = Gtk.Spinner()
        self.spinner.set_size_request(48, 48)

        # use a table for the spinner (otherwise the spinner is massive!)
        spinner_table = Gtk.Table(3, 3, False)
        self.spinner_label = Gtk.Label()
        self.spinner_label.set_markup('<big>%s</big>' % label_text)
        spinner_vbox = Gtk.VBox()
        spinner_vbox.pack_start(self.spinner, True, True, 0)
        spinner_vbox.pack_start(self.spinner_label, True, True, 10)
        spinner_table.attach(spinner_vbox, 1, 2, 1, 2,
            Gtk.AttachOptions.EXPAND, Gtk.AttachOptions.EXPAND)

        #~ self.modify_bg(Gtk.StateType.NORMAL, Gdk.Color(1.0, 1.0, 1.0))
        self.add(spinner_table)
        self.set_shadow_type(Gtk.ShadowType.NONE)
项目:my-weather-indicator    作者:atareao    | 项目源码 | 文件源码
def __init__(self, lat=39.36873, lon=-2.417274645879, units='F'):
        self.images = {}
        self.echo = True
        Gtk.Window.__init__(self)
        self.set_position(Gtk.WindowPosition.CENTER_ALWAYS)
        self.set_title(comun.APP)
        self.set_default_size(900, 600)
        self.set_icon_from_file(comun.ICON)
        self.connect('destroy', self.close_application)
        #
        vbox = Gtk.VBox(spacing=5)
        self.get_content_area().add(vbox)
        hbox1 = Gtk.HBox()
        vbox.pack_start(hbox1, True, True, 0)
        self.scrolledwindow1 = Gtk.ScrolledWindow()
        self.scrolledwindow1.set_policy(
            Gtk.PolicyType.AUTOMATIC, Gtk.PolicyType.AUTOMATIC)
        self.scrolledwindow1.set_shadow_type(Gtk.ShadowType.IN)
        hbox1.pack_start(self.scrolledwindow1, True, True, 0)
        self.viewer = WebKit.WebView()
        self.scrolledwindow1.add(self.viewer)
        self.scrolledwindow1.set_size_request(900, 600)
        self.viewer.connect('title-changed', self.title_changed)
        self.viewer.open('file://' + comun.HTML)
        self.lat = lat
        self.lon = lon
        self.units = units
        self.set_focus(self.viewer)
        self.show_all()
        self.message_queue = queue.Queue()
        while Gtk.events_pending():
            Gtk.main_iteration()
        self.show_all()
        self.inicialize()
        self.run()
        self.destroy()

    # ###################################################################
    # #########################ENGINE####################################
    # ###################################################################
项目:my-weather-indicator    作者:atareao    | 项目源码 | 文件源码
def get_image_with_text2(text, image=None):
    vbox = Gtk.VBox()
    if image:
        # image = Gtk.Image.new_from_file(os.path.join(comun.IMAGESDIR,image))
        image = load_image(os.path.join(comun.IMAGESDIR, image))
        image.set_alignment(0.5, 0.5)
        vbox.pack_start(image, True, True, 0)
    label = Gtk.Label.new(text)
    label.set_alignment(0.5, 0.5)
    vbox.pack_start(label, True, True, 0)
    return vbox
项目:ubi-virtual-assistant    作者:Alzemand    | 项目源码 | 文件源码
def __init__(self):
        Gtk.Dialog.__init__(self, 'File Downloader',None,Gtk.DialogFlags.MODAL | Gtk.DialogFlags.DESTROY_WITH_PARENT,(Gtk.STOCK_CANCEL, Gtk.ResponseType.REJECT,Gtk.STOCK_OK, Gtk.ResponseType.ACCEPT))
        self.set_position(Gtk.WindowPosition.CENTER_ALWAYS)
        self.set_size_request(400, 100)
        self.set_title('? ubi site file downloader')
        self.connect('destroy', self.close_application)
        #
        vbox0 = Gtk.VBox(spacing = 10)
        vbox0.set_border_width(5)
        self.get_content_area().add(vbox0)
        #
        table1 = Gtk.Table(3,2,False)
        vbox0.add(table1)
        label10 = Gtk.Label('Extension:')
        label10.set_alignment(0, 0.5)
        table1.attach(label10,0,1,0,1)
        #
        self.entry10 = Gtk.Entry()
        table1.attach(self.entry10,1,2,0,1)     
        #
        label11 = Gtk.Label('Url:')
        label11.set_alignment(0, 0.5)
        table1.attach(label11,0,1,1,2)
        #
        self.entry11 = Gtk.Entry()
        table1.attach(self.entry11,1,2,1,2)
        #
        #self.button = Gtk.Button('Select folder')
        #self.button.connect('clicked',self.on_button_clicked)
        #table1.attach(self.button,0,2,2,3)
        #
        self.show_all()
项目:ubi-virtual-assistant    作者:Alzemand    | 项目源码 | 文件源码
def __init__(self):
        Gtk.Dialog.__init__(self, 'File Downloader',None,Gtk.DialogFlags.MODAL | Gtk.DialogFlags.DESTROY_WITH_PARENT,(Gtk.STOCK_CANCEL, Gtk.ResponseType.REJECT,Gtk.STOCK_OK, Gtk.ResponseType.ACCEPT))
        self.set_position(Gtk.WindowPosition.CENTER_ALWAYS)
        self.set_size_request(400, 100)
        self.set_title('? ubi site file downloader')
        self.connect('destroy', self.close_application)
        #
        vbox0 = Gtk.VBox(spacing = 10)
        vbox0.set_border_width(5)
        self.get_content_area().add(vbox0)
        #
        table1 = Gtk.Table(3,2,False)
        vbox0.add(table1)
        label10 = Gtk.Label('Extension:')
        label10.set_alignment(0, 0.5)
        table1.attach(label10,0,1,0,1)
        #
        self.entry10 = Gtk.Entry()
        table1.attach(self.entry10,1,2,0,1)     
        #
        label11 = Gtk.Label('Url:')
        label11.set_alignment(0, 0.5)
        table1.attach(label11,0,1,1,2)
        #
        self.entry11 = Gtk.Entry()
        table1.attach(self.entry11,1,2,1,2)
        #
        #self.button = Gtk.Button('Select folder')
        #self.button.connect('clicked',self.on_button_clicked)
        #table1.attach(self.button,0,2,2,3)
        #
        self.show_all()
项目:Solfege    作者:RannyeriDev    | 项目源码 | 文件源码
def add_select_elements_gui(self):
        self.g_element_frame = frame = Gtk.Frame(label=_("Choose tones"))
        self.config_box.pack_start(frame, False, False, 0)
        self.g_select_rhythms_box = Gtk.VBox()
        self.g_select_rhythms_box.set_border_width(gu.hig.SPACE_SMALL)
        frame.add(self.g_select_rhythms_box)
        self.soltogglebuttons = []
项目:Solfege    作者:RannyeriDev    | 项目源码 | 文件源码
def add_rhythm_element(self, i):
        assert len(self.m_data) <= self.m_num_beats
        if len(self.g_box.get_children()) >= self.m_num_beats:
            self.g_box.get_children()[self.m_num_beats-1].destroy()
        vbox = Gtk.VBox(False, 0)
        vbox.show()
        im = gu.create_rhythm_image(const.RHYTHMS[i])
        vbox.pack_start(im, True, True, 0)
        vbox.pack_start(gu.create_png_image('rhythm-wrong'), False, False, 0)
        vbox.get_children()[-1].hide()
        self.g_box.pack_start(vbox, False, False, 0)
        self.g_box.reorder_child(vbox, len(self.m_data))
        self.m_data.append(i)
项目:Solfege    作者:RannyeriDev    | 项目源码 | 文件源码
def mark_wrong(self):
        if self.m_marked_wrong:
            return
        self.m_marked_wrong = True
        vbox = Gtk.VBox()
        assert len(self.get_children()) == 1
        self.get_children()[0].reparent(vbox)
        self.add(vbox)
        label = Gtk.Label()
        label.set_markup("<span size='small'>%s</span>" % gu.escape(_("Wrong")))
        label.show()
        vbox.pack_start(label, True, True, 0)
        vbox.show()
项目:Solfege    作者:RannyeriDev    | 项目源码 | 文件源码
def __init__(self, heading, statistics):
        Gtk.VBox.__init__(self)
        self.m_heading = heading
        self.m_data = []
        self.m_statistics = statistics
项目:Solfege    作者:RannyeriDev    | 项目源码 | 文件源码
def __init__(self, heading, st_data, st):
        """
        st_data is the statistics data we want displayled
        st is the statistics object the statistics are collected from.
        """
        Gtk.VBox.__init__(self)
        label = Gtk.Label(label=heading)
        label.set_name("StatisticsH2")
        label.set_alignment(0.0, 0.0)
        self.pack_start(label, False, False, 0)
        hbox = gu.bHBox(self, False)
        frame = Gtk.Frame()
        hbox.pack_start(frame, False, False, 0)
        t = Gtk.Table()
        frame.add(t)
        keys = st.get_keys(True)
        for x in range(len(keys)):
            t.attach(Gtk.VSeparator(), x*2+1, x*2+2, 0, len(keys)*2)
        for x in range(len(keys)-1):
            t.attach(Gtk.HSeparator(), 0, len(keys)*2+1, x*2+1, x*2+2)
        for y, key in enumerate(keys):
            l = label_from_key(st, key)
            t.attach(l, 0, 1, y*2, y*2+1, xpadding=gu.PAD)
            for x, skey in enumerate(keys):
                try:
                    s = st_data[key][skey]
                except KeyError:
                    s = '-'
                l = Gtk.Label(label=s)
                if x == y:
                    l.set_name('BoldText')
                t.attach(l, x*2+2, x*2+3, y*2, y*2+1, xpadding=gu.PAD)
        self.show_all()
项目:Solfege    作者:RannyeriDev    | 项目源码 | 文件源码
def clear(self):
        #UGH why cant we just destroy the children of g_tables??!!
        #for c in self.g_tables.children():
        #    c.destroy()
        self.g_tables.destroy()
        self.g_tables = Gtk.VBox(False, 0)
        self.g_tables.set_spacing(gu.hig.SPACE_LARGE)
        self.g_tables.show()
        self.vbox.pack_start(self.g_tables, True, True, 0)
项目:Solfege    作者:RannyeriDev    | 项目源码 | 文件源码
def bVBox(pack_into, expand=True, fill=True, padding=0):
    b = Gtk.VBox(False, 0)
    pack_into.pack_start(b, expand, fill, padding)
    return b
项目:Solfege    作者:RannyeriDev    | 项目源码 | 文件源码
def __init__(self):
        Gtk.VBox.__init__(self)
        self.set_spacing(hig.SPACE_MEDIUM)
        self.set_border_width(hig.SPACE_LARGE)
项目:Solfege    作者:RannyeriDev    | 项目源码 | 文件源码
def twoline(self, A, B):
        vbox = Gtk.VBox(False, 0)
        t1 = Gtk.Label(label=A)
        t1.set_name("ProgressionLabelNumber")
        t1.show();vbox.pack_start(t1, True, True, 0);
        t1.set_alignment(0, 0);
        t2 = Gtk.Label(label=B)
        t2.set_name("ProgressionLabelNumber")
        t2.show();vbox.pack_start(t2, True, True, 0);
        t2.set_alignment(0, 0);
        self.pack_start(vbox, False, False, 0)
项目:Solfege    作者:RannyeriDev    | 项目源码 | 文件源码
def __init__(self):
        Gtk.VBox.__init__(self)
        self.m_todo_widgets = []
项目:Solfege    作者:RannyeriDev    | 项目源码 | 文件源码
def __init__(self, parent):
        Gtk.Window.__init__(self)
        self.set_transient_for(parent)
        self.set_destroy_with_parent(True)
        self.set_modal(True)

        vbox = Gtk.VBox(False, 0)
        vbox.set_spacing(4)

        self.add(vbox)
        self.set_default_size(630, 400)
        self.g_logwidget = LogWidget()

        vbox.pack_start(self.g_logwidget, True, True, 0)
        vbox.pack_start(Gtk.HSeparator(), False, False, 0)

        bbox = Gtk.HButtonBox()
        bbox.set_layout(Gtk.ButtonBoxStyle.END)

        vbox.pack_start(bbox, False, False, padding=0)

        self.g_close_button = Gtk.Button(stock="gtk-close")
        self.g_close_button.set_sensitive(False)
        self.g_close_button.connect('clicked', lambda w: self.destroy())

        bbox.pack_start(self.g_close_button, True, True, 0)

        self.show_all()
        self.write = self.g_logwidget.write
        self.popen = self.g_logwidget.popen
项目:Solfege    作者:RannyeriDev    | 项目源码 | 文件源码
def add_heading(self, text):

        def set_alignment(x, y):
            for c in self.get_children()[0].get_children():
                super(Gtk.Label, c).set_alignment(x, y)
        vbox = Gtk.VBox(False, 0)
        vbox.set_alignment = set_alignment
        b = Gtk.Label()
        b.set_markup(u"%s" % text)
        b.set_alignment(0.0, 0.5)
        vbox.pack_start(b, False, False, 0)
        self.get_children()[0].reparent(vbox)
        self.add(vbox)
项目:Solfege    作者:RannyeriDev    | 项目源码 | 文件源码
def new_page_box(self, parent, heading):
        page_vbox = Gtk.VBox()
        page_vbox.set_spacing(gu.hig.SPACE_MEDIUM)
        self.g_page_box.pack_start(page_vbox, True, True, 0)
        it = self.g_pages.append(parent, [heading])
        self.m_page_mapping[tuple(self.g_pages.get_path(it))] = page_vbox
        return it, page_vbox
项目:Solfege    作者:RannyeriDev    | 项目源码 | 文件源码
def create_mainwin_ui(self):
        qbox = gu.hig_dlg_vbox()
        self.g_notebook.append_page(qbox, Gtk.Label(label=_("Questions")))
        gu.bLabel(qbox, _("Enter new chords using the mouse"), False, False)
        hbox = gu.bHBox(qbox, False, False)
        self.g_displayer = mpd.musicdisplayer.ChordEditor()
        self.g_displayer.connect('clicked', self.on_displayer_clicked)
        self.g_displayer.clear(2)
        gu.bLabel(hbox, "")
        hbox.pack_start(self.g_displayer, False)
        gu.bLabel(hbox, "")
        ##
        self.g_question_name = Gtk.Entry()
        qbox.pack_start(gu.hig_label_widget(_("Question title:", True, True, 0), self.g_question_name, None), False)
        self.g_navinfo = Gtk.Label(label="")
        qbox.pack_start(self.g_navinfo, False)

        ##
        self.m_P = EditorLessonfile()
        cvbox = Gtk.VBox()
        self.g_notebook.append_page(cvbox, Gtk.Label(label=_("Lessonfile header")))
        ## Header section
        sizegroup = Gtk.SizeGroup(Gtk.SizeGroupMode.HORIZONTAL)
        self.g_title = Gtk.Entry()
        cvbox.pack_start(gu.hig_label_widget(_("File title:", True, True, 0), self.g_title,
                        sizegroup))
        self.g_content_chord = Gtk.RadioButton(None, "chord")
        self.g_content_chord_voicing = Gtk.RadioButton(self.g_content_chord, "chord-voicing")
        self.g_content_idbyname = Gtk.RadioButton(self.g_content_chord, "id-by-name")
        box = Gtk.HBox()
        box.pack_start(self.g_content_chord, True, True, 0)
        box.pack_start(self.g_content_chord_voicing, True, True, 0)
        box.pack_start(self.g_content_idbyname, True, True, 0)
        cvbox.pack_start(gu.hig_label_widget(_("Content:", True, True, 0), box, sizegroup))
        self.g_random_transpose = Gtk.Entry()
        cvbox.pack_start(gu.hig_label_widget(_("Random transpose:", True, True, 0),
            self.g_random_transpose, sizegroup))
        #
        #self.g_statusbar = Gtk.Statusbar()
        #self.toplevel_vbox.pack_start(self.g_statusbar, False)
        self.update_appwin()
项目:Solfege    作者:RannyeriDev    | 项目源码 | 文件源码
def __init__(self, exname, num, labeltext):
        Gtk.VBox.__init__(self)
        #cfg.ConfigUtils.__init__(self, exname)
        cfg.ConfigUtils.__dict__['__init__'](self, exname)
        assert num in (2, 3)
        self.m_num = num
        self.g_override_default_instrument_checkbutton \
            = gu.nCheckButton(exname, 'override_default_instrument',
                labeltext,
                 callback=self.update_instrument_override)
        self.pack_start(self.g_override_default_instrument_checkbutton,
                        False, False, 0)
        hbox = gu.bVBox(self)
        hbox.set_spacing(gu.PAD_SMALL)

        sizegroup = Gtk.SizeGroup(Gtk.SizeGroupMode.HORIZONTAL)
        self.g_instrsel_high = FramedInstrumentSelector(_("Highest:"), exname, 'highest_instrument',sizegroup)
        hbox.pack_start(self.g_instrsel_high, False, False, 0)
        if num == 3:
            self.g_instrsel_middle = FramedInstrumentSelector(_("Middle:"),
                                            exname, 'middle_instrument', sizegroup)
            hbox.pack_start(self.g_instrsel_middle, False, False, 0)

        else:
            self.g_instrsel_middle = None
        self.g_instrsel_low = FramedInstrumentSelector(_("Lowest:"),
                                                exname, 'lowest_instrument', sizegroup)
        hbox.pack_start(self.g_instrsel_low, False, False, 0)
        self.update_instrument_override()
项目:Solfege    作者:RannyeriDev    | 项目源码 | 文件源码
def __init__(self, model, parent):
        Gtk.VBox.__init__(self)
        self.m_model = model
        self.m_parent = parent
        sc = Gtk.ScrolledWindow()
        sc.set_policy(Gtk.PolicyType.AUTOMATIC, Gtk.PolicyType.AUTOMATIC)
        self.pack_start(sc, True, True, 0)
        self.g_column_box = Gtk.HBox()
        self.g_column_box.set_spacing(gu.hig.SPACE_LARGE)
        self.g_column_box.set_border_width(gu.hig.SPACE_SMALL)
        # We pack column into this box
        sc.add_with_viewport(self.g_column_box)
        self.show_all()
        if model:
            self.update_from_model()
项目:Solfege    作者:RannyeriDev    | 项目源码 | 文件源码
def __init__(self, filename=None):
        Gtk.Window.__init__(self)
        logging.debug("fpeditor.Editor.__init__(%s)", filename)
        gu.EditorDialogBase.__init__(self, filename)
        self.set_default_size(800, 600)
        self.g_main_box = Gtk.VBox()
        self.add(self.g_main_box)
        self.g_actiongroup.add_actions([
            ('GoBack', Gtk.STOCK_GO_BACK, None, None, None, self.go_back),
        ])
        self.setup_toolbar()
        self.g_title_hbox = Gtk.HBox()
        self.g_title_hbox.set_spacing(gu.hig.SPACE_SMALL)
        self.g_title_hbox.set_border_width(gu.hig.SPACE_SMALL)
        label = Gtk.Label()
        label.set_markup(u"<b>%s</b>" % _("Front page title:"))
        self.g_title_hbox.pack_start(label, False, False, 0)
        self.g_fptitle = Gtk.Entry()
        self.g_title_hbox.pack_start(self.g_fptitle, True, True, 0)
        self.g_main_box.pack_start(self.g_title_hbox, False, False, 0)
        # This dict maps the windows created for all pages belonging to
        # the file.
        self.m_page_mapping = {}
        self.m_model = None
        if filename:
            self.load_file(filename)

        else:
            self.m_model = pd.Page(_("Untitled%s") % self.m_instance_number,
                    pd.Column())
            self.set_not_modified()
        self.add_page(Page(self.m_model, self))
        self.clipboard.update_buttons()
        self.show_all()
        self.add_to_instance_dict()
        self.g_fptitle.set_text(self.m_model.m_name)
        self.g_fptitle.connect('changed', self.on_frontpage_title_changed)
项目:Solfege    作者:RannyeriDev    | 项目源码 | 文件源码
def show_bug_reports(self, *v):
        m = Gtk.Dialog(_("Question"), self, 0)
        m.add_button(Gtk.STOCK_CANCEL, Gtk.ResponseType.CANCEL)
        m.add_button(Gtk.STOCK_OK, Gtk.ResponseType.OK)
        vbox = Gtk.VBox()
        m.vbox.pack_start(vbox, False, False, 0)
        vbox.set_spacing(18)
        vbox.set_border_width(12)
        l = Gtk.Label(label=_("Please enter the email used when you submitted the bugs:"))
        vbox.pack_start(l, False, False, 0)
        self.g_email = Gtk.Entry()
        m.action_area.get_children()[0].grab_default()
        self.g_email.set_activates_default(True)
        vbox.pack_start(self.g_email, False, False, 0)
        m.show_all()
        ret = m.run()
        m.destroy()
        if ret == Gtk.ResponseType.OK:
            params = urllib.urlencode({
                    'pagename': 'SITS-Incoming/SearchBugs',
                    'q': 'SITS-Incoming/"Submitter: %s"' % utils.mangle_email(self.g_email.get_text().decode("utf-8")()),
                })
            try:
                webbrowser.open_new("http://www.solfege.org?%s" % params)
            except Exception, e:
                self.display_error_message2(_("Error opening web browser"), str(e))
项目:Solfege    作者:RannyeriDev    | 项目源码 | 文件源码
def exit_test_mode(self):
        solfege.app.m_test_mode = False
        self.m_action_groups['NotExit'].set_sensitive(True)
        box = Gtk.VBox()
        self.get_view().g_notebook.insert_page(box, Gtk.Label(label=_("Practise")), 0)
        self.g.reparent(box)
        self.get_view().g_notebook.show()
        self.get_view().g_notebook.get_nth_page(0).show()
        self.get_view().g_notebook.set_current_page(0)
        self.get_view().exit_test_mode()
项目:Solfege    作者:RannyeriDev    | 项目源码 | 文件源码
def __init__(self):
        Gtk.Window.__init__(self)
        self.connect('destroy', self.on_quit)
        self.vbox = vbox = Gtk.VBox()
        vbox.show()
        self.add(vbox)
        self.g_text = Gtk.TextView()
        self.g_text.set_size_request(-1, 100)
        self.g_text.show()
        self.g_text.set_editable(True)
        try:
            s = open(musicfile, "r").read()
        except IOError, e:
            s = r"\staff{c' d' e'}"
        self.m_buf = self.g_text.get_buffer()
        self.m_buf.insert(self.m_buf.get_end_iter(), s)
        vbox.pack_start(self.g_text, True, True, 0)
        self.g_displayer = MusicDisplayer()
        self.g_displayer.set_size_request(200, 200)
        self.g_displayer.show()
        self.vbox.pack_start(self.g_displayer, True, True, 0)
        gu.bButton(vbox, "Parse", self.on_parse)
        gu.bButton(vbox, "Display", self.on_display)
        gu.bButton(vbox, "Display first notes", self.on_display_first_notes)
        gu.bButton(vbox, "Play", self.on_play)
        gu.bButton(vbox, "Play first", self.on_play_first)
项目:backlight-indicator    作者:atareao    | 项目源码 | 文件源码
def __init__(self, value):
        #
        Gtk.Dialog.__init__(self,
                            'Backlight Indicator | ' + _('Set backlight'),
                            None,
                            Gtk.DialogFlags.MODAL |
                            Gtk.DialogFlags.DESTROY_WITH_PARENT,
                            (Gtk.STOCK_CANCEL, Gtk.ResponseType.REJECT,
                                Gtk.STOCK_OK, Gtk.ResponseType.ACCEPT))
        self.set_position(Gtk.WindowPosition.CENTER_ALWAYS)
        self.connect('close', self.close_ok)
        self.set_icon_from_file(comun.ICON)
        #
        vbox0 = Gtk.VBox(spacing=5)
        vbox0.set_border_width(5)
        self.get_content_area().add(vbox0)
        frame0 = Gtk.Frame()
        vbox0.pack_start(frame0, False, True, 1)
        table0 = Gtk.Table(2, 2, False)
        frame0.add(table0)
        label23 = Gtk.Label(_('Backlight') + ':')
        label23.set_alignment(0, 0.5)
        table0.attach(label23, 0, 1, 0, 1,
                      xpadding=5, ypadding=5)
        configuration = Configuration()
        minimum_backlight = configuration.get('minimum-backlight')
        maximum_backlight = configuration.get('maximum-backlight')
        ba = BacklightManager()
        backlight = ba.get_backlight()
        adjustment3 = Gtk.Adjustment(backlight,
                                     minimum_backlight,
                                     maximum_backlight, 5, 10, 1)
        self.backlight = Gtk.Scale()
        self.backlight.set_digits(0)
        self.backlight.set_size_request(200, 10)
        self.backlight.set_adjustment(adjustment3)
        table0.attach(self.backlight, 1, 2, 0, 1,
                      xpadding=5, ypadding=5)
        self.backlight.set_value(value)
        self.show_all()
项目:Tadman    作者:KeepPositive    | 项目源码 | 文件源码
def __init__(self, package_name):

        self.install_choice = ()

        Gtk.Window.__init__(self, title="Install")

        self.set_default_size(300, 100)
        self.set_resizable(False)
        self.connect("delete-event", Gtk.main_quit)

        main_box = Gtk.VBox()
        button_box = Gtk.HBox()

        install_message = "Would you like to install %s?" % package_name
        intro_label = Gtk.Label(install_message)
        install_button = Gtk.Button(label='Install')
        cancel_button = Gtk.Button(label='Cancel')

        install_button.connect('clicked', self.install_was_pressed)
        cancel_button.connect('clicked', self.cancel_was_pressed)

        self.add(main_box)
        button_box.pack_start(install_button, True, True, 5)
        button_box.pack_start(cancel_button, True, True, 5)

        main_box.pack_start(intro_label, True, True, 0)
        main_box.pack_start(button_box, True, True, 5)
项目:bokken    作者:thestr4ng3r    | 项目源码 | 文件源码
def get_file(self, widget):
        import re
        import ui.gtk3.common

        # Disable all the interface and Ok button.
        self.hbox.set_sensitive(False)
        self.options_hbox.set_sensitive(False)
        self.butt_ok.set_sensitive(False)

        # Progress bar
        self.progress_box = Gtk.VBox(False, 0)
        self.hseparator4 = Gtk.HSeparator()
        self.progress_bar = Gtk.ProgressBar()
        self.progress_box.pack_start(self.hseparator4, False, False, 0)
        self.progress_box.pack_start(self.progress_bar, False, False, 0)

        self.main_vbox.pack_start(self.progress_box, False, False, 2)
        self.progress_box.show_all()

        ui.gtk3.common.repaint()

        self.file = self.input_entry.get_child().get_text()
        if not re.match('^[a-z]+://', self.file):
            # It's a local file.
            self.manager.add_item('file://' + self.file)
        self.get_options()
        self.response(0)