致命的 #525 » a.diff
core/mui/gtk_intelligent_textview.rb (作業コピー) | ||
---|---|---|
Plugin.create :gtk_intelligent_textview do
|
||
on_entity_linkrule_added do |rule|
|
||
Gtk::IntelligentTextview.addlinkrule(rule[:regexp], lambda{ |seg, tv| rule[:callback].call(face: seg, url: seg, textview: tv) }) if rule[:regexp]
|
||
::Gtk::IntelligentTextview.addlinkrule(rule[:regexp], lambda{ |seg, tv| rule[:callback].call(face: seg, url: seg, textview: tv) }) if rule[:regexp]
|
||
end
|
||
end
|
core/mui/cairo_sub_parts_retweet.rb (作業コピー) | ||
---|---|---|
begin
|
||
mp.subparts.find{ |sp| sp.class == Gdk::SubPartsRetweet }.add(retweet[:user])
|
||
mp.on_modify
|
||
rescue Gtk::MiraclePainter::DestroyedError
|
||
rescue ::Gtk::MiraclePainter::DestroyedError
|
||
nil end end } }.terminate("retweet error") } end
|
||
on_retweet_destroyed do |source, user, retweet_id|
|
||
... | ... | |
begin
|
||
mp.subparts.find{ |sp| sp.class == Gdk::SubPartsRetweet }.delete(user)
|
||
mp.on_modify
|
||
rescue Gtk::MiraclePainter::DestroyedError
|
||
rescue ::Gtk::MiraclePainter::DestroyedError
|
||
nil end end }.terminate("retweet destroy error")
|
||
}
|
||
end
|
core/plugin/proxy/proxy.rb (作業コピー) | ||
---|---|---|
end
|
||
# def settings
|
||
# box = Gtk::VBox.new(false, 8)
|
||
# box = ::Gtk::VBox.new(false, 8)
|
||
# radio_tag = radio_specify = Gtk::RadioButton.new('自分で設定する')
|
||
# radio_envval = Gtk::RadioButton.new(radio_tag, '環境変数の設定を使う')
|
||
# radio_disable = Gtk::RadioButton.new(radio_tag, 'プロキシを使わない')
|
||
# radio_tag = radio_specify = ::Gtk::RadioButton.new('自分で設定する')
|
||
# radio_envval = ::Gtk::RadioButton.new(radio_tag, '環境変数の設定を使う')
|
||
# radio_disable = ::Gtk::RadioButton.new(radio_tag, 'プロキシを使わない')
|
||
# case UserConfig[:proxy_enabled]
|
||
# when :specify
|
||
... | ... | |
# UserConfig.connect(:proxy_cert){ |key, new_val, before_val, id|
|
||
# us.sensitive = pw.sensitive = new_val }
|
||
# Gtk::EventBox.new.add(Gtk::VBox.new(false, 8).closeup(sv).closeup(pt).closeup(auth_group))
|
||
# ::Gtk::EventBox.new.add(::Gtk::VBox.new(false, 8).closeup(sv).closeup(pt).closeup(auth_group))
|
||
# end
|
||
# def gen_envval_ev
|
||
... | ... | |
# pt = Mtk.input(env_getter[1], "ポート"){|c,i|i.sensitive = false}
|
||
# us = Mtk.input(env_getter[2], "ユーザ"){|c,i|i.sensitive = false}
|
||
# pw = Mtk.input(env_getter[3], "パスワード"){|c,i|i.sensitive = false}
|
||
# Gtk::EventBox.new.add(Gtk::VBox.new(false, 8).closeup(sv).closeup(pt).closeup(us).closeup(pw))
|
||
# ::Gtk::EventBox.new.add(::Gtk::VBox.new(false, 8).closeup(sv).closeup(pt).closeup(us).closeup(pw))
|
||
# end
|
||
# end
|
core/plugin/shortcutkey/shortcutkey.rb (作業コピー) | ||
---|---|---|
# -*- coding:utf-8 -*-
|
||
Plugin.create :shortcutkey do
|
||
class ShortcutKeyListView < Gtk::CRUD
|
||
class ShortcutKeyListView < ::Gtk::CRUD
|
||
COLUMN_KEYBIND = 0
|
||
COLUMN_COMMAND = 1
|
core/plugin/gtk/gtk.rb (作業コピー) | ||
---|---|---|
require File.expand_path File.join(File.dirname(__FILE__), 'delayer')
|
||
Plugin.create :gtk do
|
||
@windows_by_slug = {} # slug => Gtk::MikutterWindow
|
||
@panes_by_slug = {} # slug => Gtk::NoteBook
|
||
@tabs_by_slug = {} # slug => Gtk::EventBox
|
||
@timelines_by_slug = {} # slug => Gtk::TimeLine
|
||
@profiles_by_slug = {} # slug => Gtk::NoteBook
|
||
@profiletabs_by_slug = {} # slug => Gtk::EventBox
|
||
@tabchildwidget_by_slug = {} # slug => Gtk::TabChildWidget
|
||
@postboxes_by_slug = {} # slug => Gtk::Postbox
|
||
@windows_by_slug = {} # slug => ::Gtk::MikutterWindow
|
||
@panes_by_slug = {} # slug => ::Gtk::NoteBook
|
||
@tabs_by_slug = {} # slug => ::Gtk::EventBox
|
||
@timelines_by_slug = {} # slug => ::Gtk::TimeLine
|
||
@profiles_by_slug = {} # slug => ::Gtk::NoteBook
|
||
@profiletabs_by_slug = {} # slug => ::Gtk::EventBox
|
||
@tabchildwidget_by_slug = {} # slug => ::Gtk::TabChildWidget
|
||
@postboxes_by_slug = {} # slug => ::Gtk::Postbox
|
||
@tabs_promise = {} # slug => Deferred
|
||
TABPOS = [Gtk::POS_TOP, Gtk::POS_BOTTOM, Gtk::POS_LEFT, Gtk::POS_RIGHT]
|
||
TABPOS = [::Gtk::POS_TOP, ::Gtk::POS_BOTTOM, ::Gtk::POS_LEFT, ::Gtk::POS_RIGHT]
|
||
# ウィンドウ作成。
|
||
# PostBoxとか複数のペインを持つための処理が入るので、Gtk::MikutterWindowクラスを新設してそれを使う
|
||
# PostBoxとか複数のペインを持つための処理が入るので、::Gtk::MikutterWindowクラスを新設してそれを使う
|
||
on_window_created do |i_window|
|
||
notice "create window #{i_window.slug.inspect}"
|
||
window = Gtk::MikutterWindow.new
|
||
window = ::Gtk::MikutterWindow.new
|
||
@windows_by_slug[i_window.slug] = window
|
||
window.title = i_window.name
|
||
window.set_size_request(240, 240)
|
||
... | ... | |
window.ssc("destroy"){
|
||
Delayer.freeze
|
||
window.destroy
|
||
Gtk::Object.main_quit
|
||
::Gtk::Object.main_quit
|
||
# Gtk.main_quit
|
||
false }
|
||
window.ssc(:focus_in_event) {
|
||
... | ... | |
false
|
||
}
|
||
window.ssc('key_press_event'){ |widget, event|
|
||
Plugin::GUI.keypress(Gtk::keyname([event.keyval ,event.state]), i_window) }
|
||
Plugin::GUI.keypress(::Gtk::keyname([event.keyval ,event.state]), i_window) }
|
||
window.show_all
|
||
end
|
||
... | ... | |
window.icon = Gdk::Pixbuf.new(icon, 256, 256) end end
|
||
# ペイン作成。
|
||
# ペインはGtk::NoteBook
|
||
# ペインは::Gtk::NoteBook
|
||
on_pane_created do |i_pane|
|
||
pane = create_pane(i_pane)
|
||
pane.set_tab_border(0).set_group_id(0).set_scrollable(true)
|
||
... | ... | |
else
|
||
notice "switch_page: pagenum(#{pagenum}) != pane.page(#{pane.page})" end }
|
||
pane.signal_connect(:page_added){ |this, tabcontainer, index|
|
||
type_strict tabcontainer => Gtk::TabContainer
|
||
type_strict tabcontainer => ::Gtk::TabContainer
|
||
notice "on_pane_created: page_added: #{i_pane.inspect}"
|
||
window_order_save_request(i_pane.parent) if i_pane.parent
|
||
i_tab = tabcontainer.i_tab
|
||
... | ... | |
end
|
||
# タブ作成。
|
||
# タブには実体が無いので、タブのアイコンのところをGtk::EventBoxにしておいて、それを実体ということにしておく
|
||
# タブには実体が無いので、タブのアイコンのところを::Gtk::EventBoxにしておいて、それを実体ということにしておく
|
||
on_tab_created do |i_tab|
|
||
tab = create_tab(i_tab)
|
||
if @tabs_promise[i_tab.slug]
|
||
... | ... | |
# ==== Args
|
||
# [i_tab] タブ
|
||
# ==== Return
|
||
# Tab(Gtk::EventBox)
|
||
# Tab(::Gtk::EventBox)
|
||
def create_tab(i_tab)
|
||
notice "create tab #{i_tab.slug.inspect}"
|
||
tab = Gtk::EventBox.new.tooltip(i_tab.name)
|
||
tab = ::Gtk::EventBox.new.tooltip(i_tab.name)
|
||
if i_tab.is_a? Plugin::GUI::Tab
|
||
@tabs_by_slug[i_tab.slug] = tab
|
||
elsif i_tab.is_a? Plugin::GUI::ProfileTab
|
||
... | ... | |
false
|
||
}
|
||
tab.ssc(:key_press_event){ |widget, event|
|
||
Plugin::GUI.keypress(Gtk::keyname([event.keyval ,event.state]), i_tab) }
|
||
Plugin::GUI.keypress(::Gtk::keyname([event.keyval ,event.state]), i_tab) }
|
||
tab.ssc(:button_press_event) { |this, e|
|
||
if e.button == 3
|
||
Plugin::GUI::Command.menu_pop(i_tab) end
|
||
... | ... | |
tab.show_all end
|
||
# タイムライン作成。
|
||
# Gtk::TimeLine
|
||
# ::Gtk::TimeLine
|
||
on_timeline_created do |i_timeline|
|
||
notice "create timeline #{i_timeline.slug.inspect}"
|
||
timeline = Gtk::TimeLine.new(i_timeline)
|
||
timeline = ::Gtk::TimeLine.new(i_timeline)
|
||
@timelines_by_slug[i_timeline.slug] = timeline
|
||
focus_in_event = lambda { |this, event|
|
||
if this.focus?
|
||
... | ... | |
timeline.tl.ssc(:focus_in_event, &focus_in_event)
|
||
timeline.tl.ssc(:destroy, &destroy_event)
|
||
timeline.ssc('key_press_event'){ |widget, event|
|
||
Plugin::GUI.keypress(Gtk::keyname([event.keyval ,event.state]), i_timeline) }
|
||
Plugin::GUI.keypress(::Gtk::keyname([event.keyval ,event.state]), i_timeline) }
|
||
timeline.ssc(:destroy){
|
||
i_timeline.destroy
|
||
false }
|
||
... | ... | |
next if not widget
|
||
tab = widgetof(i_tab)
|
||
pane = widgetof(i_pane)
|
||
old_pane = widget.get_ancestor(Gtk::Notebook)
|
||
old_pane = widget.get_ancestor(::Gtk::Notebook)
|
||
notice "pane: #{pane}, old_pane: #{old_pane}"
|
||
if tab and pane and old_pane and pane != old_pane
|
||
notice "#{widget} removes by #{old_pane}"
|
||
... | ... | |
if page_num
|
||
tab.parent.remove_page(page_num)
|
||
else
|
||
raise Plugin::Gtk::GtkError, "#{tab} not found in #{tab.parent}" end end
|
||
raise ::Gtk::GtkError, "#{tab} not found in #{tab.parent}" end end
|
||
notice "#{widget} pack to #{tab}"
|
||
i_tab.children.each{ |i_child|
|
||
w_child = widgetof(i_child)
|
||
... | ... | |
i_postbox.active!(true, true)
|
||
false }
|
||
postbox.post.ssc('key_press_event'){ |widget, event|
|
||
Plugin::GUI.keypress(Gtk::keyname([event.keyval ,event.state]), i_postbox) }
|
||
Plugin::GUI.keypress(::Gtk::keyname([event.keyval ,event.state]), i_postbox) }
|
||
postbox.post.ssc(:destroy){
|
||
i_postbox.destroy
|
||
false }
|
||
... | ... | |
on_gui_contextmenu do |event, contextmenu|
|
||
widget = widgetof(event.widget)
|
||
if widget
|
||
Gtk::ContextMenu.new(*contextmenu).popup(widget, event) end end
|
||
::Gtk::ContextMenu.new(*contextmenu).popup(widget, event) end end
|
||
on_gui_timeline_clear do |i_timeline|
|
||
timeline = widgetof(i_timeline)
|
||
... | ... | |
if container
|
||
return container.pack_start(widget, i_tab.pack_rule[container.children.size]) end end
|
||
if tab.parent
|
||
raise Plugin::Gtk::GtkError, "Gtk Widget #{tab.inspect} of Tab(#{i_tab.slug.inspect}) has parent Gtk Widget #{tab.parent.inspect}" end
|
||
container = Gtk::TabContainer.new(i_tab).show_all
|
||
raise ::Gtk::GtkError, "Gtk Widget #{tab.inspect} of Tab(#{i_tab.slug.inspect}) has parent Gtk Widget #{tab.parent.inspect}" end
|
||
container = ::Gtk::TabContainer.new(i_tab).show_all
|
||
container.ssc(:key_press_event){ |w, event|
|
||
Plugin::GUI.keypress(Gtk::keyname([event.keyval ,event.state]), i_tab) }
|
||
Plugin::GUI.keypress(::Gtk::keyname([event.keyval ,event.state]), i_tab) }
|
||
container.pack_start(widget, i_tab.pack_rule[container.children.size])
|
||
pane.insert_page_menu(where_should_insert_it(i_tab, pane.children.map(&:i_tab), i_pane.children), container, tab)
|
||
pane.set_tab_reorderable(container, true).set_tab_detachable(container, true)
|
||
... | ... | |
if tab
|
||
tab.remove(tab.child) if tab.child
|
||
if i_tab.icon.is_a?(String)
|
||
tab.add(Gtk::WebIcon.new(i_tab.icon, 24, 24).show)
|
||
tab.add(::Gtk::WebIcon.new(i_tab.icon, 24, 24).show)
|
||
else
|
||
tab.add(Gtk::Label.new(i_tab.name).show) end end
|
||
tab.add(::Gtk::Label.new(i_tab.name).show) end end
|
||
self end
|
||
def get_window_geometry(slug)
|
||
... | ... | |
# ==== Args
|
||
# [i_pane] ペイン
|
||
# ==== Return
|
||
# ペイン(Gtk::Notebook)
|
||
# ペイン(::Gtk::Notebook)
|
||
def create_pane(i_pane)
|
||
notice "create pane #{i_pane.slug.inspect}"
|
||
pane = Gtk::Notebook.new
|
||
pane = ::Gtk::Notebook.new
|
||
if i_pane.is_a? Plugin::GUI::Pane
|
||
@panes_by_slug[i_pane.slug] = pane
|
||
elsif i_pane.is_a? Plugin::GUI::Profile
|
||
@profiles_by_slug[i_pane.slug] = pane end
|
||
pane.ssc('key_press_event'){ |widget, event|
|
||
Plugin::GUI.keypress(Gtk::keyname([event.keyval ,event.state]), i_pane) }
|
||
Plugin::GUI.keypress(::Gtk::keyname([event.keyval ,event.state]), i_pane) }
|
||
pane.ssc(:destroy){
|
||
i_pane.destroy if i_pane.destroyed?
|
||
false }
|
||
... | ... | |
# ==== Return
|
||
# _widget_ に対応するウィジェットオブジェクトまたは偽
|
||
def find_implement_widget_by_gtkwidget(widget)
|
||
type_strict widget => Gtk::Widget
|
||
type_strict widget => ::Gtk::Widget
|
||
[
|
||
[@windows_by_slug, Plugin::GUI::Window],
|
||
[@panes_by_slug, Plugin::GUI::Pane],
|
core/plugin/gtk/mikutter_window.rb (作業コピー) | ||
---|---|---|
require "gtk2"
|
||
class Gtk::MikutterWindow < Gtk::Window
|
||
class ::Gtk::MikutterWindow < ::Gtk::Window
|
||
attr_reader :panes, :statusbar
|
||
def initialize(*args)
|
||
super
|
||
@container = Gtk::VBox.new(false, 0)
|
||
@panes = Gtk::HBox.new(true, 0)
|
||
@postboxes = Gtk::VBox.new(false, 0)
|
||
@container = ::Gtk::VBox.new(false, 0)
|
||
@panes = ::Gtk::HBox.new(true, 0)
|
||
@postboxes = ::Gtk::VBox.new(false, 0)
|
||
add(@container.closeup(@postboxes).pack_start(@panes).closeup(create_statusbar))
|
||
end
|
||
def add_postbox(i_postbox)
|
||
postbox = Gtk::PostBox.new(i_postbox.poster || Service.primary, {postboxstorage: @postboxes, delegate_other: true}.merge(i_postbox.options||{}))
|
||
postbox = ::Gtk::PostBox.new(i_postbox.poster || Service.primary, {postboxstorage: @postboxes, delegate_other: true}.merge(i_postbox.options||{}))
|
||
@postboxes.pack_start(postbox)
|
||
set_focus(postbox.post)
|
||
postbox.show_all end
|
||
# def set_focus(widget)
|
||
# if widget.is_a? Gtk::TimeLine
|
||
# if widget.is_a? ::Gtk::TimeLine
|
||
|
||
# end
|
||
# end
|
||
... | ... | |
# ステータスバーを返す
|
||
# ==== Return
|
||
# Gtk::Statusbar
|
||
# ::Gtk::Statusbar
|
||
def create_statusbar
|
||
statusbar = Gtk::Statusbar.new
|
||
statusbar = ::Gtk::Statusbar.new
|
||
notice "statusbar: context id: #{statusbar.get_context_id("system")}"
|
||
statusbar.push(statusbar.get_context_id("system"), "mikutterの誕生以来、最も大きな驚きを")
|
||
status_button = Gtk::Button.new.add(Gtk::WebIcon.new(MUI::Skin.get("settings.png"), 16, 16))
|
||
status_button.relief = Gtk::RELIEF_NONE
|
||
status_button = ::Gtk::Button.new.add(::Gtk::WebIcon.new(MUI::Skin.get("settings.png"), 16, 16))
|
||
status_button.relief = ::Gtk::RELIEF_NONE
|
||
status_button.ssc(:clicked) {
|
||
Plugin.call(:gui_setting) }
|
||
@statusbar = statusbar.closeup(status_button) end
|
core/plugin/activity/activity.rb (作業コピー) | ||
---|---|---|
end
|
||
Plugin.create(:activity) do
|
||
class ActivityView < Gtk::CRUD
|
||
include Gtk::TreeViewPrettyScroll
|
||
class ActivityView < ::Gtk::CRUD
|
||
include ::Gtk::TreeViewPrettyScroll
|
||
ICON = 0
|
||
KIND = 1
|
||
... | ... | |
not result.all?(&ret_nth) end
|
||
activity_view = ActivityView.new
|
||
activity_vscrollbar = Gtk::VScrollbar.new(activity_view.vadjustment)
|
||
activity_hscrollbar = Gtk::HScrollbar.new(activity_view.hadjustment)
|
||
activity_shell = Gtk::Table.new(2, 2)
|
||
activity_description = Gtk::IntelligentTextview.new
|
||
activity_status = Gtk::Label.new
|
||
activity_container = Gtk::VBox.new
|
||
activity_vscrollbar = ::Gtk::VScrollbar.new(activity_view.vadjustment)
|
||
activity_hscrollbar = ::Gtk::HScrollbar.new(activity_view.hadjustment)
|
||
activity_shell = ::Gtk::Table.new(2, 2)
|
||
activity_description = ::Gtk::IntelligentTextview.new
|
||
activity_status = ::Gtk::Label.new
|
||
activity_container = ::Gtk::VBox.new
|
||
activity_container.
|
||
pack_start(activity_shell.
|
||
attach(activity_view, 0, 1, 0, 1, Gtk::FILL|Gtk::SHRINK|Gtk::EXPAND, Gtk::FILL|Gtk::SHRINK|Gtk::EXPAND).
|
||
attach(activity_vscrollbar, 1, 2, 0, 1, Gtk::FILL, Gtk::SHRINK|Gtk::FILL).
|
||
attach(activity_hscrollbar, 0, 1, 1, 2, Gtk::SHRINK|Gtk::FILL, Gtk::FILL)).
|
||
attach(activity_view, 0, 1, 0, 1, ::Gtk::FILL|::Gtk::SHRINK|::Gtk::EXPAND, ::Gtk::FILL|::Gtk::SHRINK|::Gtk::EXPAND).
|
||
attach(activity_vscrollbar, 1, 2, 0, 1, ::Gtk::FILL, ::Gtk::SHRINK|::Gtk::FILL).
|
||
attach(activity_hscrollbar, 0, 1, 1, 2, ::Gtk::SHRINK|::Gtk::FILL, ::Gtk::FILL)).
|
||
closeup(activity_description).
|
||
closeup(activity_status.right)
|
||
core/plugin/openimg/openimg.rb (作業コピー) | ||
---|---|---|
def changesize(eb, w, url)
|
||
eb.remove(eb.children.first)
|
||
@size = w.window.geometry[2,2].freeze
|
||
eb.add(Gtk::WebIcon.new(url, *@size).show_all)
|
||
eb.add(::Gtk::WebIcon.new(url, *@size).show_all)
|
||
@size end
|
||
def redraw(eb, pb)
|
||
... | ... | |
eb.window.draw_pixbuf(nil, pb, 0, 0, (ew - pb.width)/2, (eh - pb.height)/2, -1, -1, Gdk::RGB::DITHER_NORMAL, 0, 0) end
|
||
def display(url, cancel = nil)
|
||
w = Gtk::Window.new.set_title("(読み込み中)")
|
||
w = ::Gtk::Window.new.set_title("(読み込み中)")
|
||
w.set_size_request(320, 240)
|
||
w.set_default_size(*@size).move(*@position)
|
||
w.signal_connect(:destroy){ w.destroy }
|
||
eventbox = Gtk::EventBox.new
|
||
eventbox = ::Gtk::EventBox.new
|
||
w.add(eventbox)
|
||
size = DEFAULT_SIZE
|
||
Thread.new{
|
||
... | ... | |
def addsupport(cond, element_rule = {}, &block)
|
||
element_rule.freeze
|
||
if block == nil
|
||
Gtk::TimeLine.addopenway(cond){ |shrinked_url, cancel|
|
||
::Gtk::TimeLine.addopenway(cond){ |shrinked_url, cancel|
|
||
url = MessageConverters.expand_url_one(shrinked_url)
|
||
Delayer.new(Delayer::NORMAL, Thread.new{ imgurlresolver(url, element_rule) }){ |url|
|
||
display(url, cancel)
|
||
}
|
||
}
|
||
else
|
||
Gtk::TimeLine.addopenway(cond){ |shrinked_url, cancel|
|
||
::Gtk::TimeLine.addopenway(cond){ |shrinked_url, cancel|
|
||
url = MessageConverters.expand_url_one(shrinked_url)
|
||
Delayer.new(Delayer::NORMAL, Thread.new{
|
||
imgurlresolver(url, element_rule){ |url| block.call(url, cancel) }
|
||
... | ... | |
end
|
||
}
|
||
Gtk::TimeLine.addopenway(/.*\.(?:jpg|png|gif|)$/) { |shrinked_url, cancel|
|
||
::Gtk::TimeLine.addopenway(/.*\.(?:jpg|png|gif|)$/) { |shrinked_url, cancel|
|
||
url = MessageConverters.expand_url_one(shrinked_url)
|
||
Delayer.new(Delayer::NORMAL) { display(url, cancel) }
|
||
}
|
core/plugin/settings/select.rb (作業コピー) | ||
---|---|---|
# ウィジェット
|
||
def build(label, config)
|
||
if has_widget?
|
||
group = Gtk::Frame.new.set_border_width(8)
|
||
group = ::Gtk::Frame.new.set_border_width(8)
|
||
group.set_label(label)
|
||
group.add(build_box(Plugin::Settings::Listener[config]))
|
||
group
|
||
else
|
||
Gtk::HBox.new(false, 0).add(Gtk::Label.new(label).left).closeup(build_combobox(Plugin::Settings::Listener[config])) end end
|
||
::Gtk::HBox.new(false, 0).add(::Gtk::Label.new(label).left).closeup(build_combobox(Plugin::Settings::Listener[config])) end end
|
||
private
|
||
def build_box(listener)
|
||
box = Gtk::VBox.new
|
||
group = Gtk::RadioButton.new
|
||
box = ::Gtk::VBox.new
|
||
group = ::Gtk::RadioButton.new
|
||
options = @options
|
||
box.instance_eval{
|
||
options.each{ |value, face, setting|
|
||
radio = nil
|
||
if (not setting) and face.is_a? String
|
||
closeup radio = Gtk::RadioButton.new(group, face)
|
||
closeup radio = ::Gtk::RadioButton.new(group, face)
|
||
elsif setting.is_a? Plugin::Settings
|
||
if face.is_a? String
|
||
container = Gtk::Table.new(2, 2)
|
||
radio = Gtk::RadioButton.new(group)
|
||
container.attach(radio, 0, 1, 0, 1, Gtk::FILL, Gtk::FILL)
|
||
container.attach(Gtk::Label.new(face).left, 1, 2, 0, 1, Gtk::SHRINK|Gtk::FILL, Gtk::FILL)
|
||
container.attach(setting, 1, 2, 1, 2, Gtk::FILL|Gtk::SHRINK|Gtk::EXPAND, Gtk::FILL|Gtk::SHRINK|Gtk::EXPAND)
|
||
container = ::Gtk::Table.new(2, 2)
|
||
radio = ::Gtk::RadioButton.new(group)
|
||
container.attach(radio, 0, 1, 0, 1, ::Gtk::FILL, ::Gtk::FILL)
|
||
container.attach(::Gtk::Label.new(face).left, 1, 2, 0, 1, ::Gtk::SHRINK|::Gtk::FILL, ::Gtk::FILL)
|
||
container.attach(setting, 1, 2, 1, 2, ::Gtk::FILL|::Gtk::SHRINK|::Gtk::EXPAND, ::Gtk::FILL|::Gtk::SHRINK|::Gtk::EXPAND)
|
||
closeup container
|
||
else
|
||
container = Gtk::HBox.new
|
||
radio = Gtk::RadioButton.new(group)
|
||
container = ::Gtk::HBox.new
|
||
radio = ::Gtk::RadioButton.new(group)
|
||
closeup container.closeup(radio).add(setting) end
|
||
end
|
||
radio.signal_connect('toggled'){ |widget|
|
||
listener.set value if widget.active?
|
||
setting.sensitive = widget.active? if setting.is_a? Gtk::Widget }
|
||
setting.sensitive = widget.active? if setting.is_a? ::Gtk::Widget }
|
||
notice "#{listener.get.inspect} == #{value.inspect}"
|
||
radio.active = listener.get == value
|
||
face.sensitive = radio.active? if face.is_a? Gtk::Widget } }
|
||
face.sensitive = radio.active? if face.is_a? ::Gtk::Widget } }
|
||
box end
|
||
# すべてテキストなら、コンボボックスで要素を描画する
|
||
def build_combobox(listener)
|
||
input = Gtk::ComboBox.new(true)
|
||
input = ::Gtk::ComboBox.new(true)
|
||
sorted = @options.map{ |o| o.first }.sort_by(&:to_s).freeze
|
||
sorted.each{ |x|
|
||
input.append_text(@options.assoc(x).last) }
|
core/plugin/settings/settings.rb (作業コピー) | ||
---|---|---|
def setting_window
|
||
return @window if defined?(@window) and @window
|
||
record_order = UserConfig[:settings_menu_order] || ["基本設定", "入力", "表示", "通知", "ショートカットキー", "アクティビティ", "アカウント情報"]
|
||
@window = window = Gtk::Window.new("設定")
|
||
@window = window = ::Gtk::Window.new("設定")
|
||
window.set_size_request(320, 240)
|
||
window.set_default_size(640, 480)
|
||
widgets_dict = {}
|
||
menu = menu_widget(widgets_dict)
|
||
settings = Gtk::VBox.new.set_no_show_all(true).show
|
||
scrolled = Gtk::ScrolledWindow.new.set_hscrollbar_policy(Gtk::POLICY_NEVER)
|
||
settings = ::Gtk::VBox.new.set_no_show_all(true).show
|
||
scrolled = ::Gtk::ScrolledWindow.new.set_hscrollbar_policy(::Gtk::POLICY_NEVER)
|
||
Plugin.filtering(:defined_settings, []).first.each{ |title, definition, plugin|
|
||
iter = menu.model.append
|
||
iter[0] = title
|
||
... | ... | |
@window = nil
|
||
false }
|
||
window.add(Gtk::HPaned.new.add1(menu).add2(scrolled.add_with_viewport(settings))) end
|
||
window.add(::Gtk::HPaned.new.add1(menu).add2(scrolled.add_with_viewport(settings))) end
|
||
def menu_widget(widgets_dict)
|
||
column = Gtk::TreeViewColumn.new("", Gtk::CellRendererText.new, text: 0)
|
||
menumodel = Gtk::ListStore.new(String, Integer)
|
||
menumodel.set_sort_column_id(1, order = Gtk::SORT_ASCENDING)
|
||
menu = Gtk::TreeView.new(menumodel).set_headers_visible(false)
|
||
column = ::Gtk::TreeViewColumn.new("", ::Gtk::CellRendererText.new, text: 0)
|
||
menumodel = ::Gtk::ListStore.new(String, Integer)
|
||
menumodel.set_sort_column_id(1, order = ::Gtk::SORT_ASCENDING)
|
||
menu = ::Gtk::TreeView.new(menumodel).set_headers_visible(false)
|
||
menu.append_column(column)
|
||
menu.signal_connect(:cursor_changed) {
|
||
if menu.selection.selected
|
core/plugin/settings/builder.rb (作業コピー) | ||
---|---|---|
(チェックボックス)。明確にウィジェットを設定できるわけではなくて、値の意味を定義するだけなので、
|
||
前後関係などに影響されてウィジェットが変わる場合があるかも。
|
||
=end
|
||
class Plugin::Settings < Gtk::VBox
|
||
class Plugin::Settings < ::Gtk::VBox
|
||
# 複数行テキスト
|
||
# ==== Args
|
||
# [label] ラベル
|
||
# [config] 設定のキー
|
||
def multitext(label, config)
|
||
container = Gtk::HBox.new(false, 0)
|
||
input = Gtk::TextView.new
|
||
input.wrap_mode = Gtk::TextTag::WRAP_CHAR
|
||
container = ::Gtk::HBox.new(false, 0)
|
||
input = ::Gtk::TextView.new
|
||
input.wrap_mode = ::Gtk::TextTag::WRAP_CHAR
|
||
input.border_width = 2
|
||
input.accepts_tab = false
|
||
input.editable = true
|
||
input.width_request = HYDE
|
||
input.buffer.text = Listener[config].get || ''
|
||
container.pack_start(Gtk::Label.new(label), false, true, 0) if label
|
||
container.pack_start(Gtk::Alignment.new(1.0, 0.5, 0, 0).add(input), true, true, 0)
|
||
container.pack_start(::Gtk::Label.new(label), false, true, 0) if label
|
||
container.pack_start(::Gtk::Alignment.new(1.0, 0.5, 0, 0).add(input), true, true, 0)
|
||
input.buffer.ssc('changed'){ |widget|
|
||
Listener[config].set widget.text }
|
||
closeup container
|
||
... | ... | |
# [min] 最低値。これより小さい数字は入力できないようになる
|
||
# [max] 最高値。これより大きい数字は入力できないようになる
|
||
def adjustment(name, config, min, max)
|
||
container = Gtk::HBox.new(false, 0)
|
||
container.pack_start(Gtk::Label.new(name), false, true, 0)
|
||
adj = Gtk::Adjustment.new((Listener[config].get or min).to_f, min.to_f, max.to_f, 1.0, 5.0, 0.0)
|
||
spinner = Gtk::SpinButton.new(adj, 0, 0)
|
||
container = ::Gtk::HBox.new(false, 0)
|
||
container.pack_start(::Gtk::Label.new(name), false, true, 0)
|
||
adj = ::Gtk::Adjustment.new((Listener[config].get or min).to_f, min.to_f, max.to_f, 1.0, 5.0, 0.0)
|
||
spinner = ::Gtk::SpinButton.new(adj, 0, 0)
|
||
adj.signal_connect('value-changed'){ |widget, e|
|
||
Listener[config].set widget.value.to_i
|
||
false
|
||
}
|
||
closeup container.pack_start(Gtk::Alignment.new(1.0, 0.5, 0, 0).add(spinner), true, true, 0)
|
||
closeup container.pack_start(::Gtk::Alignment.new(1.0, 0.5, 0, 0).add(spinner), true, true, 0)
|
||
container
|
||
end
|
||
... | ... | |
# [label] ラベル
|
||
# [config] 設定のキー
|
||
def boolean(label, config)
|
||
input = Gtk::CheckButton.new(label)
|
||
input = ::Gtk::CheckButton.new(label)
|
||
input.active = Listener[config].get
|
||
input.signal_connect('toggled'){ |widget|
|
||
Listener[config].set widget.active? }
|
||
... | ... | |
def fileselect(label, config, current=Dir.pwd)
|
||
container = input(label, config)
|
||
input = container.children.last.children.first
|
||
button = Gtk::Button.new('参照')
|
||
button = ::Gtk::Button.new('参照')
|
||
container.pack_start(button, false)
|
||
button.signal_connect('clicked'){ |widget|
|
||
dialog = Gtk::FileChooserDialog.new("Open File",
|
||
widget.get_ancestor(Gtk::Window),
|
||
Gtk::FileChooser::ACTION_OPEN,
|
||
dialog = ::Gtk::FileChooserDialog.new("Open File",
|
||
widget.get_ancestor(::Gtk::Window),
|
||
::Gtk::FileChooser::ACTION_OPEN,
|
||
nil,
|
||
[Gtk::Stock::CANCEL, Gtk::Dialog::RESPONSE_CANCEL],
|
||
[Gtk::Stock::OPEN, Gtk::Dialog::RESPONSE_ACCEPT])
|
||
[::Gtk::Stock::CANCEL, ::Gtk::Dialog::RESPONSE_CANCEL],
|
||
[::Gtk::Stock::OPEN, ::Gtk::Dialog::RESPONSE_ACCEPT])
|
||
dialog.current_folder = File.expand_path(current)
|
||
if dialog.run == Gtk::Dialog::RESPONSE_ACCEPT
|
||
if dialog.run == ::Gtk::Dialog::RESPONSE_ACCEPT
|
||
Listener[config].set dialog.filename
|
||
input.text = dialog.filename
|
||
end
|
||
... | ... | |
# [label] ラベル
|
||
# [config] 設定のキー
|
||
def input(label, config)
|
||
container = Gtk::HBox.new(false, 0)
|
||
input = Gtk::Entry.new
|
||
container = ::Gtk::HBox.new(false, 0)
|
||
input = ::Gtk::Entry.new
|
||
input.text = Listener[config].get || ""
|
||
container.pack_start(Gtk::Label.new(label), false, true, 0) if label
|
||
container.pack_start(Gtk::Alignment.new(1.0, 0.5, 0, 0).add(input), true, true, 0)
|
||
container.pack_start(::Gtk::Label.new(label), false, true, 0) if label
|
||
container.pack_start(::Gtk::Alignment.new(1.0, 0.5, 0, 0).add(input), true, true, 0)
|
||
input.signal_connect('changed'){ |widget|
|
||
Listener[config].set widget.text }
|
||
closeup container
|
||
... | ... | |
# [label] ラベル
|
||
# [config] 設定のキー
|
||
def inputpass(label, config)
|
||
container = Gtk::HBox.new(false, 0)
|
||
input = Gtk::Entry.new
|
||
container = ::Gtk::HBox.new(false, 0)
|
||
input = ::Gtk::Entry.new
|
||
input.visibility = false
|
||
input.text = Listener[config].get
|
||
container.pack_start(Gtk::Label.new(label), false, true, 0) if label
|
||
container.pack_start(Gtk::Alignment.new(1.0, 0.5, 0, 0).add(input), true, true, 0)
|
||
container.pack_start(::Gtk::Label.new(label), false, true, 0) if label
|
||
container.pack_start(::Gtk::Alignment.new(1.0, 0.5, 0, 0).add(input), true, true, 0)
|
||
input.signal_connect('changed'){ |widget|
|
||
Listener[config].set widget.text }
|
||
closeup container
|
||
... | ... | |
# [config] 設定のキー
|
||
def multi(label, config)
|
||
settings(label) do
|
||
container, box = Gtk::HBox.new(false, 0), Gtk::VBox.new(false, 0)
|
||
container, box = ::Gtk::HBox.new(false, 0), ::Gtk::VBox.new(false, 0)
|
||
input_ary = []
|
||
btn_add = Gtk::Button.new(Gtk::Stock::ADD)
|
||
btn_add = ::Gtk::Button.new(::Gtk::Stock::ADD)
|
||
array_converter = lambda {
|
||
c = Listener[config].get || []
|
||
(c.is_a?(Array) ? c : [c]).select(&ret_nth) }
|
||
add_button = lambda { |content|
|
||
input = Gtk::Entry.new
|
||
input = ::Gtk::Entry.new
|
||
input.text = content.to_s
|
||
input.ssc(:changed) { |w|
|
||
Listener[config].set w.parent.children.map(&:text).select(&ret_nth) }
|
||
... | ... | |
input }
|
||
input_ary = array_converter.call.each(&add_button)
|
||
btn_add.ssc(:clicked) { |w|
|
||
w.get_ancestor(Gtk::Window).set_focus(add_button.call("").show)
|
||
w.get_ancestor(::Gtk::Window).set_focus(add_button.call("").show)
|
||
false }
|
||
container.pack_start(box, true, true, 0)
|
||
container.pack_start(Gtk::Alignment.new(1.0, 1.0, 0, 0).add(btn_add), false, true, 0)
|
||
container.pack_start(::Gtk::Alignment.new(1.0, 1.0, 0, 0).add(btn_add), false, true, 0)
|
||
closeup container
|
||
container
|
||
end
|
||
... | ... | |
# [title] ラベル
|
||
# [&block] ブロック
|
||
def settings(title)
|
||
group = Gtk::Frame.new.set_border_width(8)
|
||
if(title.is_a?(Gtk::Widget))
|
||
group = ::Gtk::Frame.new.set_border_width(8)
|
||
if(title.is_a?(::Gtk::Widget))
|
||
group.set_label_widget(title)
|
||
else
|
||
group.set_label(title) end
|
||
... | ... | |
# _:artists_ :: デザイナとかの名前。通常Twitter screen name(Array)
|
||
# _:documenters_ :: ドキュメントかいた人とかの名前。通常Twitter screen name(Array)
|
||
def about(label, options={})
|
||
about = Gtk::Button.new("#{Environment::NAME} について")
|
||
about = ::Gtk::Button.new("#{Environment::NAME} について")
|
||
about.signal_connect("clicked"){
|
||
dialog = Gtk::AboutDialog.new.show
|
||
dialog = ::Gtk::AboutDialog.new.show
|
||
options.each { |key, value|
|
||
dialog.__send__("#{key}=", about_converter[key][value]) }
|
||
dialog.signal_connect('response') { dialog.destroy } }
|
||
... | ... | |
# [label] ラベル
|
||
# [config] 設定のキー
|
||
def font(label, config)
|
||
closeup container = Gtk::HBox.new(false, 0).add(Gtk::Label.new(label).left).closeup(fontselect(label, config))
|
||
closeup container = ::Gtk::HBox.new(false, 0).add(::Gtk::Label.new(label).left).closeup(fontselect(label, config))
|
||
container end
|
||
# 色を決定させる。押すと色を設定するダイアログが出てくる。
|
||
... | ... | |
# [label] ラベル
|
||
# [config] 設定のキー
|
||
def color(label, config)
|
||
closeup container = Gtk::HBox.new(false, 0).add(Gtk::Label.new(label).left).closeup(colorselect(label, config))
|
||
closeup container = ::Gtk::HBox.new(false, 0).add(::Gtk::Label.new(label).left).closeup(colorselect(label, config))
|
||
container end
|
||
# フォントと色を決定させる。
|
||
... | ... | |
private
|
||
def about_converter
|
||
Hash.new(ret_nth).merge!( :logo => lambda{ |value| Gtk::WebIcon.new(value).pixbuf rescue nil } ) end
|
||
Hash.new(ret_nth).merge!( :logo => lambda{ |value| ::Gtk::WebIcon.new(value).pixbuf rescue nil } ) end
|
||
memoize :about_converter
|
||
def colorselect(label, config)
|
||
color = Listener[config].get
|
||
button = Gtk::ColorButton.new((color and Gdk::Color.new(*color)))
|
||
button = ::Gtk::ColorButton.new((color and Gdk::Color.new(*color)))
|
||
button.title = label
|
||
button.signal_connect('color-set'){ |w|
|
||
Listener[config].set w.color.to_a }
|
||
button end
|
||
def fontselect(label, config)
|
||
button = Gtk::FontButton.new(Listener[config].get)
|
||
button = ::Gtk::FontButton.new(Listener[config].get)
|
||
button.title = label
|
||
button.signal_connect('font-set'){ |w|
|
||
Listener[config].set w.font_name }
|
core/plugin/settings/multiselect.rb (作業コピー) | ||
---|---|---|
# ウィジェット
|
||
def build(label, config)
|
||
if has_widget?
|
||
group = Gtk::Frame.new.set_border_width(8)
|
||
group = ::Gtk::Frame.new.set_border_width(8)
|
||
group.set_label(label)
|
||
group.add(build_box(Plugin::Settings::Listener[config]))
|
||
group
|
||
else
|
||
group = Gtk::Frame.new.set_border_width(8).
|
||
group = ::Gtk::Frame.new.set_border_width(8).
|
||
set_label(label)
|
||
box = Plugin::Settings.new.set_border_width(4).
|
||
closeup(build_combobox(Plugin::Settings::Listener[config]))
|
||
... | ... | |
private
|
||
def build_box(listener)
|
||
box = Gtk::VBox.new
|
||
box = ::Gtk::VBox.new
|
||
options = @options
|
||
box.instance_eval{
|
||
options.each{ |value, face|
|
||
if face.is_a? String
|
||
closeup check = Gtk::CheckButton.new(face)
|
||
closeup check = ::Gtk::CheckButton.new(face)
|
||
elsif face.is_a? Plugin::Settings
|
||
container = Gtk::HBox.new
|
||
check = Gtk::CheckButton.new
|
||
container = ::Gtk::HBox.new
|
||
check = ::Gtk::CheckButton.new
|
||
closeup container.closeup(check).add(face)
|
||
else
|
||
raise ArgumentError, "multiselect option value should be instance of String or Plugin::Settings. but #{face.class} given (#{face.inspect})"
|
||
... | ... | |
listener.set((listener.get || []) + [value])
|
||
else
|
||
listener.set((listener.get || []) - [value]) end
|
||
face.sensitive = widget.active? if face.is_a? Gtk::Widget }
|
||
face.sensitive = widget.active? if face.is_a? ::Gtk::Widget }
|
||
check.active = (listener.get || []).include? value
|
||
face.sensitive = check.active? if face.is_a? Gtk::Widget } }
|
||
face.sensitive = check.active? if face.is_a? ::Gtk::Widget } }
|
||
box end
|
||
# すべてテキストなら、コンボボックスで要素を描画する
|
||
def build_combobox(listener)
|
||
container = Gtk::VBox.new
|
||
container = ::Gtk::VBox.new
|
||
state = listener.get || []
|
||
@options.each{ |pair|
|
||
node, value = *pair
|
||
check = Gtk::CheckButton.new(value)
|
||
check = ::Gtk::CheckButton.new(value)
|
||
check.active = state.include?(node)
|
||
check.signal_connect('toggled'){ |widget|
|
||
if widget.active?
|
core/plugin/search/search.rb (作業コピー) | ||
---|---|---|
# -*- coding: utf-8 -*-
|
||
Plugin.create :search do
|
||
querybox = Gtk::Entry.new()
|
||
querycont = Gtk::VBox.new(false, 0)
|
||
searchbtn = Gtk::Button.new('検索')
|
||
savebtn = Gtk::Button.new('保存')
|
||
querybox = ::Gtk::Entry.new()
|
||
querycont = ::Gtk::VBox.new(false, 0)
|
||
searchbtn = ::Gtk::Button.new('検索')
|
||
savebtn = ::Gtk::Button.new('保存')
|
||
querycont.
|
||
closeup(Gtk::HBox.new(false, 0).
|
||
closeup(::Gtk::HBox.new(false, 0).
|
||
pack_start(querybox).
|
||
closeup(searchbtn)).
|
||
closeup(Gtk::HBox.new(false, 0).
|
||
closeup(::Gtk::HBox.new(false, 0).
|
||
closeup(savebtn))
|
||
tab(:search, "検索") do
|
core/plugin/extract/extract.rb (作業コピー) | ||
---|---|---|
tabs.each{ |record|
|
||
timeline(record[:slug]) << message if miku(record[:sexp], table) } } end
|
||
class ExtractTab < Gtk::CRUD
|
||
class ExtractTab < ::Gtk::CRUD
|
||
ITER_NAME = 0
|
||
ITER_SOURCE = 1
|
||
ITER_SEXP = 2
|
core/plugin/list/list.rb (作業コピー) | ||
---|---|---|
profiletab :list, "リスト" do
|
||
set_icon MUI::Skin.get("list.png")
|
||
bio = Gtk::IntelligentTextview.new(user[:detail])
|
||
bio = ::Gtk::IntelligentTextview.new(user[:detail])
|
||
ago = (Time.now - (user[:created] or 1)).to_i / (60 * 60 * 24)
|
||
container = ProfileTab.new(Plugin.create(:list), user)
|
||
nativewidget container.show_all end
|
||
... | ... | |
class IDs < TypedArray(Integer); end
|
||
class Tab < Gtk::ListList
|
||
class Tab < ::Gtk::ListList
|
||
attr_accessor :plugin
|
||
VISIBILITY = 0
|
||
... | ... | |
end
|
||
class ProfileTab < Gtk::ListList
|
||
class ProfileTab < ::Gtk::ListList
|
||
MEMBER = 0
|
||
SLUG = 1
|
||
LIST = 2
|
core/plugin/command/command.rb (作業コピー) | ||
---|---|---|
condition: Plugin::Command[:HasOneMessage, :TimelineTextSelected],
|
||
visible: true,
|
||
role: :timeline) do |opt|
|
||
Gtk::Clipboard.copy(opt.widget.selected_text(opt.messages.first)) end
|
||
::Gtk::Clipboard.copy(opt.widget.selected_text(opt.messages.first)) end
|
||
command(:copy_description,
|
||
name: '本文をコピー',
|
||
condition: Plugin::Command[:HasOneMessage],
|
||
visible: true,
|
||
role: :timeline) do |opt|
|
||
Gtk::Clipboard.copy(opt.messages.first.to_show) end
|
||
::Gtk::Clipboard.copy(opt.messages.first.to_show) end
|
||
command(:reply,
|
||
name: '返信',
|
||
... | ... | |
role: :timeline) do |opt|
|
||
opt.messages.each { |m|
|
||
retweet = m.retweeted_statuses.find(&:from_me?)
|
||
retweet.destroy if retweet and Gtk::Dialog.confirm("このつぶやきのリツイートをキャンセルしますか?\n\n#{m.to_show}") } end
|
||
retweet.destroy if retweet and ::Gtk::Dialog.confirm("このつぶやきのリツイートをキャンセルしますか?\n\n#{m.to_show}") } end
|
||
command(:favorite,
|
||
name: 'ふぁぼふぁぼする',
|
||
... | ... | |
visible: true,
|
||
role: :timeline) do |opt|
|
||
opt.messages.each { |m|
|
||
m.destroy if Gtk::Dialog.confirm("失った信頼はもう戻ってきませんが、本当にこのつぶやきを削除しますか?\n\n#{m.to_show}") } end
|
||
m.destroy if ::Gtk::Dialog.confirm("失った信頼はもう戻ってきませんが、本当にこのつぶやきを削除しますか?\n\n#{m.to_show}") } end
|
||
command(:select_prev,
|
||
name: '一つ上のメッセージを選択',
|
||
... | ... | |
condition: Plugin::Command[:HasOneMessage, :TimelineTextSelected],
|
||
visible: true,
|
||
role: :timeline) do |opt|
|
||
Gtk::openurl("http://www.google.co.jp/search?q=" + URI.escape(opt.widget.selected_text(opt.messages.first)).to_s) end
|
||
::Gtk::openurl("http://www.google.co.jp/search?q=" + URI.escape(opt.widget.selected_text(opt.messages.first)).to_s) end
|
||
command(:open_link,
|
||
name: 'リンクを開く',
|
||
... | ... | |
visible: true,
|
||
role: :timeline) do |opt|
|
||
opt.messages[0].entity.to_a.each {|u|
|
||
Gtk::TimeLine.openurl(u[:url]) if u[:slug] == :urls } end
|
||
::Gtk::TimeLine.openurl(u[:url]) if u[:slug] == :urls } end
|
||
command(:new_pane,
|
||
name: '新規ペインに移動',
|
core/plugin/direct_message/direct_message.rb (作業コピー) | ||
---|---|---|
end
|
||
def dm_list_widget(user)
|
||
container = Gtk::VBox.new
|
||
container = ::Gtk::VBox.new
|
||
tl = DirectMessage.new
|
||
scrollbar = Gtk::VScrollbar.new(tl.vadjustment)
|
||
scrollbar = ::Gtk::VScrollbar.new(tl.vadjustment)
|
||
model = tl.model
|
||
@dm_lock.synchronize do
|
||
if @dm_store.has_key?(user[:id])
|
||
... | ... | |
tl.ssc(:destroy){
|
||
detach(:direct_message, event)
|
||
}
|
||
mumbles = Gtk::VBox.new(false, 0)
|
||
postbox = Gtk::PostBox.new(Sender.new(Service.primary_service, user), :postboxstorage => mumbles, :delegate_other => true)
|
||
mumbles = ::Gtk::VBox.new(false, 0)
|
||
postbox = ::Gtk::PostBox.new(Sender.new(Service.primary_service, user), :postboxstorage => mumbles, :delegate_other => true)
|
||
mumbles.pack_start(postbox)
|
||
container.closeup(mumbles).add(Gtk::HBox.new.add(tl).closeup(scrollbar))
|
||
container.closeup(mumbles).add(::Gtk::HBox.new.add(tl).closeup(scrollbar))
|
||
container
|
||
end
|
||
core/plugin/direct_message/dmlistview.rb (作業コピー) | ||
---|---|---|
# DM用のリストビュー
|
||
module Plugin::DirectMessage
|
||
class DirectMessage < Gtk::CRUD
|
||
class DirectMessage < ::Gtk::CRUD
|
||
C_CREATED = 2
|
||
C_ICON = 0
|
||
C_TEXT = 1
|
||
... | ... | |
def initialize
|
||
super
|
||
model.set_sort_column_id(DirectMessage::C_CREATED, Gtk::SORT_DESCENDING)
|
||
model.set_sort_column_id(DirectMessage::C_CREATED, ::Gtk::SORT_DESCENDING)
|
||
@creatable = @updatable = false
|
||
end
|
||
... | ... | |
false }
|
||
[{:kind => :pixbuf, :type => Gdk::Pixbuf, :label => 'icon'},
|
||
{:kind => :text, :type => String, :label => '本文', :renderer => lambda{ |scheme, index|
|
||
renderer = Gtk::CellRendererText.new
|
||
renderer = ::Gtk::CellRendererText.new
|
||
Delayer.new{
|
||
if not destroyed?
|
||
renderer.set_property "wrap-width", 10
|
core/plugin/direct_message/userlist.rb (作業コピー) | ||
---|---|---|
# 最後にやりとりしたDMの日時でソートする機能のついたUserlist
|
||
module Plugin::DirectMessage
|
||
class UserList < Gtk::UserList
|
||
class UserList < ::Gtk::UserList
|
||
def initialize
|
||
super
|
||
@ul.set_sort_column_id(5, Gtk::SORT_DESCENDING)
|
||
@ul.set_sort_column_id(5, ::Gtk::SORT_DESCENDING)
|
||
end
|
||
def block_add(user)
|
core/plugin/profile/profile.rb (作業コピー) | ||
---|---|---|
profiletab :aboutuser, "ユーザについて" do
|
||
set_icon user[:profile_image_url]
|
||
bio = Gtk::IntelligentTextview.new("")
|
||
label_since = Gtk::Label.new
|
||
container = Gtk::VBox.new.
|
||
bio = ::Gtk::IntelligentTextview.new("")
|
||
label_since = ::Gtk::Label.new
|
||
container = ::Gtk::VBox.new.
|
||
closeup(bio).
|
||
closeup(label_since.left).
|
||
closeup(plugin.relation_bar(user))
|
||
container.closeup(plugin.mutebutton(user)) if not user.is_me?
|
||
scrolledwindow = Gtk::ScrolledWindow.new
|
||
scrolledwindow.set_policy(Gtk::POLICY_AUTOMATIC, Gtk::POLICY_AUTOMATIC)
|
||
scrolledwindow = ::Gtk::ScrolledWindow.new
|
||
scrolledwindow.set_policy(::Gtk::POLICY_AUTOMATIC, ::Gtk::POLICY_AUTOMATIC)
|
||
scrolledwindow.add_with_viewport(container)
|
||
scrolledwindow.style = container.style
|
||
nativewidget scrolledwindow.show_all
|
||
... | ... | |
# ==== Args
|
||
# [user] 対象となるユーザ
|
||
# ==== Return
|
||
# リレーションバーのウィジェット(Gtk::VBox)
|
||
# リレーションバーのウィジェット(::Gtk::VBox)
|
||
def relation_bar(user)
|
||
icon_size = Gdk::Rectangle.new(0, 0, 32, 32)
|
||
arrow_size = Gdk::Rectangle.new(0, 0, 16, 16)
|
||
container = Gtk::VBox.new(false, 4)
|
||
container = ::Gtk::VBox.new(false, 4)
|
||
Service.all.each{ |me|
|
||
following = followed = nil
|
||
w_following_label = Gtk::Label.new("関係を取得中")
|
||
w_followed_label = Gtk::Label.new("")
|
||
w_eventbox_image_following = Gtk::EventBox.new
|
||
w_eventbox_image_followed = Gtk::EventBox.new
|
||
w_following_label = ::Gtk::Label.new("関係を取得中")
|
||
w_followed_label = ::Gtk::Label.new("")
|
||
w_eventbox_image_following = ::Gtk::EventBox.new
|
||
w_eventbox_image_followed = ::Gtk::EventBox.new
|
||
relation = if me.user_obj == user
|
||
Gtk::Label.new("それはあなたです!")
|
||
::Gtk::Label.new("それはあなたです!")
|
||
else
|
||
Gtk::HBox.new.
|
||
::Gtk::HBox.new.
|
||
closeup(w_eventbox_image_following).
|
||
closeup(w_following_label) end
|
||
relation_container = Gtk::HBox.new(false, icon_size.width/2)
|
||
relation_container.closeup(Gtk::WebIcon.new(me.user_obj[:profile_image_url], icon_size).tooltip("#{me.user}(#{me.user_obj[:name]})"))
|
||
relation_container.closeup(Gtk::VBox.new.
|
||
relation_container = ::Gtk::HBox.new(false, icon_size.width/2)
|
||
relation_container.closeup(::Gtk::WebIcon.new(me.user_obj[:profile_image_url], icon_size).tooltip("#{me.user}(#{me.user_obj[:name]})"))
|
||
relation_container.closeup(::Gtk::VBox.new.
|
||
closeup(relation).
|
||
closeup(Gtk::HBox.new.
|
||
closeup(::Gtk::HBox.new.
|
||
closeup(w_eventbox_image_followed).
|
||
closeup(w_followed_label)))
|
||
relation_container.closeup(Gtk::WebIcon.new(user[:profile_image_url], icon_size).tooltip("#{user.idname}(#{user[:name]})"))
|
||
relation_container.closeup(::Gtk::WebIcon.new(user[:profile_image_url], icon_size).tooltip("#{user.idname}(#{user[:name]})"))
|
||
if me.user_obj != user
|
||
followbutton = Gtk::Button.new
|
||
followbutton = ::Gtk::Button.new
|
||
followbutton.sensitive = false
|
||
# フォローしている状態の更新
|
||
m_following_refresh = lambda { |new|
|
||
... | ... | |
w_eventbox_image_following.remove(w_eventbox_image_following.children.first) end
|
||
w_eventbox_image_following.style = w_eventbox_image_following.parent.style
|
||
w_eventbox_image_following.add(Gtk::WebIcon.new(MUI::Skin.get(new ? "arrow_following.png" : "arrow_notfollowing.png"), arrow_size).show_all)
|
||
w_eventbox_image_following.add(::Gtk::WebIcon.new(MUI::Skin.get(new ? "arrow_following.png" : "arrow_notfollowing.png"), arrow_size).show_all)
|
||
w_following_label.text = new ? "フョローしている" : "フョローしていない"
|
||
followbutton.label = new ? "解除" : "フョロー" end }
|
||
# フォローされている状態の更新
|
||
... | ... | |
if not w_eventbox_image_followed.children.empty?
|
||
w_eventbox_image_followed.remove(w_eventbox_image_followed.children.first) end
|
||
w_eventbox_image_followed.style = w_eventbox_image_followed.parent.style
|
||
w_eventbox_image_followed.add(Gtk::WebIcon.new(MUI::Skin.get(new ? "arrow_followed.png" : "arrow_notfollowed.png"), arrow_size).show_all)
|
||
w_eventbox_image_followed.add(::Gtk::WebIcon.new(MUI::Skin.get(new ? "arrow_followed.png" : "arrow_notfollowed.png"), arrow_size).show_all)
|
||
w_followed_label.text = new ? "フョローされている" : "フョローされていない" end }
|
||
Service.primary.friendship(target_id: user[:id], source_id: me.user_obj[:id]).next{ |rel|
|
||
if rel and not(w_eventbox_image_following.destroyed?)
|
||
... | ... | |
# ==== Return
|
||
# ヘッダ部を表すGtkコンテナ
|
||
def profile_head(user)
|
||
eventbox = Gtk::EventBox.new
|
||
eventbox = ::Gtk::EventBox.new
|
||
eventbox.ssc('visibility-notify-event'){
|
||
eventbox.style = background_color
|
||
false }
|
||
eventbox.add(Gtk::VBox.new(false, 0).
|
||
add(Gtk::HBox.new(false, 16).
|
||
closeup(Gtk::WebIcon.new(user.profile_image_url_large, 128, 128).top).
|
||
closeup(Gtk::VBox.new.closeup(user_name(user)).closeup(profile_table(user)))))
|
||
scrolledwindow = Gtk::ScrolledWindow.new
|
||
eventbox.add(::Gtk::VBox.new(false, 0).
|
||
add(::Gtk::HBox.new(false, 16).
|
||
closeup(::Gtk::WebIcon.new(user.profile_image_url_large, 128, 128).top).
|
||
closeup(::Gtk::VBox.new.closeup(user_name(user)).closeup(profile_table(user)))))
|
||
scrolledwindow = ::Gtk::ScrolledWindow.new
|
||
scrolledwindow.height_request = 128 + 24
|
||
scrolledwindow.set_policy(Gtk::POLICY_AUTOMATIC, Gtk::POLICY_NEVER)
|
||
scrolledwindow.set_policy(::Gtk::POLICY_AUTOMATIC, ::Gtk::POLICY_NEVER)
|
||
scrolledwindow.add_with_viewport(eventbox)
|
||
end
|
||
... | ... | |
# ==== Return
|
||
# ユーザの名前の部分のGtkコンテナ
|
||
def user_name(user)
|
||
w_screen_name = Gtk::Label.new.set_markup("<b><u><span foreground=\"#0000ff\">#{Pango.escape(user[:idname])}</span></u></b>")
|
||
w_ev = Gtk::EventBox.new
|
||
w_ev.modify_bg(Gtk::STATE_NORMAL, Gdk::Color.new(0xffff, 0xffff, 0xffff))
|
||
w_screen_name = ::Gtk::Label.new.set_markup("<b><u><span foreground=\"#0000ff\">#{Pango.escape(user[:idname])}</span></u></b>")
|
||
w_ev = ::Gtk::EventBox.new
|
||
w_ev.modify_bg(::Gtk::STATE_NORMAL, Gdk::Color.new(0xffff, 0xffff, 0xffff))
|
||
w_ev.ssc(:realize) {
|
||
w_ev.window.set_cursor(Gdk::Cursor.new(Gdk::Cursor::HAND2))
|
||
false }
|
||
... | ... | |
if e.button == 1
|
||
Gtk.openurl("http://twitter.com/#{user[:idname]}")
|
||
true end }
|
||
Gtk::HBox.new(false, 16).closeup(w_ev.add(w_screen_name)).closeup(Gtk::Label.new(user[:name]))
|
||
::Gtk::HBox.new(false, 16).closeup(w_ev.add(w_screen_name)).closeup(::Gtk::Label.new(user[:name]))
|
||
end
|
||
# プロフィールの上のところの格子になってる奴をかえす
|
||
... | ... | |
# ==== Return
|
||
# プロフィールのステータス部を表すGtkコンテナ
|
||
def profile_table(user)
|
||
w_tweets = Gtk::Label.new(user[:statuses_count].to_s)
|
||
w_favs = Gtk::Label.new(user[:favourites_count].to_s)
|
||
w_faved = Gtk::Label.new("...")
|
||
w_followings = Gtk::Label.new(user[:friends_count].to_s)
|
||
w_followers = Gtk::Label.new(user[:followers_count].to_s)
|
||
w_tweets = ::Gtk::Label.new(user[:statuses_count].to_s)
|
||
w_favs = ::Gtk::Label.new(user[:favourites_count].to_s)
|
||
w_faved = ::Gtk::Label.new("...")
|
||
w_followings = ::Gtk::Label.new(user[:friends_count].to_s)
|
||
w_followers = ::Gtk::Label.new(user[:followers_count].to_s)
|
||
user.count_favorite_by.next{ |favs|
|
||
w_faved.text = favs.to_s
|
||
}.terminate("ふぁぼが取得できませんでした").trap{
|
||
w_faved.text = '-' }
|
||
Gtk::Table.new(2, 5).
|
||
::Gtk::Table.new(2, 5).
|
||
attach(w_tweets.right, 0, 1, 0, 1).
|
||
attach(Gtk::Label.new("tweets").left, 1, 2, 0, 1).
|
||
attach(::Gtk::Label.new("tweets").left, 1, 2, 0, 1).
|
||
attach(w_favs.right, 0, 1, 1, 2).
|
||
attach(Gtk::Label.new("favs").left, 1, 2, 1, 2).
|
||
attach(::Gtk::Label.new("favs").left, 1, 2, 1, 2).
|
||
attach(w_faved.right, 0, 1, 2, 3).
|
||
attach(Gtk::Label.new("faved").left, 1, 2, 2, 3).
|
||
attach(::Gtk::Label.new("faved").left, 1, 2, 2, 3).
|
||
attach(w_followings.right, 0, 1, 3, 4).
|
||
attach(Gtk::Label.new("followings").left, 1, 2, 3, 4).
|
||
attach(::Gtk::Label.new("followings").left, 1, 2, 3, 4).
|
||
attach(w_followers.right, 0, 1, 4, 5).
|
||
attach(Gtk::Label.new("followers").left, 1, 2, 4, 5).
|
||
attach(::Gtk::Label.new("followers").left, 1, 2, 4, 5).
|
||
set_row_spacing(0, 4).
|
||
set_row_spacing(1, 4).
|
||
set_column_spacing(0, 16)
|
||
end
|
||
def background_color
|
||
style = Gtk::Style.new()
|
||
style.set_bg(Gtk::STATE_NORMAL, 0xFF ** 2, 0xFF ** 2, 0xFF ** 2)
|
||
style = ::Gtk::Style.new()
|
||
style.set_bg(::Gtk::STATE_NORMAL, 0xFF ** 2, 0xFF ** 2, 0xFF ** 2)
|
||
style end
|
||
end
|
core/plugin/followingcontrol/followingcontrol.rb (作業コピー) | ||
---|---|---|
end } end
|
||
def set_event(api, title)
|
||
userlist = Gtk::UserList.new.show_all
|
||
userlist = ::Gtk::UserList.new.show_all
|
||
proc = gen_relationship(api, userlist)
|
||
Plugin.call(:mui_tab_regist, userlist, title, MUI::Skin.get("#{api}.png"))
|
||
onperiod{ |service|
|
||
... | ... | |
# end } end
|
||
# def self.set_event(api, title)
|
||
# userlist = Gtk::UserList.new.show_all
|
||
# userlist = ::Gtk::UserList.new.show_all
|
||
# proc = gen_relationship(api, userlist)
|
||
# Plugin.call(:mui_tab_regist, userlist, title, MUI::Skin.get("#{api}.png"))
|
||
# Plugin.create(:following_control).add_event(:period){ |service|
|
core/plugin/console/console.rb (作業コピー) | ||
---|---|---|
if Plugin::GUI::Tab.cuscaded.has_key?(:console)
|
||
Plugin::GUI::Tab.instance(:console).active!
|
||
next end
|
||
widget_result = Gtk::TextView.new
|
||
widget_result = ::Gtk::TextView.new
|
||
scroll_result_v, scroll_result_h = gen_scrollbars(widget_result)
|
||
widget_input = Gtk::TextView.new
|
||
widget_input = ::Gtk::TextView.new
|
||
scroll_input_v, scroll_input_h = gen_scrollbars(widget_input)
|
||
widget_result.set_editable(false)
|
||
... | ... | |
gen_tags(widget_result.buffer)
|
||
widget_input.ssc('key_press_event'){ |widget, event|
|
||
notice "console key press #{Gtk::keyname([event.keyval ,event.state])}"
|
||
if "Control + Return" == Gtk::keyname([event.keyval ,event.state])
|
||
notice "console key press #{::Gtk::keyname([event.keyval ,event.state])}"
|
||
if "Control + Return" == ::Gtk::keyname([event.keyval ,event.state])
|
||
notice "console eval #{widget.buffer.text}"
|
||
iter = widget_result.buffer.end_iter
|
||
begin
|
||
... | ... | |
set_icon MUI::Skin.get('console.png')
|
||
set_deletable true
|
||
nativewidget Plugin::Console::ConsoleControl.new().
|
||
pack1(Gtk::Table.new(2, 3).
|
||
attach(widget_result, 0, 1, 0, 1, Gtk::FILL|Gtk::SHRINK|Gtk::EXPAND, Gtk::FILL|Gtk::SHRINK|Gtk::EXPAND).
|
||
attach(scroll_result_h, 0, 1, 1, 2, Gtk::SHRINK|Gtk::FILL, Gtk::FILL).
|
||
attach(scroll_result_v, 1, 2, 0, 1, Gtk::FILL, Gtk::SHRINK|Gtk::FILL),
|
||
pack1(::Gtk::Table.new(2, 3).
|
||
attach(widget_result, 0, 1, 0, 1, ::Gtk::FILL|::Gtk::SHRINK|::Gtk::EXPAND, ::Gtk::FILL|::Gtk::SHRINK|::Gtk::EXPAND).
|
||
attach(scroll_result_h, 0, 1, 1, 2, ::Gtk::SHRINK|::Gtk::FILL, ::Gtk::FILL).
|
||
attach(scroll_result_v, 1, 2, 0, 1, ::Gtk::FILL, ::Gtk::SHRINK|::Gtk::FILL),
|
||
true, false).
|
||
pack2(Gtk::Table.new(2, 3).
|
||
attach(widget_input, 0, 1, 0, 1, Gtk::FILL|Gtk::SHRINK|Gtk::EXPAND, Gtk::FILL|Gtk::SHRINK|Gtk::EXPAND).
|
||
attach(scroll_input_h, 0, 1, 1, 2, Gtk::SHRINK|Gtk::FILL, Gtk::FILL).
|
||
attach(scroll_input_v, 1, 2, 0, 1, Gtk::FILL, Gtk::SHRINK|Gtk::FILL),
|
||
pack2(::Gtk::Table.new(2, 3).
|
||
attach(widget_input, 0, 1, 0, 1, ::Gtk::FILL|::Gtk::SHRINK|::Gtk::EXPAND, ::Gtk::FILL|::Gtk::SHRINK|::Gtk::EXPAND).
|
||
attach(scroll_input_h, 0, 1, 1, 2, ::Gtk::SHRINK|::Gtk::FILL, ::Gtk::FILL).
|
||
attach(scroll_input_v, 1, 2, 0, 1, ::Gtk::FILL, ::Gtk::SHRINK|::Gtk::FILL),
|
||
false, false)
|
||
active!
|
||
end
|
||
... | ... | |
# _widget_ のためのスクロールバーを作って返す
|
||
# ==== Args
|
||
# [widget] Gtk::TextView
|
||
# [widget] ::Gtk::TextView
|
||
# ==== Return
|
||
# 縦スクロールバーと横スクロールバー
|
||
def gen_scrollbars(widget)
|
||
scroll_v = Gtk::VScrollbar.new
|
||
scroll_h = Gtk::HScrollbar.new
|
||
scroll_v = ::Gtk::VScrollbar.new
|
||
scroll_h = ::Gtk::HScrollbar.new
|
||
widget.set_scroll_adjustment(scroll_h.adjustment, scroll_v.adjustment)
|
||
return scroll_v, scroll_h
|
||
end
|
||
# タグを作る
|
||
# ==== Args
|
||
# [buffer] Gtk::TextBuffer
|
||
# [buffer] ::Gtk::TextBuffer
|
||
def gen_tags(buffer)
|
||
type_strict buffer => Gtk::TextBuffer
|
||
type_strict buffer => ::Gtk::TextBuffer
|
||
buffer.create_tag("prompt",
|
||
foreground_gdk: Gdk::Color.new(0, 0x6666, 0))
|
||
buffer.create_tag("echo",
|
core/plugin/change_account.rb (作業コピー) | ||
---|---|---|
result = [nil]
|
||
main_windows = Plugin.filtering(:get_windows, Set.new).first
|
||
alert_thread = if(Thread.main != Thread.current) then Thread.current end
|
||
dialog = Gtk::Dialog.new(Environment::NAME + " ログイン")
|
||
dialog = ::Gtk::Dialog.new(Environment::NAME + " ログイン")
|
||
container, key, request_token = main(watch, dialog)
|
||
dialog.set_size_request(600, 400)
|
||
dialog.window_position = Gtk::Window::POS_CENTER
|
||
dialog.window_position = ::Gtk::Window::POS_CENTER
|
||
dialog.vbox.pack_start(container, true, true, 30)
|
||
dialog.add_button(Gtk::Stock::OK, Gtk::Dialog::RESPONSE_OK)
|
||
dialog.default_response = Gtk::Dialog::RESPONSE_OK
|
||
dialog.add_button(::Gtk::Stock::OK, ::Gtk::Dialog::RESPONSE_OK)
|
||
dialog.default_response = ::Gtk::Dialog::RESPONSE_OK
|
||
quit = lambda{
|
||
dialog.hide_all.destroy
|
||
Gtk.main_iteration_do(false)
|
||
... | ... | |
else
|
||
Gtk.main_quit end }
|
||
dialog.signal_connect("response") do |widget, response|
|
||
if response == Gtk::Dialog::RESPONSE_OK
|
||
if response == ::Gtk::Dialog::RESPONSE_OK
|
||
begin
|
||
access_token = request_token.get_access_token(:oauth_token => request_token.token,
|
||
:oauth_verifier => key.text)
|
||
... | ... | |
if(alert_thread)
|
||
Thread.stop
|
||
else
|
||
Gtk::main
|
||
::Gtk::main
|
||
end
|
||
return *result
|
||
end
|
||
def main(watch, dialog)
|
||
goaisatsu = Gtk::VBox.new(false, 0)
|
||
box = Gtk::VBox.new(false, 8)
|
||
goaisatsu = ::Gtk::VBox.new(false, 0)
|
||
box = ::Gtk::VBox.new(false, 8)
|
||
request_token = watch.request_oauth_token
|
||
goaisatsu.add(Gtk::IntelligentTextview.new(hello(request_token.authorize_url)))
|
||
goaisatsu.add(::Gtk::IntelligentTextview.new(hello(request_token.authorize_url)))
|
||
user, key_input = gen_input('暗証番号', dialog, true)
|
||
box.closeup(goaisatsu).closeup(user)
|
||
return box, key_input, request_token
|
||
end
|
||
def gen_input(label, dialog, visibility=true, default="")
|
||
container = Gtk::HBox.new(false, 0)
|
||
input = Gtk::Entry.new
|
||
container = ::Gtk::HBox.new(false, 0)
|
||
input = ::Gtk::Entry.new
|
||
input.text = default
|
||
input.visibility = visibility
|
||
input.signal_connect('activate') { |elm|
|
||
dialog.response(Gtk::Dialog::RESPONSE_OK) }
|
||
container.pack_start(Gtk::Label.new(label), false, true, 0)
|
||
container.pack_start(Gtk::Alignment.new(1.0, 0.5, 0, 0).add(input), true, true, 0)
|
||
dialog.response(::Gtk::Dialog::RESPONSE_OK) }
|
||
container.pack_start(::Gtk::Label.new(label), false, true, 0)
|
||
container.pack_start(::Gtk::Alignment.new(1.0, 0.5, 0, 0).add(input), true, true, 0)
|
||
return container, input
|
||
end
|
||
... | ... | |
MikuTwitter::AuthenticationFailedAction.regist &method(:popup)
|
||
settings 'アカウント情報' do
|
||
closeup attention = Gtk::Label.new("変更後は、#{Environment::NAME}を再起動した方がいいと思うよ!")
|
||
closeup decide = Gtk::Button.new('変更')
|
||
closeup attention = ::Gtk::Label.new("変更後は、#{Environment::NAME}を再起動した方がいいと思うよ!")
|
||
closeup decide = ::Gtk::Button.new('変更')
|
||
attention.wrap = true
|
||
decide.signal_connect("clicked"){
|
||
Plugin.call(:reauthentication_dialog, Service.primary) }
|
core/plugin/bugreport.rb (作業コピー) | ||
---|---|---|
def self.popup
|
||
Delayer.new{
|
||
alert_thread = if(Thread.main != Thread.current) then Thread.current end
|
||
dialog = Gtk::Dialog.new("bug report")
|
||
dialog = ::Gtk::Dialog.new("bug report")
|
||
dialog.set_size_request(600, 400)
|
||
dialog.window_position = Gtk::Window::POS_CENTER
|
||
dialog.window_position = ::Gtk::Window::POS_CENTER
|
||
dialog.vbox.pack_start(main, true, true, 30)
|
||
dialog.add_button(Gtk::Stock::OK, Gtk::Dialog::RESPONSE_OK)
|
||
dialog.add_button(Gtk::Stock::CANCEL, Gtk::Dialog::RESPONSE_CANCEL)
|
||
dialog.default_response = Gtk::Dialog::RESPONSE_OK
|
||
dialog.add_button(::Gtk::Stock::OK, ::Gtk::Dialog::RESPONSE_OK)
|
||
dialog.add_button(::Gtk::Stock::CANCEL, ::Gtk::Dialog::RESPONSE_CANCEL)
|
||
dialog.default_response = ::Gtk::Dialog::RESPONSE_OK
|
||
quit = lambda{
|
||
dialog.hide_all.destroy
|
||
Gtk.main_iteration_do(false)
|
||
... | ... | |
Gtk.main_quit
|
||
end }
|
||
dialog.signal_connect("response"){ |widget, response|
|
||
if response == Gtk::Dialog::RESPONSE_OK
|
||
if response == ::Gtk::Dialog::RESPONSE_OK
|
||
send
|
||
else
|
||
File.delete(File.expand_path(File.join(Environment::TMPDIR, 'mikutter_error'))) rescue nil
|
||
... | ... | |
if(alert_thread)
|
||
Thread.stop
|
||
else
|
||
Gtk::main
|
||
::Gtk::main
|
||
end
|
||
}
|
||
end
|
||
... | ... | |
end
|
||
def self.main
|
||
Gtk::VBox.new(false, 0).
|
||
closeup(Gtk::IntelligentTextview.new(imsorry)).
|
||
pack_start(Gtk::ScrolledWindow.
|
||
new.set_policy(Gtk::POLICY_NEVER, Gtk::POLICY_ALWAYS).
|
||
add(Gtk::IntelligentTextview.new(backtrace)))
|
||
::Gtk::VBox.new(false, 0).
|
||
closeup(::Gtk::IntelligentTextview.new(imsorry)).
|
||
pack_start(::Gtk::ScrolledWindow.
|
||
new.set_policy(::Gtk::POLICY_NEVER, ::Gtk::POLICY_ALWAYS).
|
||
add(::Gtk::IntelligentTextview.new(backtrace)))
|
||
end
|
||
def self.send
|
||
... | ... | |
'exception_class' => exception.class,
|
||
'description' => exception.to_s,
|
||
'ruby_version' => RUBY_VERSION,
|
||
'rubygtk_version' => Gtk::BINDING_VERSION.join('.'),
|
||
'rubygtk_version' => ::Gtk::BINDING_VERSION.join('.'),
|
||
'platform' => RUBY_PLATFORM,
|
||
'url' => 'exception',
|
||
'version' => Environment::VERSION }
|