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

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

项目:susi_linux    作者:fossasia    | 项目源码 | 文件源码
def __init__(self, parent):
        Gtk.Dialog.__init__(self, "Enter API Key", parent, 0,
                            (Gtk.STOCK_CANCEL, Gtk.ResponseType.CANCEL,
                             Gtk.STOCK_OK, Gtk.ResponseType.OK))

        self.set_default_size(150, 100)

        api_key_field = Gtk.Entry()
        api_key_field.set_placeholder_text("API Key")

        self.api_key_field = api_key_field

        box = self.get_content_area()

        box.set_margin_top(10)
        box.set_margin_bottom(10)
        box.set_margin_left(10)
        box.set_margin_right(10)

        box.set_spacing(10)

        box.add(api_key_field)
        self.show_all()
项目:PyIDE    作者:raggesilver    | 项目源码 | 文件源码
def entryDialog(self, message, title='', defaultText=''):
        # Returns user input as a string or None
        # If user does not input text it returns None, NOT AN EMPTY STRING.
        dialogWindow = Gtk.MessageDialog(self, Gtk.DialogFlags.MODAL | Gtk.DialogFlags.DESTROY_WITH_PARENT, Gtk.MessageType.INFO, Gtk.ButtonsType.OK_CANCEL, message)

        dialogWindow.set_title(title)

        dialogBox = dialogWindow.get_content_area()
        userEntry = Gtk.Entry()
        userEntry.set_text(defaultText)
        dialogBox.pack_end(userEntry, False, False, 0)

        dialogWindow.show_all()
        response = dialogWindow.run()
        text = userEntry.get_text()
        dialogWindow.destroy()
        if (response == Gtk.ResponseType.OK) and (text != ''):
            return text
        else:
            return None
项目:efibootmgr-gui    作者:Elinvention    | 项目源码 | 文件源码
def entry_dialog(parent, message, title=''):
    dialog = Gtk.MessageDialog(parent,
            Gtk.DialogFlags.MODAL | Gtk.DialogFlags.DESTROY_WITH_PARENT,
            Gtk.MessageType.QUESTION, Gtk.ButtonsType.OK_CANCEL, message)

    dialog.set_title(title)

    dialogBox = dialog.get_content_area()
    userEntry = Gtk.Entry()
    userEntry.set_size_request(250,0)
    dialogBox.pack_end(userEntry, False, False, 0)

    dialog.show_all()
    response = dialog.run()
    text = userEntry.get_text() 
    dialog.destroy()
    if (response == Gtk.ResponseType.OK) and (text != ''):
        return text
项目:Solfege    作者:RannyeriDev    | 项目源码 | 文件源码
def __init__(self, oldname):
        Gtk.Dialog.__init__(self, _(u"_Rename profile\u2026").replace("_", "").replace(u"\u2026", ""))
        self.add_buttons(Gtk.STOCK_CANCEL, Gtk.ResponseType.CANCEL,
                        Gtk.STOCK_OK, Gtk.ResponseType.ACCEPT)
        vbox = gu.hig_dlg_vbox()
        self.vbox.pack_start(vbox, True, True, 0)

        label = Gtk.Label(label=_(u"Rename the profile «%s» to:") % oldname)
        label.set_alignment(0.0, 0.5)
        vbox.pack_start(label, False, False, 0)

        self.g_entry = Gtk.Entry()
        self.g_entry.set_text(oldname)
        self.g_entry.set_activates_default(True)
        self.g_entry.connect('changed', self.on_entry_changed)
        vbox.pack_start(self.g_entry, False, False, 0)

        self.g_info = Gtk.Label()
        self.g_info.set_no_show_all(True)
        vbox.pack_start(self.g_info, False, False, 0)
        self.set_default_response(Gtk.ResponseType.ACCEPT)
项目:Solfege    作者:RannyeriDev    | 项目源码 | 文件源码
def __init__(self, default_value):
        Gtk.Box.__init__(self)
        self.m_value = mpd.notename_to_int(default_value)
        self.g_entry = Gtk.Entry()
        self.g_entry.set_editable(False)
        self.g_entry.set_text(mpd.int_to_user_octave_notename(self.m_value))
        self.pack_start(self.g_entry, False, False, 0)
        # up
        eb1 = Gtk.Button()
        eb1.add(Gtk.Arrow(Gtk.ArrowType.UP, Gtk.ShadowType.OUT))
        eb1.connect('button-press-event', self.on_up_press)
        eb1.connect('button-release-event', self.on_up_release)
        self.pack_start(eb1, True, True, 0)
        # down
        eb2 = Gtk.Button()
        eb2.add(Gtk.Arrow(Gtk.ArrowType.DOWN, Gtk.ShadowType.IN))
        eb2.connect('button-press-event', self.on_down_press)
        eb2.connect('button-release-event', self.on_down_release)
        self.pack_start(eb2, True, True, 0)
        self.m_timeout = None
项目:MokaPlayer    作者:vedard    | 项目源码 | 文件源码
def __init__(self, parent, title, text):
        Gtk.Dialog.__init__(self, title, parent, 0,
                            (Gtk.STOCK_CANCEL, Gtk.ResponseType.CANCEL,
                             Gtk.STOCK_OK, Gtk.ResponseType.OK))

        self.set_default_size(350, 0)
        self.set_default_response(Gtk.ResponseType.OK)

        self.label = Gtk.Label(text)
        self.label.set_margin_start(5)
        self.label.set_margin_top(5)
        self.label.set_margin_bottom(5)
        self.label.set_margin_end(5)

        self.entry = Gtk.Entry()
        self.entry.set_margin_start(5)
        self.entry.set_margin_top(5)
        self.entry.set_margin_bottom(5)
        self.entry.set_margin_end(5)
        self.entry.connect('activate', lambda widget: self.response(Gtk.ResponseType.OK))

        self.get_content_area().add(self.label)
        self.get_content_area().add(self.entry)
