python类Entry()的实例源码

configuration_window.py 文件源码 项目:susi_linux 作者: fossasia 项目源码 文件源码 阅读 22 收藏 0 点赞 0 评论 0
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()
main.py 文件源码 项目:PyIDE 作者: raggesilver 项目源码 文件源码 阅读 22 收藏 0 点赞 0 评论 0
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.py 文件源码 项目:efibootmgr-gui 作者: Elinvention 项目源码 文件源码 阅读 39 收藏 0 点赞 0 评论 0
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
profilemanager.py 文件源码 项目:Solfege 作者: RannyeriDev 项目源码 文件源码 阅读 25 收藏 0 点赞 0 评论 0
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)
notenamespinbutton.py 文件源码 项目:Solfege 作者: RannyeriDev 项目源码 文件源码 阅读 22 收藏 0 点赞 0 评论 0
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
inputbox_window.py 文件源码 项目:MokaPlayer 作者: vedard 项目源码 文件源码 阅读 22 收藏 0 点赞 0 评论 0
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)
PromptDialog.py 文件源码 项目:MPV-VJ2 作者: paulguy 项目源码 文件源码 阅读 23 收藏 0 点赞 0 评论 0
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)
stream_select.py 文件源码 项目:chromecast-player 作者: wa4557 项目源码 文件源码 阅读 20 收藏 0 点赞 0 评论 0
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
gstream_test_2.py 文件源码 项目:hackfair-speech 作者: DjangoGirlsSeoul 项目源码 文件源码 阅读 19 收藏 0 点赞 0 评论 0
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)
dynamic_sizing.py 文件源码 项目:ghetto_omr 作者: pohzhiee 项目源码 文件源码 阅读 23 收藏 0 点赞 0 评论 0
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)
editable_label.py 文件源码 项目:PyFlowChart 作者: steelcowboy 项目源码 文件源码 阅读 24 收藏 0 点赞 0 评论 0
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()
widget.py 文件源码 项目:MTodo 作者: mortezaipo 项目源码 文件源码 阅读 33 收藏 0 点赞 0 评论 0
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)
VulnerabilitiesSpider.py 文件源码 项目:Vulnerabilities-spider 作者: muhammad-bouabid 项目源码 文件源码 阅读 19 收藏 0 点赞 0 评论 0
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 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~#
functions.py 文件源码 项目:poseidon 作者: sidus-dev 项目源码 文件源码 阅读 26 收藏 0 点赞 0 评论 0
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_tags.py 文件源码 项目:tmsu-nautilus-python 作者: talklittle 项目源码 文件源码 阅读 25 收藏 0 点赞 0 评论 0
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)
stickies.py 文件源码 项目:sticky-notes 作者: rubyAce71697 项目源码 文件源码 阅读 32 收藏 0 点赞 0 评论 0
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
configuration_window.py 文件源码 项目:susi_linux 作者: fossasia 项目源码 文件源码 阅读 23 收藏 0 点赞 0 评论 0
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()
account_row.py 文件源码 项目:Gnome-Authenticator 作者: bil-elmoussaoui 项目源码 文件源码 阅读 27 收藏 0 点赞 0 评论 0
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()
add_account.py 文件源码 项目:Gnome-Authenticator 作者: bil-elmoussaoui 项目源码 文件源码 阅读 29 收藏 0 点赞 0 评论 0
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()
change_password.py 文件源码 项目:Gnome-Authenticator 作者: bil-elmoussaoui 项目源码 文件源码 阅读 21 收藏 0 点赞 0 评论 0
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)
InternalWindow.py 文件源码 项目:mama 作者: maateen 项目源码 文件源码 阅读 31 收藏 0 点赞 0 评论 0
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()
ExternalWindow.py 文件源码 项目:mama 作者: maateen 项目源码 文件源码 阅读 24 收藏 0 点赞 0 评论 0
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()
filedownloader.py 文件源码 项目:ubi-virtual-assistant 作者: Alzemand 项目源码 文件源码 阅读 37 收藏 0 点赞 0 评论 0
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()
filedownloader.py 文件源码 项目:ubi-virtual-assistant 作者: Alzemand 项目源码 文件源码 阅读 21 收藏 0 点赞 0 评论 0
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()
SBrickConfigureDialog.py 文件源码 项目:sbrick-controller 作者: wintersandroid 项目源码 文件源码 阅读 23 收藏 0 点赞 0 评论 0
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
PasswordDialog.py 文件源码 项目:sbrick-controller 作者: wintersandroid 项目源码 文件源码 阅读 25 收藏 0 点赞 0 评论 0
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()
LexicGUILauncher.py 文件源码 项目:Lexic 作者: RasmusRendal 项目源码 文件源码 阅读 22 收藏 0 点赞 0 评论 0
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)
reportbug.py 文件源码 项目:Solfege 作者: RannyeriDev 项目源码 文件源码 阅读 28 收藏 0 点赞 0 评论 0
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()
profilemanager.py 文件源码 项目:Solfege 作者: RannyeriDev 项目源码 文件源码 阅读 22 收藏 0 点赞 0 评论 0
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)
esel.py 文件源码 项目:Solfege 作者: RannyeriDev 项目源码 文件源码 阅读 28 收藏 0 点赞 0 评论 0
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()


问题


面经


文章

微信
公众号

扫码关注公众号