Beispiel #1
0
    def build_search_box(self):
        self.search_bar_box = ca.new_widget('HBox',
                                             {'size_request': (-1, -1),
                                              'show': True})

        self.search_bar = ca.new_widget('Entry',
                                            {'size_request': (self.window.width/2, 50),
                                             'show': True})
        Gtk.rc_parse_string("""style "search-bar-font" { font_name="Sans 20" } class "GtkEntry"  style "search-bar-font" """)

        self.search_button = ca.new_widget('Button',
                                               {'label':'Search',
                                                'size_request': (-1, -1),
                                                'show': True})
        self.search_button.connect('clicked', self.submit_query)

        self.init_search_source()
        self.init_search_api()

        self.results_vbox = ca.new_widget('VBox',
                                              {'size_request': (int(3*(self.window.width/2)),-1),
                                               'show': True})

        self.search_bar_box.pack_start(self.search_bar, False, False, 0)
        self.search_bar_box.pack_start(self.search_button, False, False, 0)
        self.search_bar_box.pack_start(self.search_source, False, False, 0)
        self.search_bar_box.pack_start(self.search_source_api, False, False, 0)
        self.search_vbox.pack_start(self.search_bar_box, False, False, 0)
        self.search_vbox.pack_start(self.results_vbox, True, False, 0)
        self.main_layout.put(self.search_vbox, 0, 0)
Beispiel #2
0
    def reconfigure(self):
        """Update configuration for the whole application"""

        if self.config['handle_size'] in range(0, 6):
            Gtk.rc_parse_string("""
                style "terminator-paned-style" {
                    GtkPaned::handle_size = %s 
                }
                class "GtkPaned" style "terminator-paned-style" 
                """ % self.config['handle_size'])
            Gtk.rc_reset_styles(Gtk.Settings.get_default())

        # Cause all the terminals to reconfigure
        for terminal in self.terminals:
            terminal.reconfigure()

        # Reparse our keybindings
        self.keybindings.configure(self.config['keybindings'])

        # Update tab position if appropriate
        maker = Factory()
        for window in self.windows:
            child = window.get_child()
            if maker.isinstance(child, 'Notebook'):
                child.configure()
Beispiel #3
0
    def attach (self):

        config_home = Common.utils.XDG.CONFIG_HOME

        state_filename = os.path.join (config_home, "gst-debug-viewer", "state")

        self.state = AppState (state_filename)
        self.state_section = self.state.sections["state"]

        self.load_plugins ()

        self.windows = []
        
        # we override expander size because of:
        # https://bugzilla.gnome.org/show_bug.cgi?id=615985
        rcstring = """
        style "no-expander-treeview-style" {
            GtkTreeView::expander_size = 1
            #GtkTreeView::vertical-separator = 0
            GtkWidget::focus-line-width = 0
        }
        
        widget "*.log_view" style "no-expander-treeview-style"
        """
        Gtk.rc_parse_string (rcstring)

        self.open_window ()
Beispiel #4
0
    def __init__(self, image_name,
        adjustment=None, slider_border=0,
        insensitive_name=None, trough_color="#3D403A",
        snap=False):

        image_name = imagefile(image_name)

        Gtk.VScale.__init__(self)

        self.set_adjustment(adjustment)
        
        if snap:
            self.snap = 1 / snap

        else:
            self.snap = False

        #colormap = self.get_colormap()
        #self.troughcolor = colormap.alloc_color(
        #    trough_color, True, True)

        img = Gtk.Image()
        img.set_from_file(image_name)
        self.sliderPixbuf = img.get_pixbuf()

        if insensitive_name == None:
            self.insensitivePixbuf = None
            
        else:
            img = Gtk.Image()
            img.set_from_file(insensitive_name)
            self.insensitivePixbuf = img.get_pixbuf()

        name = image_name + "ImageVScale"
        self.set_name(name)

        rc_str = """
style "scale_style" {
    GtkRange::slider_width = %d
    GtkScale::slider_length = %d
}
widget "*%s*" style "scale_style"
        """ % (self.sliderPixbuf.get_width(),
        self.sliderPixbuf.get_height(), name)
        Gtk.rc_parse_string(rc_str)

        self.pixbufWidth = self.sliderPixbuf.get_width()
        self.pixbufHeight = self.sliderPixbuf.get_height()
        self.sliderBorder = slider_border
        self.sliderBorderMUL2 = self.sliderBorder * 2

        self.set_draw_value(False)

        #self.connect("expose-event", self.expose)
        self.connect("size-allocate", self.size_allocate)
        self.connect("button-release-event", self.button_release)
        adjustment.connect("value-changed", self.value_changed)