项目:MPV-VJ2    作者:paulguy    | 项目源码 | 文件源码
def __init__(self, lastWindow, message, value=""):
        Gtk.Dialog.__init__(self, title="Prompt")

        self.set_modal(True)
        self.set_transient_for(lastWindow)

        self.label = Gtk.Label(message)
        self.entry = Gtk.Entry()
        self.entry.set_text(value)
        self.get_content_area().pack_start(self.label, True, True, 0)
        self.get_content_area().pack_start(self.entry, True, True, 0)

        self.add_button("OK", Gtk.ResponseType.OK)
        self.add_button("Cancel", Gtk.ResponseType.CANCEL)

        self.connect("key-press-event", self.keyPressed)
项目:chromecast-player    作者:wa4557    | 项目源码 | 文件源码
def main(self):
        self.win.set_title("Enter URL for network stream")
        self.entry = Gtk.Entry()
        vboxall = Gtk.Box(orientation=Gtk.Orientation.VERTICAL)
        self.win.set_size_request(300, 10)
        content_area = self.win.get_content_area()
        content_area.pack_start(self.entry, True, True, 10)
        self.entry.set_margin_left(10)
        self.entry.set_margin_right(10)
        self.entry.show()
        response = self.win.run()

        if response == Gtk.ResponseType.OK:
            self.ret = self.entry.get_text()
        self.win.destroy()
        if self.ret:
            return (self.ret, self.but)
        else:
            return None
项目: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,parent):
        Gtk.Grid.__init__(self,column_homogeneous=False, column_spacing=10,row_spacing=0)
        button1 = Gtk.Button("Choose File")
        button1.connect("clicked", self.on_file_clicked)
        self.add(button1)

        self.text_file = Gtk.Entry()
        self.text_file.set_hexpand(True)
        self.attach(self.text_file, 1, 0, 4, 1)

        button2 = Gtk.Button("Choose Folder")
        button2.connect("clicked", self.on_folder_clicked)
        self.attach_next_to(button2, button1, Gtk.PositionType.BOTTOM, 1, 1)

        self.text_folder = Gtk.Entry()
        self.attach(self.text_folder, 1, 1, 4, 1)
项目:PyFlowChart    作者:steelcowboy    | 项目源码 | 文件源码
def __init__(self, text=None):
        Gtk.EventBox.__init__(self)
        self.text = text 
        self.has_entry = False 

        if text is not None:
            self.label = Gtk.Label(text)
            self.add(self.label)
        else:
            self.entry = Gtk.Entry()
            self.entry.connect('activate', self.enter_key)
            self.add(self.entry)
            self.has_entry = True 

        self.connect('button-press-event', self.double_click)


        self.show_all()
项目:MTodo    作者:mortezaipo    | 项目源码 | 文件源码
def __init__(self, name: str, placeholder: str, multi_line: bool):
        """Initialize Input class"""
        self._name = name
        self._placeholder = placeholder
        self._multi_line = multi_line
        if self._multi_line is True:
            self._widget = Gtk.TextView()
            self._widget.set_wrap_mode(Gtk.WrapMode.WORD_CHAR)
            self._widget.set_size_request(400, 219)
            #placeholder
            self._widget.connect("focus-in-event", self._in_focus)
            self._widget.connect("focus-out-event", self._out_focus)
            self._widget.get_buffer().set_text(self._placeholder)
        else:
            self._widget = Gtk.Entry()
            self._widget.unset_state_flags(Gtk.StateFlags.FOCUSED)
            self._widget.set_placeholder_text(self._placeholder)

        self._widget.set_name(self._name)
项目:Vulnerabilities-spider    作者:muhammad-bouabid    | 项目源码 | 文件源码
def __init__(self, parent):
      Gtk.Dialog.__init__(self, "Something", parent,
          Gtk.DialogFlags.MODAL, buttons=(
          Gtk.STOCK_NEW, Gtk.ResponseType.OK,
          Gtk.STOCK_CANCEL, Gtk.ResponseType.CANCEL))

      self.set_default_size(400, 600)

      box = self.get_content_area()

      label = Gtk.Label("Insert text you want to search for:")
      box.add(label)

#        self.entry = Gtk.Entry()
#        box.add(self.entry)

      self.main_area = Gtk.Stack()
      self.main_area.set_transition_type(Gtk.StackTransitionType.SLIDE_LEFT_RIGHT)

      self.main_area.set_transition_duration(1000)

      self.entry = Gtk.Entry()
      self.main_area.add_titled(self.entry, "entry_name", "Entry Url")

      self.labelS = Gtk.Label()
      self.label_txt = """<big><i>you have choice to runn the scan directly or after setup the scanning process you want to follow on your target</i></big>"""
      self.labelS.set_markup(self.label_txt)
      self.labelS.set_line_wrap(True)
      self.main_area.add_titled(self.labelS, "label_name", "How Scan will Start")

      self.our_stackSwitcher = Gtk.StackSwitcher()
      self.our_stackSwitcher.set_stack(self.main_area)

      box.add(self.our_stackSwitcher)
      box.add(self.main_area)

      self.show_all()


#~~~~~~~~~~~~ History Dialog ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~#
项目:poseidon    作者:sidus-dev    | 项目源码 | 文件源码
def make_box(text, length, digit):

    label = Gtk.Label()
    label.set_markup("<span size='small'>{}</span>".format(text))
    label.set_alignment(0.0, 0.5)
    label.set_property("margin-top", 10)
    label.set_property("margin-bottom", 10)
    entry = Gtk.Entry()

    if length: entry.set_max_length(length)

    if digit:
        entry.set_name(str(digit))
        entry.connect("changed", digits_only)

    grid = Gtk.Grid()
    grid.attach(label, 0, 0, 1, 1)
    grid.attach(entry, 0, 1, 1, 1)

    return grid
