本文整理汇总了Python中config.ConfigManager.get_conf方法的典型用法代码示例。如果您正苦于以下问题:Python ConfigManager.get_conf方法的具体用法?Python ConfigManager.get_conf怎么用?Python ConfigManager.get_conf使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类config.ConfigManager
的用法示例。
在下文中一共展示了ConfigManager.get_conf方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: override_gtk_theme
# 需要导入模块: from config import ConfigManager [as 别名]
# 或者: from config.ConfigManager import get_conf [as 别名]
def override_gtk_theme(self):
css_provider = Gtk.CssProvider()
bg = Gdk.color_parse(ConfigManager.get_conf('color-background'))
bg_hex = '#%02X%02X%02X' % (int((bg.red/65536.0)*256), int((bg.green/65536.0)*256), int((bg.blue/65536.0)*256))
css_provider.load_from_data('''
#notebook GtkPaned
{
-GtkPaned-handle-size: %i;
}
GtkVScrollbar
{
-GtkRange-slider-width: 5;
}
GtkVScrollbar.trough {
background-image: none;
background-color: %s;
border-width: 0;
border-radius: 0;
}
GtkVScrollbar.slider, GtkVScrollbar.slider:prelight, GtkVScrollbar.button {
background-image: none;
border-width: 0;
background-color: alpha(#FFF, 0.4);
border-radius: 10px;
box-shadow: none;
}
''' % (ConfigManager.get_conf('seperator-size'), bg_hex))
style_context = Gtk.StyleContext()
style_context.add_provider_for_screen(self.screen, css_provider, Gtk.STYLE_PROVIDER_PRIORITY_USER)
示例2: __init__
# 需要导入模块: from config import ConfigManager [as 别名]
# 或者: from config.ConfigManager import get_conf [as 别名]
def __init__(self):
super(Gtk.HBox, self).__init__()
ConfigManager.add_callback(self.update_ui)
self.vte = Vte.Terminal()
self.pack_start(self.vte, True, True, 0)
if ConfigManager.get_conf('show-scrollbar'):
self.vscroll = Gtk.VScrollbar()
self.vscroll.set_adjustment(self.vte.get_vadjustment())
self.pack_end(self.vscroll, False, True, 0)
dir_conf = ConfigManager.get_conf('dir')
if dir_conf == '$home$':
run_dir = os.environ['HOME']
elif dir_conf == '$pwd$':
run_dir = os.getcwd()
else:
run_dir = dir_conf
self.vte.fork_command_full(
Vte.PtyFlags.DEFAULT,
run_dir,
ConfigManager.get_conf('shell').split(),
[],
GLib.SpawnFlags.DO_NOT_REAP_CHILD,
None,
None)
self.vte.connect('button-release-event', self.on_button_release)
self.update_ui()
示例3: on_window_losefocus
# 需要导入模块: from config import ConfigManager [as 别名]
# 或者: from config.ConfigManager import get_conf [as 别名]
def on_window_losefocus(self, window, event):
if self.slide_effect_running:
return
if ConfigManager.disable_losefocus_temporary:
return
if not ConfigManager.get_conf('losefocus-hiding'):
return
if self.get_property('visible'):
self.losefocus_time = GdkX11.x11_get_server_time(self.get_window())
if ConfigManager.get_conf('use-animation'):
self.slide_up()
self.unrealize()
self.hide()
示例4: __init__
# 需要导入模块: from config import ConfigManager [as 别名]
# 或者: from config.ConfigManager import get_conf [as 别名]
def __init__(self, progname=[ConfigManager.get_conf('shell')], run_dir=None, term_id=0):
super(Gtk.HBox, self).__init__()
ConfigManager.add_callback(self.update_ui)
self.progname = ' '.join(progname)
self.id = VteObjectContainer.handle_id(term_id)
self.parent = 0
self.vte = Vte.Terminal()
self.pack_start(self.vte, True, True, 0)
self.vscroll = Gtk.VScrollbar(self.vte.get_vadjustment())
self.pack_start(self.vscroll, False, False, 0)
self.fork_process(progname, run_dir)
for regex_string in regex_strings:
regex_obj = GLib.Regex.new(regex_string, 0, 0)
tag = self.vte.match_add_gregex(regex_obj, 0)
self.vte.match_set_cursor_type(tag, Gdk.CursorType.HAND2)
self.vte.connect('scroll-event', self.scroll_event)
self.vte.connect('child-exited', self.on_child_exited)
self.vte.connect('button-release-event', self.on_button_release)
self.vte.connect('increase-font-size', self.change_font_size, 0.1)
self.vte.connect('decrease-font-size', self.change_font_size, -0.1)
self.update_ui()
示例5: update_ui
# 需要导入模块: from config import ConfigManager [as 别名]
# 或者: from config.ConfigManager import get_conf [as 别名]
def update_ui(self):
#self.vte.set_background_saturation(ConfigManager.get_conf('transparency') / 100.0)
#self.vte.set_opacity(int((100 - ConfigManager.get_conf(('transparency'))) / 100.0 * 65535))
self.vte.set_colors(
Gdk.color_parse(ConfigManager.get_conf('color-text')),
Gdk.color_parse(ConfigManager.get_conf('color-background')),
[])
#self.vte.set_background_image_file(
# ConfigManager.get_conf('background-image'))
if not ConfigManager.get_conf('use-default-font'):
self.vte.set_font_from_string(ConfigManager.get_conf('font-name'))
self.show_all()
示例6: __init__
# 需要导入模块: from config import ConfigManager [as 别名]
# 或者: from config.ConfigManager import get_conf [as 别名]
def __init__(self):
globalhotkeys.init()
self.hotkey = globalhotkeys.GlobalHotkey()
self.bind_success = self.hotkey.bind(ConfigManager.get_conf('global-key'), lambda w: self.show_hide(), None)
self.apps = []
self.old_apps = []
self.screenid = 0
self.on_doing = False
self.is_running = False
示例7: slide_down
# 需要导入模块: from config import ConfigManager [as 别名]
# 或者: from config.ConfigManager import get_conf [as 别名]
def slide_down(self, i=1):
step = ConfigManager.get_conf('step-count')
self.slide_effect_running = True
if not self.is_fullscreen:
win_rect = self.monitor
else:
win_rect = self.get_screen_rectangle()
if self.get_window() != None:
self.get_window().enable_synchronized_configure()
if i < step + 1:
self.resize(win_rect.width, int(((win_rect.height/step) * i)))
self.queue_resize()
self.resizer.set_property('position', int(((win_rect.height/step) * i)))
self.resizer.queue_resize()
self.update_events()
GObject.timeout_add(ConfigManager.get_conf('step-time'), self.slide_down, i+1)
if self.get_window() != None:
self.get_window().configure_finished()
self.slide_effect_running = False
示例8: slide_up
# 需要导入模块: from config import ConfigManager [as 别名]
# 或者: from config.ConfigManager import get_conf [as 别名]
def slide_up(self, i=0):
self.slide_effect_running = True
step = ConfigManager.get_conf('step-count')
if not self.is_fullscreen:
win_rect = self.monitor
else:
win_rect = self.get_allocation()
if self.get_window() != None:
self.get_window().enable_synchronized_configure()
if i < step+1:
self.resize(win_rect.width, win_rect.height - int(((win_rect.height/step) * i)))
self.queue_resize()
self.update_events()
GObject.timeout_add(ConfigManager.get_conf('step-time'), self.slide_up, i+1)
else:
self.hide()
self.unrealize()
if self.get_window() != None:
self.get_window().configure_finished()
self.slide_effect_running = False
示例9: show_hide
# 需要导入模块: from config import ConfigManager [as 别名]
# 或者: from config.ConfigManager import get_conf [as 别名]
def show_hide(self):
if self.slide_effect_running:
return
event_time = self.hotkey.get_current_event_time()
if(self.losefocus_time and self.losefocus_time >= event_time):
return
if self.get_visible():
if ConfigManager.get_conf('use-animation'):
self.slide_up()
else:
self.hide()
return
else:
self.update_ui()
self.show()
x11_win = self.get_window()
x11_time = GdkX11.x11_get_server_time(x11_win)
x11_win.focus(x11_time)
if ConfigManager.get_conf('use-animation'):
self.slide_down()
示例10: exit
# 需要导入模块: from config import ConfigManager [as 别名]
# 或者: from config.ConfigManager import get_conf [as 别名]
def exit(self):
if ConfigManager.get_conf('prompt-on-quit'):
ConfigManager.disable_losefocus_temporary = True
msgtext = _("Do you really want to quit?")
msgbox = Gtk.MessageDialog(self, Gtk.DialogFlags.DESTROY_WITH_PARENT, Gtk.MessageType.WARNING, Gtk.ButtonsType.YES_NO, msgtext)
response = msgbox.run()
msgbox.destroy()
ConfigManager.disable_losefocus_temporary = False
if response != Gtk.ResponseType.YES:
return False
quit_prog()
示例11: fork_process
# 需要导入模块: from config import ConfigManager [as 别名]
# 或者: from config.ConfigManager import get_conf [as 别名]
def fork_process(self, progname, run_dir=None):
if run_dir == None:
dir_conf = ConfigManager.get_conf('dir')
if dir_conf == '$home$':
run_dir = os.environ['HOME']
elif dir_conf == '$pwd$':
run_dir = os.getcwd()
else:
run_dir = dir_conf
self.pid = self.vte.fork_command_full(
Vte.PtyFlags.DEFAULT,
run_dir,
progname,
[],
GLib.SpawnFlags.DO_NOT_REAP_CHILD,
None,
None)
示例12: grab
# 需要导入模块: from config import ConfigManager [as 别名]
# 或者: from config.ConfigManager import get_conf [as 别名]
def grab(self):
Gdk.threads_enter()
accelerator = ConfigManager.get_conf('global-key')
Gdk.threads_leave()
keyval, modifiers = Gtk.accelerator_parse(accelerator)
if not accelerator or(not keyval and not modifiers):
self.keycode = None
self.modifiers = None
return
self.keycode= self.keymap.get_entries_for_keyval(keyval)[1][0].keycode
self.modifiers = int(modifiers)
catch = error.CatchError(error.BadAccess)
self.root.grab_key(self.keycode, X.AnyModifier, True, X.GrabModeAsync, X.GrabModeSync,onerror=catch)
self.display.sync()
if catch.get_error():
return False
return True
示例13: __init__
# 需要导入模块: from config import ConfigManager [as 别名]
# 或者: from config.ConfigManager import get_conf [as 别名]
def __init__(self):
super(TerminalWin, self).__init__()
self.keybinding = None
self.builder = Gtk.Builder()
self.builder.add_from_file(ConfigManager.data_dir + 'ui/main.ui')
ConfigManager.add_callback(self.update_ui)
ConfigManager.show_hide_callback = self.show_hide
self.screen = self.get_screen()
self.losefocus_time = 0
self.init_transparency()
self.init_ui()
self.add_page()
self.update_ui()
if ConfigManager.get_conf('hide-on-start'):
self.hide()
示例14: page_close
# 需要导入模块: from config import ConfigManager [as 别名]
# 或者: from config.ConfigManager import get_conf [as 别名]
def page_close(self, menu, sender):
button_count = len(self.buttonbox.get_children())
# don't forget "radio_group_leader"
if button_count <= 2:
if (ConfigManager.get_conf('spawn-term-on-last-close')):
self.add_page()
else:
return self.quit()
page_no = 0
for i in self.buttonbox:
if i != self.radio_group_leader:
if i == sender:
self.notebook.remove_page(page_no)
self.buttonbox.remove(i)
last_button = self.buttonbox.get_children()[-1]
last_button.set_active(True)
return True
page_no = page_no + 1
示例15: update_ui
# 需要导入模块: from config import ConfigManager [as 别名]
# 或者: from config.ConfigManager import get_conf [as 别名]
def update_ui(self):
self.unmaximize()
self.stick()
self.override_gtk_theme()
self.set_keep_above(ConfigManager.get_conf('always-on-top'))
self.set_decorated(ConfigManager.get_conf('use-border'))
self.set_skip_taskbar_hint(ConfigManager.get_conf('skip-taskbar'))
win_rect = self.monitor
if ConfigManager.get_conf('hide-tab-bar'):
self.tabbar.hide()
self.tabbar.set_no_show_all(True)
else:
self.tabbar.set_no_show_all(False)
self.tabbar.show()
if self.is_fullscreen:
win_rect = self.get_screen_rectangle()
self.reshow_with_initial_size()
self.move(win_rect.x, win_rect.y)
self.fullscreen()
# hide resizer
if self.resizer.get_child2() != None:
self.resizer.remove(self.resizer.get_child2())
# hide tab bar
if ConfigManager.get_conf('hide-tab-bar-fullscreen'):
self.tabbar.set_no_show_all(True)
self.tabbar.hide()
else:
# show resizer
if self.resizer.get_child2() == None:
self.resizer.add2(Gtk.Box())
self.resizer.get_child2().show_all()
# show tab bar
if ConfigManager.get_conf('hide-tab-bar-fullscreen'):
self.tabbar.set_no_show_all(False)
self.tabbar.show()
self.unfullscreen()
self.reshow_with_initial_size()
self.resize(win_rect.width, win_rect.height)
self.move(win_rect.x, win_rect.y)