Beispiel #5
0
 def __init__(self):
     rc_st = '''
         style "menubar-style" {
             GtkMenuBar::shadow_type = none
             GtkMenuBar::internal-padding = 0
             }
         class "GtkMenuBar" style "menubar-style"
     '''
     Gtk.rc_parse_string(rc_st)
     Gtk.MenuBar.__init__(self)
Beispiel #6
0
def force_no_focus_padding(widget):
    Gtk.rc_parse_string('\n'
                        '   style "timer-applet-button-style"\n'
                        '   {\n'
                        '      GtkWidget::focus-line-width=0\n'
                        '      GtkWidget::focus-padding=0\n'
                        '   }\n'
                        '\n'
                        '   widget "*.timer-applet-button" style "timer-applet-button-style"\n'
                        '\n')
    widget.set_name('timer-applet-button')
	def __init__(self):		
		#UI from Glade Interface Designer
		gladefile ="NBUReader.glade"
		self.builder = Gtk.Builder()
		self.builder.add_from_file(gladefile)
		self.builder.connect_signals(self)

		#filechooser
		self.importFile = self.builder.get_object('importFile')
		
		#status combo
		self.msgStatus = self.builder.get_object("msgStatusCombo")
		self.msgStatusModel = self.msgStatus.get_model()

		#messages treeview
		self.dataTreeView = self.builder.get_object("dataTreeView")
		self.dataTreeViewModel = self.builder.get_object("messages")
		
		#ToDo:Icons are not working
		#ToDo: Select some other colors
		Gtk.rc_parse_string("""
			style "tab-close-button-style" {
				GtkTreeView::odd-row-color = "#00CBFF"
				GtkTreeView::even-row-color = "#ABABAB"
				GtkTreeView::allow-rules = 1
			}
			widget "*custom_treeview*" style "custom-treestyle"
		""")
		self.dataTreeView.set_name("custom_treeview")

		#status bar
		self.statusbar = self.builder.get_object("statusbar")

		#inital values for widgets
		self.selectedNumbers = []
		#self.populate_numbers_combo([])
		self.msgStatus.set_active(0)
		self.statusbar.push(1, "0 messages showing out of 0 messages")    	

		self.dialogWindow = self.builder.get_object("selectContactDialog")
		self.dialogWindow.treeView = self.builder.get_object("SCD-contactsTV")
		self.dialogWindow.treeViewSelection = self.builder.get_object("SCD-contactTVselection")
		self.dialogWindow.iterValue = None

		self.numbersList = self.builder.get_object('numbersList')

		self.window = self.builder.get_object("mainWindow")
		self.window.show_all()
Beispiel #8
0
    def __init__(self):
        rc_st = '''
        style "toolbar-style" {
            GtkToolbar::shadow_type = none
            }
        class "GtkToolbar" style "toolbar-style"
        '''
        Gtk.rc_parse_string(rc_st)

        Gtk.Toolbar.__init__(self)

        self.show()
        self.set_style(Gtk.ToolbarStyle.ICONS)
        self.set_show_arrow(False)

        self.i = 0
                self.append_page(tab_page, label)
                tab_page.show()
                label.show()
                tab_page.setup(url, title=tab_history[0]['title'])

            else:
                browser = Browser()
                browser.connect('new-tab', self.__new_tab_cb)
                browser.connect('open-pdf', self.__open_pdf_in_new_tab_cb)
                self._append_tab(browser)
                browser.set_history(tab_history)


Gtk.rc_parse_string('''
    style "browse-tab-close" {
        xthickness = 0
        ythickness = 0
    }
    widget "*browse-tab-close" style "browse-tab-close"''')


class TabPage(Gtk.ScrolledWindow):
    __gtype_name__ = 'BrowseTabPage'

    def __init__(self, browser):
        GObject.GObject.__init__(self)

        self._browser = browser

        self.add(browser)
        browser.show()
Beispiel #10
0
            _('$title ($current_time / $total_time)'),
        )

    def on_option_set(self, event, settings, option):
        """
            Updates the internal format on setting change
        """
        if option == 'gui/progress_bar_text_format':
            GLib.idle_add(self.set_property, 'format', self.get_option_value())


Gtk.rc_parse_string(
    '''
    style "progress-button" {
        GtkToggleButton::default-border = {0, 0, 0, 0}
        GtkToggleButton::default-outside-border = {0, 0, 0, 0}
        GtkToggleButton::inner-border = {0, 0, 0, 0}
    }
    widget "*.progressbutton" style "progress-button"
'''
)