项目:tmsu-nautilus-python    作者:talklittle    | 项目源码 | 文件源码
def __init__(self, files):
        self.files = files

        Gtk.Window.__init__(self, title="TMSU")
        self.set_size_request(200, 100)
        self.set_border_width(10)
        self.set_type_hint(Gdk.WindowTypeHint.DIALOG)

        vbox = Gtk.Box(orientation=Gtk.Orientation.VERTICAL, spacing=6)
        self.add(vbox)

        prompt_text = 'Add (space-separated) tags to %d file%s' % (len(files), '' if len(files)==1 else 's')
        self.prompt_label = Gtk.Label(label=prompt_text)
        vbox.pack_start(self.prompt_label, True, True, 0)

        self.entry = Gtk.Entry()
        self.entry.connect("activate", self.on_entry_activated)
        vbox.pack_start(self.entry, True, True, 0)

        self.button = Gtk.Button(label="Add")
        self.button.connect("clicked", self.on_button_clicked)
        vbox.pack_start(self.button, True, True, 0)
项目:sticky-notes    作者:rubyAce71697    | 项目源码 | 文件源码
def get_text(self,parent, message, default=''):
        """
        Display a dialog with a text entry.
        Returns the text, or None if canceled.
        """
        dialog = Gtk.MessageDialog(self.window, 0, Gtk.MessageType.INFO,
            Gtk.ButtonsType.OK, "Enter the Title")
        dialog.add_button("CANCEL",Gtk.ButtonsType.CANCEL)

        entry = Gtk.Entry()
        entry.set_text(default)
        entry.show()
        box = dialog.get_content_area()
        box.add(entry)

        entry.connect('activate', lambda _: dialog.response(Gtk.ResponseType.OK))
        dialog.set_default_response(Gtk.ResponseType.OK)

        r = dialog.run()
        text = entry.get_text().decode('utf8')
        dialog.destroy()
        if r == Gtk.ResponseType.OK:
            return text
        else:
            return None
项目:susi_linux    作者:fossasia    | 项目源码 | 文件源码
def __init__(self, parent):
        Gtk.Dialog.__init__(self, "Enter Credentials", parent, 0,
                            (Gtk.STOCK_CANCEL, Gtk.ResponseType.CANCEL,
                             Gtk.STOCK_OK, Gtk.ResponseType.OK))

        self.set_default_size(150, 100)

        username_field = Gtk.Entry()
        username_field.set_placeholder_text("Username")
        password_field = Gtk.Entry()
        password_field.set_placeholder_text("Password")
        password_field.set_visibility(False)
        password_field.set_invisible_char('*')

        self.username_field = username_field
        self.password_field = password_field

        box = self.get_content_area()

        box.set_margin_top(10)
        box.set_margin_bottom(10)
        box.set_margin_left(10)
        box.set_margin_right(10)

        box.set_spacing(10)

        box.add(username_field)
        box.add(password_field)
        self.show_all()
项目:Gnome-Authenticator    作者:bil-elmoussaoui    | 项目源码 | 文件源码
def generate(self):
        Gtk.Entry.__init__(self, xalign=0)
        self.set_text(self.name)
        self.set_width_chars(25)
        self.set_max_width_chars(25)
        self.hide()
项目:Gnome-Authenticator    作者:bil-elmoussaoui    | 项目源码 | 文件源码
def __init__(self, window):
        self.parent = window

        self.selected_logo = None
        self.step = 1
        self.account_image = Gtk.Image(xalign=0)
        self.secret_code = Gtk.Entry()
        self.name_entry = Gtk.Entry()
        self.hb = Gtk.HeaderBar()

        self.generate_window()
        self.generate_components()
        self.generate_header_bar()
项目:Gnome-Authenticator    作者:bil-elmoussaoui    | 项目源码 | 文件源码
def __set_entry_status_icon(self, entry, is_valid=False):
        # Private function to change the Gtk.Entry secondary icon
        if is_valid:
            icon = None
        else:
            icon = "dialog-error-symbolic"
        entry.set_icon_from_icon_name(Gtk.EntryIconPosition.SECONDARY, icon)
项目:mama    作者:maateen    | 项目源码 | 文件源码
def __init__(self, store, iter=None):
        self.grid = Gtk.Grid()
        self.grid.set_border_width(5)
        self.grid.set_row_spacing(5)
        self.grid.set_vexpand(True)
        self.grid.set_hexpand(True)
        self.grid.set_column_spacing(2)
        self.grid.set_column_homogeneous(False)
        self.grid.set_row_homogeneous(False)

        label1 = Gtk.Label('key sentence')
        label1.set_justify(Gtk.Justification.LEFT)
        label1.set_halign(Gtk.Align.START)
        label1.set_hexpand(True)
        label2 = Gtk.Label('your command')
        label2.set_justify(Gtk.Justification.LEFT)
        label2.set_halign(Gtk.Align.START)
        ll = Gtk.Label()
        ll.set_vexpand(True)
        self.entry1 = Gtk.Entry()
        if iter is not None:
            self.entry1.set_text(store[iter][0])

        self.combo = self.__get_combobox(store, iter)
        button = Gtk.Button.new_from_stock(Gtk.STOCK_OK)
        button.connect("clicked", self.button_clicked, store, iter)
        button_cancel = Gtk.Button.new_from_stock(Gtk.STOCK_CANCEL)
        button_cancel.connect("clicked", self.do_destroy)

        self.grid.attach(label1, 0, 0, 11, 1)
        self.grid.attach(self.entry1, 11, 0, 4, 1)
        self.grid.attach(label2, 0, 1, 11, 1)
        self.grid.attach(self.combo, 11, 1, 4, 1)
        self.grid.attach(ll, 0, 2, 15, 1)
        self.grid.attach(button_cancel, 13, 3, 1, 1)
        self.grid.attach(button, 14, 3, 1, 1)
        self.grid.show_all()
项目:mama    作者:maateen    | 项目源码 | 文件源码
def __init__(self, store, iter=None):
        self.grid = Gtk.Grid()
        self.grid.set_border_width(5)
        self.grid.set_row_spacing(5)
        self.grid.set_vexpand(True)
        self.grid.set_hexpand(True)
        self.grid.set_column_spacing(2)
        self.grid.set_column_homogeneous(False)
        label1 = Gtk.Label('key sentence')
        label1.set_hexpand(True)
        label1.set_justify(Gtk.Justification.LEFT)
        label1.set_halign(Gtk.Align.START)
        label2 = Gtk.Label('your command')
        label2.set_justify(Gtk.Justification.LEFT)
        label2.set_halign(Gtk.Align.START)
        ll = Gtk.Label()
        ll.set_vexpand(True)
        self.entry1 = Gtk.Entry()
        self.entry2 = Gtk.Entry()

        if iter is not None:
            self.entry1.set_text(store[iter][0])
            self.entry2.set_text(store[iter][1])

        button = Gtk.Button.new_from_stock(Gtk.STOCK_OK)
        button.connect("clicked", self.button_clicked, store, iter)
        button_cancel = Gtk.Button.new_from_stock(Gtk.STOCK_CANCEL)
        button_cancel.connect("clicked", self.do_destroy)

        self.grid.attach(label1, 0, 0, 11, 1)
        self.grid.attach(self.entry1, 11, 0, 4, 1)
        self.grid.attach(label2, 0, 1, 11, 1)
        self.grid.attach(self.entry2, 11, 1, 4, 1)
        self.grid.attach(ll, 0, 2, 15, 1)
        self.grid.attach(button_cancel, 13, 3, 1, 1)
        self.grid.attach(button, 14, 3, 1, 1)
        self.grid.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()
项目: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()
项目:sbrick-controller    作者:wintersandroid    | 项目源码 | 文件源码
def create_channel_box(self, channel_number):
        hbox = Gtk.FlowBox()
        hbox.set_max_children_per_line(8)
        hbox.set_min_children_per_line(8)
        hbox.set_selection_mode(Gtk.SelectionMode.NONE)

        hbox.add(Gtk.Label("Channel: %d" % channel_number))

        hbox.add(Gtk.Label("ID:"))
        id_edit = Gtk.Entry()
        id_edit.set_max_length(5)
        hbox.add(id_edit)

        hbox.add(Gtk.Label("Name:"))
        name_edit = Gtk.Entry()
        name_edit.set_max_length(20)
        hbox.add(name_edit)
        hbox.add(Gtk.Label("Type:"))
        combo_type = Gtk.ComboBoxText()
        combo_type.set_id_column(0)
        combo_type.set_model(self.channelTypeStore)
        renderer_text = Gtk.CellRendererText()
        combo_type.clear()
        combo_type.pack_start(renderer_text, True)
        combo_type.add_attribute(renderer_text, "text", 1)
        hbox.add(combo_type)

        self.content.pack_start(hbox, False, True, 0)
        return id_edit, name_edit, combo_type
项目:sbrick-controller    作者:wintersandroid    | 项目源码 | 文件源码
def __init__(self, parent):
        Gtk.Dialog.__init__(self, "Enter Password", parent, 0,
                            (Gtk.STOCK_CANCEL, Gtk.ResponseType.CANCEL,
                             Gtk.STOCK_OK, Gtk.ResponseType.OK))

        self.set_default_size(150, 100)

        self.input = Gtk.Entry()
        self.input.set_max_length(8)

        box = self.get_content_area()
        box.add(self.input)
        self.show_all()
项目:Lexic    作者:RasmusRendal    | 项目源码 | 文件源码
def __init__(self):
        Gtk.Window.__init__(self, title="LexicGUITest")
        self.set_keep_above(True)
        self.set_decorated(False)

        #Creates the top level parent box contain 2 children boxes
        self.mainBox = Gtk.Box(orientation=Gtk.Orientation.VERTICAL, spacing=20)
        self.add(self.mainBox)

        #Creates the box for the top of the GUI
        self.topBox = Gtk.Box(orientation=Gtk.Orientation.VERTICAL, spacing=6)
        self.mainBox.pack_start(self.topBox, True, True, 0)

        #Create vertical box that the buttons will be placed in
        self.box = Gtk.Box(orientation=Gtk.Orientation.VERTICAL, spacing=6)

        #Add the box to the window
        #self.add(self.box)
        self.mainBox.pack_start(self.box, True, True, 0)

        #Add textField, and add it to the box
        self.searchField = Gtk.Entry()
        self.searchField.connect("key-release-event", enter_check)

        self.topBox.pack_start(self.searchField, True, True, 0)
        self.searchField.set_text("is")

        #Add search button
        self.search = Gtk.Button(label = "Search")
        self.topBox.pack_start(self.search, True, True, 0)
        self.search.connect("clicked", on_search_click, self.searchField.get_text())

        #Add the Suggestions label
        self.label = Gtk.Label(label="Suggestions:")
        self.box.pack_start(self.label, True, True, 0)