class ProgressButtonControl(PlaylistButtonControl):
    name = 'progress_button'
    title = _('Progress button')
    description = _('Playback progress and access ' 'to the current playlist')
    # Required to make overrides work
    __gsignals__ = {}

    def __init__(self):
        PlaylistButtonControl.__init__(self)
Beispiel #11
0
# WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
# General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program.  If not, see <http://www.gnu.org/licenses/>.

from gi.repository import GObject
from gi.repository import Gtk
from gi.repository import Pango


Gtk.rc_parse_string(
    """
    style "meld-statusbar-style" {
        GtkStatusbar::shadow-type = GTK_SHADOW_NONE
    }
    class "MeldStatusBar" style "meld-statusbar-style"
    """)


class MeldStatusBar(Gtk.Statusbar):
    __gtype_name__ = "MeldStatusBar"

    def __init__(self):
        GObject.GObject.__init__(self)
        self.props.spacing = 6

        hbox = self.get_message_area()
        label = hbox.get_children()[0]
        hbox.props.spacing = 6
Beispiel #12
0
from galicaster.utils.i18n import _

logger = context.get_logger()

rcstring = """
style "big-scroll" {
    GtkRange::stepper-size = 20
    GtkRange::slider-width = 25
}

class "GtkRange" style "big-scroll"

"""

Gtk.rc_parse_string(rcstring)
#Gtk.rc_reset_styles(self.main_window.get_settings())


class ListingClassUI(ManagerUI):
    """
    Create Recording Listing in a VBOX with TreeView from an MP list
    """
    __gtype_name__ = 'Listing'


    def __init__(self):
        ManagerUI.__init__(self, 3)

        self.menu = Gtk.Menu()
        self.fill_menu()
Beispiel #13
0
    def __init__(self):
        component.Component.__init__(self, "FilterTreeView", interval=2)
        self.window = component.get("MainWindow")
        glade = self.window.main_glade
        self.hpaned = glade.get_object("hpaned")
        self.scrolled = glade.get_object("scrolledwindow_sidebar")
        self.sidebar = component.get("SideBar")
        self.config = ConfigManager("gtkui.conf")
        self.tracker_icons = component.get("TrackerIcons")

        self.label_view = Gtk.TreeView()
        self.sidebar.add_tab(self.label_view, "filters", "Filters")

        #set filter to all when hidden:
        self.sidebar.notebook.connect("hide", self._on_hide)

        #menu
        glade_menu = Gtk.Builder()
        glade_menu.add_from_file(pkg_resources.resource_filename("deluge.ui.gtkui",
            "builder/filtertree_menu.ui"))
        self.menu = glade_menu.get_object("filtertree_menu")
        glade_menu.connect_signals({
            "select_all": self.on_select_all,
            "pause_all": self.on_pause_all,
            "resume_all": self.on_resume_all
        })

        self.default_menu_items = self.menu.get_children()

        # Create the liststore
        #cat, value, label, count, pixmap, visible
        self.treestore = Gtk.TreeStore(str, str, str, int, GdkPixbuf.Pixbuf, bool)

        # Create the column
        column = Gtk.TreeViewColumn("Filters")
        column.set_sizing(Gtk.TreeViewColumnSizing.FIXED)
        render = Gtk.CellRendererPixbuf()
        self.renderpix = render
        column.pack_start(render, False)
        column.add_attribute(render, 'pixbuf', 4)
        render = Gtk.CellRendererText()
        column.pack_start(render, False)
        column.set_cell_data_func(render, self.render_cell_data,None)

        self.label_view.append_column(column)

        #style:
        self.label_view.set_show_expanders(True)
        self.label_view.set_headers_visible(False)
        # Force the theme to use an expander-size of 15 so that we don't cut out
        # entries due to our indentation hack.
        Gtk.rc_parse_string('style "treeview-style" { GtkTreeView::expander-size = 15 } class "GtkTreeView" style "treeview-style"')

        self.label_view.set_model(self.treestore)
        self.label_view.get_selection().connect("changed", self.on_selection_changed)
        self.create_model_filter()

        #init.....
        self.label_view.connect("button-press-event", self.on_button_press_event)

        #colors using current theme.
        style_ctx = self.window.window.get_style_context()
        self.colour_background = style_ctx.get_background_color(Gtk.StateFlags.NORMAL)
        self.colour_foreground = style_ctx.get_color(Gtk.StateFlags.NORMAL)