项目:Solfege    作者:RannyeriDev    | 项目源码 | 文件源码
def __init__(self, parent, error_text):
        Gtk.Dialog.__init__(self, _("Make bug report"), parent,
                buttons=(Gtk.STOCK_CANCEL, Gtk.ResponseType.REJECT))
        self.m_error_text = error_text
        self.add_button(_("_Send"), RESPONSE_SEND)
        self.set_default_size(400, 400)
        sizegroup = Gtk.SizeGroup(Gtk.SizeGroupMode.HORIZONTAL)
        l = Gtk.Label(_("Information about the version of GNU Solfege, your operating system and Python version, and the Python traceback (error message) will be sent to the crash database. Your email will not be published or shared, but we might contact you by email if we have further questions about your crash report."))
        l.set_line_wrap(True)
        l.show()
        self.vbox.pack_start(l, False, False, 0)
        self.g_email = Gtk.Entry()
        self.vbox.pack_start(
            gu.hig_label_widget(_("_Email:"), self.g_email, sizegroup),
            False, False, 0)
        self.g_email.set_text(cfg.get_string('user/email'))
        # 140 is max in the solfege.org database
        self.g_description = Gtk.Entry()
        self.g_description.set_max_length(140)
        self.vbox.pack_start(
            gu.hig_label_widget(_("S_hort description:"), self.g_description,
                     sizegroup), False, False, 0)
        label = Gtk.Label(label=_("_Describe how to produce the error message:"))
        label.set_use_underline(True)
        label.set_alignment(0.0, 0.5)
        self.vbox.pack_start(label, False, False, 0)
        self.g_tw = Gtk.TextView()
        self.g_tw.set_wrap_mode(Gtk.WrapMode.WORD)
        self.g_tw.set_border_width(10)
        label.set_mnemonic_widget(self.g_tw)
        self.vbox.pack_start(self.g_tw, True, True, 0)
        self.show_all()
项目:Solfege    作者:RannyeriDev    | 项目源码 | 文件源码
def __init__(self):
        Gtk.Dialog.__init__(self, _(u"_Create profile\u2026").replace(u"\u2026", "").replace("_", ""))
        self.add_buttons(Gtk.STOCK_CANCEL, Gtk.ResponseType.CANCEL,
                         Gtk.STOCK_OK, Gtk.ResponseType.ACCEPT)
        vbox = gu.hig_dlg_vbox()
        self.vbox.pack_start(vbox, True, True, 0)
        #
        label = Gtk.Label(label=_("Enter the name of the new folder:"))
        label.set_alignment(0.0, 0.5)
        vbox.pack_start(label, False, False, 0)
        #
        self.g_entry = Gtk.Entry()
        self.g_entry.connect('changed', self.on_entry_changed)
        self.g_entry.set_activates_default(True)
        vbox.pack_start(self.g_entry, False, False, 0)
        #
        label = Gtk.Label(label=_("Your profile data will be stored in:"))
        label.set_alignment(0.0, 0.5)
        vbox.pack_start(label, False, False, 0)
        #
        self.g_profile_location = Gtk.Label()
        vbox.pack_start(self.g_profile_location, False, False, 0)
        #
        self.g_statusbox = Gtk.HBox()
        self.g_statusbox.set_no_show_all(True)
        vbox.pack_start(self.g_statusbox, False, False, 0)
        im = Gtk.Image()
        im.set_from_stock(Gtk.STOCK_DIALOG_WARNING, Gtk.IconSize.MENU)
        self.g_statusbox.pack_start(im, False, False, 0)
        im.show()

        self.g_status = Gtk.Label()
        self.g_status.show()
        self.g_statusbox.pack_start(self.g_status, False, False, 0)
        self.g_entry.set_text(_("New Profile"))
        self.set_default_response(Gtk.ResponseType.ACCEPT)
项目:Solfege    作者:RannyeriDev    | 项目源码 | 文件源码
def __init__(self,  fields=('link',)):
        SelectWinBase.__init__(self)
        self.m_fields = fields
        app = solfege.app
        self.g_box = Gtk.VBox(False, 0)
        self.g_box.set_border_width(gu.hig.SPACE_MEDIUM)
        self.add_with_viewport(self.g_box)
        self.g_searchbox = Gtk.HBox(False, gu.hig.SPACE_SMALL)
        self.g_box.pack_start(self.g_searchbox, False, False, padding=gu.hig.SPACE_MEDIUM)
        self.g_searchentry = Gtk.Entry()
        self.g_searchbox.pack_start(self.g_searchentry, True, True, 0)
        self.g_searchentry.connect('activate', self.on_search)
        gu.bButton(self.g_searchbox, _("Search"), callback=self.on_search, expand=False)
        self.show_all()
项目:Solfege    作者:RannyeriDev    | 项目源码 | 文件源码
def on_edit_linktext(self, menuitem, linked):
        idx = self.m_model.index(linked)
        # row is the hbox containing the linkbutton
        row = self.g_link_box.get_children()[idx]
        linkbutton = row.get_children()[0]
        entry = Gtk.Entry()
        entry.set_text(linkbutton.get_label())
        row.pack_start(entry, True, True, 0)
        linkbutton.hide()
        entry.show()
        entry.grab_focus()

        def finish_edit(entry):
            linkbutton.set_label(entry.get_text().decode("utf-8"))
            linkbutton.get_children()[0].set_alignment(0.0, 0.5)
            linkbutton.show()
            self.m_model[idx].m_name = entry.get_text().decode("utf-8")
            entry.destroy()
        sid = entry.connect('activate', finish_edit)

        def keydown(entry, event):
            if event.keyval == Gdk.KEY_Tab:
                finish_edit(entry)
        entry.connect('key-press-event', keydown)

        def keyup(entry, event):
            if event.keyval == Gdk.KEY_Escape:
                linkbutton.show()
                entry.disconnect(sid)
                entry.destroy()
                return True
        entry.connect('key-release-event', keyup)
项目: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))
项目:bcloud    作者:wangYanJava    | 项目源码 | 文件源码
def __init__(self, app):
        super().__init__(_('Password:'), app.window, Gtk.DialogFlags.MODAL,
                         (Gtk.STOCK_CANCEL, Gtk.ResponseType.CANCEL,
                         Gtk.STOCK_OK, Gtk.ResponseType.OK))

        self.set_default_response(Gtk.ResponseType.OK)
        self.set_default_size(320, 100)
        self.set_border_width(10)
        box = self.get_content_area()

        self.entry = Gtk.Entry()
        self.entry.props.placeholder_text = _('Password ...')
        box.pack_start(self.entry, False, False, 0)

        box.show_all()
项目:bcloud    作者:wangYanJava    | 项目源码 | 文件源码
def __init__(self, parent, app, path):
        super().__init__(_('New Folder'), app.window, Gtk.DialogFlags.MODAL,
                         (Gtk.STOCK_CANCEL, Gtk.ResponseType.CANCEL,
                         Gtk.STOCK_OK, Gtk.ResponseType.OK))
        self.set_default_response(Gtk.ResponseType.OK)
        self.connect('show', self.on_show)
        self.set_default_size(550, 200)

        self.app = app
        self.path = path

        self.set_border_width(10)
        box = self.get_content_area()

        folder_name = _('New Folder')
        abspath = os.path.join(path, folder_name)
        self.entry = Gtk.Entry()
        self.entry.set_text(abspath)
        self.entry.connect('changed', self.on_entry_changed)
        self.entry.connect('activate', self.on_entry_activated)
        box.pack_start(self.entry, True, True, 10)

        self.infobar = Gtk.InfoBar()
        self.infobar.timestamp = 0
        self.infobar.set_message_type(Gtk.MessageType.ERROR)
        box.pack_start(self.infobar, False, False, 0)
        self.info_label= Gtk.Label()
        self.infobar.get_content_area().pack_start(self.info_label, False,
                                                   False, 0)

        box.show_all()
        self.infobar.hide()
项目:bcloud    作者:wangYanJava    | 项目源码 | 文件源码
def __init__(self, parent, app, info):
        super().__init__(_('Verification..'), app.window,
                         Gtk.DialogFlags.MODAL,
                         (Gtk.STOCK_CANCEL, Gtk.ResponseType.CANCEL,
                          Gtk.STOCK_OK, Gtk.ResponseType.OK))

        self.set_default_response(Gtk.ResponseType.OK)
        self.set_default_size(320, 200)
        self.set_border_width(10)
        self.app = app

        box = self.get_content_area()
        box.set_spacing(10)

        gutil.async_call(net.urlopen, info['img'],
                         {'Cookie': app.cookie.header_output()},
                         callback=self.update_img)
        self.img = Gtk.Image()
        box.pack_start(self.img, False, False, 0)

        self.entry = Gtk.Entry()
        self.entry.connect('activate',
                lambda *args: self.response(Gtk.ResponseType.OK))
        box.pack_start(self.entry, False, False, 0)

        box.show_all()
项目:ez_gpg    作者:sgnn7    | 项目源码 | 文件源码
def get_string_from_user(window, message, title="Input required", max_length=None):
        dialog = Gtk.MessageDialog(window,
                                   Gtk.DialogFlags.MODAL | Gtk.DialogFlags.DESTROY_WITH_PARENT,
                                   Gtk.MessageType.QUESTION,
                                   Gtk.ButtonsType.OK_CANCEL,
                                   message)
        dialog.set_title(title)

        dialog.set_default_response(Gtk.ResponseType.OK)

        dialog_box = dialog.get_content_area()

        input_entry = Gtk.Entry()
        input_entry.set_size_request(350,0)

        if max_length != None:
            print("Setting max length to", max_length)
            input_entry.set_max_length(max_length)

        input_entry_holder = Gtk.Box()
        input_entry_holder.pack_end(input_entry, True, False, 0)

        dialog_box.pack_end(input_entry_holder, False, False, 0)
        dialog.show_all()

        def input_entry_activate(*args):
            print("Enter pressed")
            dialog.response(Gtk.ResponseType.OK)

        input_entry.connect('activate', input_entry_activate)

        response = dialog.run()
        text = input_entry.get_text()

        dialog.destroy()

        if (response != Gtk.ResponseType.OK) or len(text) == 0:
            return None

        return text
项目:bokken    作者:thestr4ng3r    | 项目源码 | 文件源码
def create_seek_buttons(self):
        self.hbox = Gtk.HBox(False, 1)

        self.back = Gtk.Button()
        self.back_img = Gtk.Image()
        self.back_img.set_from_stock(Gtk.STOCK_GO_BACK, Gtk.IconSize.MENU)
        self.back.set_image(self.back_img)
        self.back.set_relief(Gtk.ReliefStyle.NONE)
        self.back.connect('clicked', self.do_seek, 'b')

        self.forward = Gtk.Button()
        self.forward_img = Gtk.Image()
        self.forward_img.set_from_stock(Gtk.STOCK_GO_FORWARD, Gtk.IconSize.MENU)
        self.forward.set_image(self.forward_img)
        self.forward.set_relief(Gtk.ReliefStyle.NONE)
        self.forward.connect('clicked', self.do_seek, 'f')

        self.seek = Gtk.Entry()
        self.seek.set_max_length(30)
        self.seek.set_icon_from_stock(1, Gtk.STOCK_JUMP_TO)
        self.seek.set_activates_default(True)
        self.seek.connect("activate", self.goto)
        self.seek.connect("icon-press", self.goto)
        self.seek.set_icon_tooltip_text(1, 'Go')

        self.hbox.pack_start(self.back, False, False, 0)
        self.hbox.pack_start(self.forward, False, False, 0)
        self.hbox.pack_start(self.seek, True, True, 0)

        return self.hbox
项目:Remarkable    作者:jamiemcg    | 项目源码 | 文件源码
def insert_image(self, widget):
        self.insert_window_image = Gtk.Window()
        self.insert_window_image.set_title("Insert Image")
        self.insert_window_image.set_resizable(True)
        self.insert_window_image.set_border_width(6)
        self.insert_window_image.set_default_size(300, 250)
        self.insert_window_image.set_position(Gtk.WindowPosition.CENTER)
        vbox = Gtk.VBox()
        label_alt_text = Gtk.Label("Alt Text:")
        self.entry_alt_text_i = Gtk.Entry()
        label_title = Gtk.Label("Title:")
        self.entry_title_i = Gtk.Entry()
        label_url = Gtk.Label("Path/Url:")
        self.entry_url_i = Gtk.Entry()
        vbox.pack_start(label_alt_text, self, False, False)
        vbox.pack_start(self.entry_alt_text_i, self, False, False)
        vbox.pack_start(label_title, self, False, False)
        vbox.pack_start(self.entry_title_i, self, False, False)
        vbox.pack_start(label_url, self, False, False)
        self.hbox_url = Gtk.HBox()
        self.hbox_url.pack_start(self.entry_url_i, self, True, False)
        self.path_file_button = Gtk.FileChooserButton(title= "Select an image")
        self.path_file_button.connect("file-set", self.file_chooser_button_clicked)
        self.hbox_url.pack_start(self.path_file_button, self, False, False)
        vbox.pack_start(self.hbox_url, self, False, False)
        button = Gtk.Button("Insert Image")
        vbox.pack_end(button, self, False, False)
        self.insert_window_image.add(vbox)
        self.insert_window_image.show_all()
        button.connect("clicked", self.insert_image_cmd, self.insert_window_image)
项目:Remarkable    作者:jamiemcg    | 项目源码 | 文件源码
def insert_link(self, widget):
        self.insert_window_link = Gtk.Window()
        self.insert_window_link.set_title("Insert Link")
        self.insert_window_link.set_resizable(True)
        self.insert_window_link.set_border_width(6)
        self.insert_window_link.set_default_size(350, 250)
        self.insert_window_link.set_position(Gtk.WindowPosition.CENTER)
        vbox = Gtk.VBox()
        label_alt_text = Gtk.Label("Alt Text:")
        self.entry_alt_text = Gtk.Entry()
        label_url = Gtk.Label("Url:")
        self.entry_url = Gtk.Entry()
        vbox.pack_start(label_alt_text, self, False, False)
        vbox.pack_start(self.entry_alt_text, self, False, False)
        vbox.pack_start(label_url, self, False, False)
        vbox.pack_start(self.entry_url, self, False, False)
        button = Gtk.Button("Insert Link")
        vbox.pack_end(button, self, False, False)

        # Use highligted text as the default "alt text"
        if self.text_buffer.get_has_selection():
            start, end = self.text_buffer.get_selection_bounds()
            text = self.text_buffer.get_text(start, end, True)
            self.entry_alt_text.set_text(text)

        self.insert_window_link.add(vbox)
        self.insert_window_link.show_all()
        button.connect("clicked", self.insert_link_cmd, self.insert_window_link)
项目:ghetto_omr    作者:pohzhiee    | 项目源码 | 文件源码
def __init__(self, parent):
        Gtk.Dialog.__init__(self, "Search", parent,
            Gtk.DialogFlags.MODAL, buttons=(
            Gtk.STOCK_FIND, Gtk.ResponseType.OK,
            Gtk.STOCK_CANCEL, Gtk.ResponseType.CANCEL))

        box = self.get_content_area()

        label = Gtk.Label("Insert text you want to search for:")
        box.add(label)

        self.entry = Gtk.Entry()
        box.add(self.entry)

        self.show_all()
项目:ghetto_omr    作者:pohzhiee    | 项目源码 | 文件源码
def __init__(self):
        Gtk.Window.__init__(self, title="FileChooser Example")
        self.maximize()
        self.fold_str = None
        self.grid = Gtk.Grid(column_homogeneous=False,
                             column_spacing=10,
                             row_spacing=0)

        self.add(self.grid)
        button1 = Gtk.Button("Choose File")
        button1.connect("clicked", self.on_file_clicked)
        self.grid.add(button1)

        self.text_file = Gtk.Entry()
        self.grid.attach(self.text_file,1,0,4,1)

        button2 = Gtk.Button("Choose Folder")
        button2.connect("clicked", self.on_folder_clicked)

        button2.set_relief(Gtk.ReliefStyle(0))
        self.grid.attach_next_to(button2,button1,Gtk.PositionType.BOTTOM,1,1)


        self.text_folder = Gtk.Entry()
        self.grid.attach(self.text_folder,1,1,4,1)
        but3=buttontest()
        self.grid.attach(but3,0,2,1,1)
项目:PyFlowChart    作者:steelcowboy    | 项目源码 | 文件源码
def add_prereq(self, button=None, prereq=None):
        """Create a new prereq entry field."""
        new_entry = Gtk.Entry() 
        change_box = self.create_change_box()

        if prereq is not None:
            new_entry.set_text(prereq)

        self.prereq_box.pack_start(new_entry, True, True, 0)
        self.change_buttons_box.pack_end(change_box, True, True, 0)
        self.show_all()
项目:PyFlowChart    作者:steelcowboy    | 项目源码 | 文件源码
def double_click(self, widget, event):
        if event.type == Gdk.EventType._2BUTTON_PRESS:
            if not self.has_entry:
                self.label.destroy()
                self.entry = Gtk.Entry()
                self.entry.connect('activate', self.enter_key)
                self.entry.set_text(self.text)
                self.add(self.entry)
                self.text = None

                self.show_all() 
                self.has_entry = True
        return True
项目:impress-writer    作者:CSEC-NITH    | 项目源码 | 文件源码
def __init__(self, parent):
        Gtk.Dialog.__init__(self, "Search", parent,
            Gtk.DialogFlags.MODAL, buttons=(
            Gtk.STOCK_FIND, Gtk.ResponseType.OK,
            Gtk.STOCK_CANCEL, Gtk.ResponseType.CANCEL))

        box = self.get_content_area()

        label = Gtk.Label("Insert text you want to search for:")
        box.add(label)

        self.entry = Gtk.Entry()
        box.add(self.entry)

        self.show_all()
项目:draobpilc    作者:awamper    | 项目源码 | 文件源码
def __init__(self, name, value, escape=True):
        super().__init__()

        self.set_orientation(Gtk.Orientation.HORIZONTAL)
        self.set_hexpand(True)
        self.set_halign(Gtk.Align.FILL)

        if escape:
            try:
                name = name.encode('unicode_escape').decode('utf8')
            except UnicodeDecodeError:
                pass

            try:
                value = value.encode('unicode_escape').decode('utf8')
            except UnicodeDecodeError:
                pass

        self.name_entry = Gtk.Entry()
        self.name_entry.props.margin = ITEM_MARGIN
        self.name_entry.set_text(name)

        self.value_entry = Gtk.Entry()
        self.value_entry.props.margin = ITEM_MARGIN
        self.value_entry.set_text(value)

        self.delete_btn = Gtk.Button.new_from_icon_name(
            'edit-delete-symbolic',
            Gtk.IconSize.SMALL_TOOLBAR
        )
        self.delete_btn.props.margin = ITEM_MARGIN

        self.add(self.name_entry)
        self.add(self.value_entry)
        self.add(self.delete_btn)

        self.show_all()
项目:draobpilc    作者:awamper    | 项目源码 | 文件源码
def __init__(self):
        super().__init__()

        self.set_name('HistoriesManagerBox')
        self.set_orientation(Gtk.Orientation.HORIZONTAL)
        self.set_halign(Gtk.Align.END)
        self.set_valign(Gtk.Align.CENTER)
        self.set_hexpand(True)
        self.set_vexpand(False)

        self.link = Gtk.LinkButton()
        self.link.connect('activate-link', self._on_activate_link)
        self.link.set_label('...')
        self.link.set_tooltip_text(_('Open histories manager'))

        self._entry = Gtk.Entry()
        self._entry.set_placeholder_text(_('New history'))
        self._entry.set_icon_from_icon_name(
            Gtk.EntryIconPosition.PRIMARY,
            'list-add-symbolic'
        )
        self._entry.connect('activate', self._on_entry_activate)

        self._box = Gtk.Box()
        self._box.set_orientation(Gtk.Orientation.VERTICAL)
        self._box.add(self._entry)

        self.popover = Gtk.Popover()
        self.popover.set_relative_to(self.link)
        self.popover.add(self._box)

        self.add(self.link)

        gpaste_client.connect('SwitchHistory', self.update)
        gpaste_client.connect('DeleteHistory', self.update)
        self.update()
项目:draobpilc    作者:awamper    | 项目源码 | 文件源码
def add_entry(self, text, key):
        item = Gtk.Entry()
        item.set_hexpand(False)
        item.set_text(self._settings[key])
        self._settings.bind(key, item, 'text', Gio.SettingsBindFlags.DEFAULT)

        return self.add_row(text, item)
项目:input-paste    作者:RPing    | 项目源码 | 文件源码
def __init__(self):
        # create a new window
        window = Gtk.Window()
        window.set_position(Gtk.WindowPosition.CENTER)
        window.set_name('window')
        window.set_title("Input Helper")
        window.set_decorated(False)

        window.set_default_size(300, 40)
        window.connect("destroy", self.destroy)

        self.entry = Gtk.Entry()
        self.entry.set_name('entry')
        self.entry.connect("key_press_event", self.on_key_press)

        self.clipboard = Gtk.Clipboard.get(Gdk.SELECTION_CLIPBOARD)

        style_provider = Gtk.CssProvider()
        base_dir = os.path.abspath(os.path.dirname(__file__))
        css_path = os.path.join(base_dir, 'input_paste.css')
        style_provider.load_from_file(Gio.File.new_for_path(css_path))
        Gtk.StyleContext.add_provider_for_screen(
            Gdk.Screen.get_default(),
            style_provider,
            Gtk.STYLE_PROVIDER_PRIORITY_APPLICATION
        )

        window.add(self.entry)
        window.show_all()
项目:google-tasks-indicator    作者:atareao    | 项目源码 | 文件源码
def __init__(self, window, format="dmy", separator='/', value = datetime.date.today()):
        Gtk.HBox.__init__(self)
        self.format = format
        self.separator = separator
        self._window = window
        self.entry = Gtk.Entry()
        self.entry.set_editable(False)
        self.button = Gtk.Button()
        self.button.add(Gtk.Arrow.new(Gtk.ArrowType.DOWN, Gtk.ShadowType.IN))
        self.button.connect('clicked', self.on_button)
        self.pack_start(self.entry, 0, 0, 0)
        self.pack_start(self.button, 0, 0, 0)
        self.month_changed = False
        self.set_date(value)