Example #1
0
    def __init__(self):
        '''
        Constructor
        '''
        cellRendererText = CellRendererText()

        treeViewColumn = TreeViewColumn()
        treeViewColumn.pack_start(cellRendererText)

        treeView = TreeView()
        treeView.append_column(treeViewColumn)

        scrolledWindow = ScrolledWindow()
        scrolledWindow.add(treeView)

        btnAdd_Alternative = Button()
        btnDel_Alternative = Button()

        hButtonBox = HButtonBox()
        hButtonBox.pack_start(btnAdd_Alternative)
        hButtonBox.pack_start(btnDel_Alternative)

        vBox = VBox()
        vBox.pack_start(scrolledWindow)
        vBox.pack_start(hButtonBox)

        self.add(vBox)
Example #2
0
	def __create_column(self):
		from gtk import TreeViewColumn, CellRendererText, TREE_VIEW_COLUMN_FIXED
		column = TreeViewColumn()
		renderer = CellRendererText()
		column.pack_start(renderer, False)
		column.set_sizing(TREE_VIEW_COLUMN_FIXED)
		column.set_resizable(False)
		column.set_attributes(renderer, text=0)
		return column
Example #3
0
 def __create_column(self):
     from gtk import TreeViewColumn, CellRendererText, CellRendererPixbuf  #, TREE_VIEW_COLUMN_FIXED
     column = TreeViewColumn()
     txt_renderer = CellRendererText()
     pb_renderer = CellRendererPixbuf()
     column.pack_start(pb_renderer, False)
     column.pack_start(txt_renderer, True)
     # column.set_sizing(TREE_VIEW_COLUMN_FIXED)
     column.set_resizable(False)
     column.set_attributes(pb_renderer, gicon=0)
     column.set_attributes(txt_renderer, markup=1)
     return column
Example #4
0
 def __create_column(self):
     from gtk import TreeViewColumn, CellRendererText
     column = TreeViewColumn()
     renderer = CellRendererText()
     column.pack_start(renderer, False)
     column.set_attributes(renderer, text=0)
     column.set_expand(False)
     return column
Example #5
0
	def __create_column(self):
		from gtk import TreeViewColumn, CellRendererText, CellRendererPixbuf#, TREE_VIEW_COLUMN_FIXED
		column = TreeViewColumn()
		txt_renderer = CellRendererText()
		pb_renderer = CellRendererPixbuf()
		column.pack_start(pb_renderer, False)
		column.pack_start(txt_renderer, True)
		# column.set_sizing(TREE_VIEW_COLUMN_FIXED)
		column.set_resizable(False)
		column.set_attributes(pb_renderer, gicon=0)
		column.set_attributes(txt_renderer, markup=1)
		return column
Example #6
0
    def __init__(self):
        component.Component.__init__(self,
                                     'QueuedTorrents',
                                     depend=['StatusBar', 'AddTorrentDialog'])
        self.queue = []
        self.status_item = None

        self.config = ConfigManager('gtkui.conf')
        self.builder = Builder()
        self.builder.add_from_file(
            deluge.common.resource_filename(
                'deluge.ui.gtkui', os.path.join('glade', 'queuedtorrents.ui')))
        self.builder.get_object('chk_autoadd').set_active(
            self.config['autoadd_queued'])
        self.dialog = self.builder.get_object('queued_torrents_dialog')
        self.dialog.set_icon(get_logo(32))

        self.builder.connect_signals(self)

        self.treeview = self.builder.get_object('treeview')
        self.treeview.append_column(
            TreeViewColumn(_('Torrent'), CellRendererText(), text=0))

        self.liststore = ListStore(str, str)
        self.treeview.set_model(self.liststore)
        self.treeview.set_tooltip_column(1)
Example #7
0
	def __create_column(self):
		from gtk import TreeViewColumn, CellRendererText
		column = TreeViewColumn()
		renderer = CellRendererText()
		column.pack_start(renderer, False)
		column.set_attributes(renderer, text=0)
		column.set_expand(False)
		return column
Example #8
0
    def register_view(self, view):
        """Called when the View was registered"""
        super(DataPortListController, self).register_view(view)

        view['name_col'].add_attribute(view['name_text'], 'text',
                                       self.NAME_STORAGE_ID)
        view['data_type_col'].add_attribute(view['data_type_text'], 'text',
                                            self.DATA_TYPE_NAME_STORAGE_ID)
        if not isinstance(
                self.model.state, LibraryState
        ) and self.model.state.get_library_root_state() is None:
            view['name_text'].set_property("editable", True)
            view['data_type_text'].set_property("editable", True)

        # in the linkage overview the the default value is not shown
        if isinstance(view, InputPortsListView) or isinstance(
                view, OutputPortsListView):
            view['default_value_col'].add_attribute(
                view['default_value_text'], 'text',
                self.DEFAULT_VALUE_STORAGE_ID)
            self._apply_value_on_edited_and_focus_out(
                view['default_value_text'],
                self._apply_new_data_port_default_value)
            if isinstance(self.model.state, LibraryState):
                view['default_value_col'].set_title("Used value")
            if self.model.state.get_library_root_state(
            ) is None:  # never enabled means it is disabled
                view['default_value_text'].set_property("editable", True)
                view['default_value_col'].set_cell_data_func(
                    view['default_value_text'],
                    self._default_value_cell_data_func)

        self._apply_value_on_edited_and_focus_out(
            view['name_text'], self._apply_new_data_port_name)
        self._apply_value_on_edited_and_focus_out(
            view['data_type_text'], self._apply_new_data_port_type)

        if isinstance(self.model.state, LibraryState):
            view['use_runtime_value_toggle'] = CellRendererToggle()
            view['use_runtime_value_col'] = TreeViewColumn("Use Runtime Value")
            view['use_runtime_value_col'].set_property("sizing", "autosize")
            view.get_top_widget().append_column(view['use_runtime_value_col'])
            view['use_runtime_value_col'].pack_start(
                view['use_runtime_value_toggle'], True)
            view['use_runtime_value_col'].add_attribute(
                view['use_runtime_value_toggle'], 'active',
                self.USE_RUNTIME_VALUE_STORAGE_ID)
            if self.model.state.get_library_root_state() is None:
                view['use_runtime_value_toggle'].set_property(
                    "activatable", True)
                view['use_runtime_value_toggle'].connect(
                    "toggled", self.on_use_runtime_value_toggled)

        self._reload_data_port_list_store()
Example #9
0
 def __create_replacement_column(self):
     from gtk import TreeViewColumn, TREE_VIEW_COLUMN_GROW_ONLY
     from gtk import SORT_ASCENDING
     from gettext import gettext as _
     message = _("Expanded Text")
     column = TreeViewColumn(message, self.__rplrenderer, text=1)
     column.set_property("expand", True)
     column.set_property("sizing", TREE_VIEW_COLUMN_GROW_ONLY)
     return column
Example #10
0
    def __init__(self):
        Window.__init__(self)

        self.model = ListStore(str, str)

        self.aboutWindow = None
        self.helper = Helper(None)

        self.set_title('Gnome Custom Shortcuts')
        self.set_icon_from_file(join(data_path, 'icon.svg'))
        self.set_border_width(5)
        self.set_size_request(400, 400)

        list = TreeView()
        list.append_column(TreeViewColumn(''))
        list.append_column(TreeViewColumn('Command'))
        list.append_column(TreeViewColumn('Shortcut'))

        closeButton = Button(None, STOCK_CLOSE)
        aboutButton = Button(None, STOCK_ABOUT)

        buttonsBox = HButtonBox()
        buttonsBox.pack_start(aboutButton, False, False, 0)
        buttonsBox.pack_start(Label(''), True, True, 0)
        buttonsBox.pack_start(closeButton, False, False, 0)

        box = VBox(False, 5)
        box.pack_start(list, True, True, 0)
        box.pack_start(buttonsBox, False, False, 0)

        self.connect('destroy', main_quit, None)
        closeButton.connect('clicked', main_quit, None)
        aboutButton.connect('clicked', self.show_about, None)

        self.add(box)
        self.show_all()
Example #11
0
    def __init__(self):
        super(PeersTab, self).__init__('Peers', 'peers_tab', 'peers_tab_label')

        self.peer_menu = self.main_builder.get_object('menu_peer_tab')
        component.get('MainWindow').connect_signals(self)

        self.listview = self.main_builder.get_object('peers_listview')
        self.listview.props.has_tooltip = True
        self.listview.connect('button-press-event', self._on_button_press_event)
        self.listview.connect('query-tooltip', self._on_query_tooltip)

        # flag, ip, client, downspd, upspd, country code, int_ip, seed/peer icon, progress
        self.liststore = ListStore(Pixbuf, str, str, int, int, str, float, Pixbuf, float)
        self.cached_flag_pixbufs = {}

        self.seed_pixbuf = icon_seeding
        self.peer_pixbuf = icon_downloading

        # key is ip address, item is row iter
        self.peers = {}

        # Country column
        column = TreeViewColumn()
        render = CellRendererPixbuf()
        column.pack_start(render, False)
        column.add_attribute(render, 'pixbuf', 0)
        column.set_sort_column_id(5)
        column.set_clickable(True)
        column.set_resizable(True)
        column.set_expand(False)
        column.set_min_width(20)
        column.set_reorderable(True)
        self.listview.append_column(column)

        # Address column
        column = TreeViewColumn(_('Address'))
        render = CellRendererPixbuf()
        column.pack_start(render, False)
        column.add_attribute(render, 'pixbuf', 7)
        render = CellRendererText()
        column.pack_start(render, False)
        column.add_attribute(render, 'text', 1)
        column.set_sort_column_id(6)
        column.set_clickable(True)
        column.set_resizable(True)
        column.set_expand(False)
        column.set_min_width(100)
        column.set_reorderable(True)
        self.listview.append_column(column)

        # Client column
        column = TreeViewColumn(_('Client'))
        render = CellRendererText()
        column.pack_start(render, False)
        column.add_attribute(render, 'text', 2)
        column.set_sort_column_id(2)
        column.set_clickable(True)
        column.set_resizable(True)
        column.set_expand(False)
        column.set_min_width(100)
        column.set_reorderable(True)
        self.listview.append_column(column)

        # Progress column
        column = TreeViewColumn(_('Progress'))
        render = CellRendererProgress()
        column.pack_start(render, True)
        column.set_cell_data_func(render, cell_data_peer_progress, 8)
        column.set_sort_column_id(8)
        column.set_clickable(True)
        column.set_resizable(True)
        column.set_expand(False)
        column.set_min_width(100)
        column.set_reorderable(True)
        self.listview.append_column(column)

        # Down Speed column
        column = TreeViewColumn(_('Down Speed'))
        render = CellRendererText()
        column.pack_start(render, False)
        column.set_cell_data_func(render, cell_data_speed_down, 3)
        column.set_sort_column_id(3)
        column.set_clickable(True)
        column.set_resizable(True)
        column.set_expand(False)
        column.set_min_width(50)
        column.set_reorderable(True)
        self.listview.append_column(column)

        # Up Speed column
        column = TreeViewColumn(_('Up Speed'))
        render = CellRendererText()
        column.pack_start(render, False)
        column.set_cell_data_func(render, cell_data_speed_up, 4)
        column.set_sort_column_id(4)
        column.set_clickable(True)
        column.set_resizable(True)
        column.set_expand(False)
        column.set_min_width(50)
        # Bugfix: Last column needs max_width set to stop scrollbar appearing
        column.set_max_width(150)
        column.set_reorderable(True)
        self.listview.append_column(column)

        self.listview.set_model(self.liststore)

        self.load_state()

        self.torrent_id = None
Example #12
0
	def __set_properties(self):
		from gtk import TreeView, CellRendererToggle, TreeViewColumn
		from gtk import TREE_VIEW_COLUMN_AUTOSIZE, CellRendererText
		from gtk import SORT_DESCENDING, SELECTION_MULTIPLE
		from gtk import TREE_VIEW_COLUMN_FIXED
		view = self.__view
#		view.get_selection().set_mode(SELECTION_MULTIPLE)
		# Create column for line numbers.
		column = TreeViewColumn()
		view.append_column(column)
		column.set_sizing(TREE_VIEW_COLUMN_AUTOSIZE)
		column.set_spacing(12)
		renderer = CellRendererText()
		column.pack_start(renderer, True)
		column.set_attributes(renderer, text=0)
		column.set_resizable(True)
		column.set_reorderable(False)
		# Create column for line text.
		column = TreeViewColumn()
		view.append_column(column)
		column.set_sizing(TREE_VIEW_COLUMN_FIXED)
		renderer = CellRendererText()
		column.pack_start(renderer, True)
		column.set_attributes(renderer, text=1)
		column.set_resizable(False)
		column.set_spacing(12)
		column.set_fixed_width(250)
		column.set_reorderable(False)
		view.set_model(self.__create_model())
		view.realize()
		return
Example #13
0
 def __create_column(self):
     from gtk import TreeViewColumn, CellRendererText, CellRendererPixbuf
     from gtk import TREE_VIEW_COLUMN_FIXED
     column = TreeViewColumn()
     pixbuf_renderer = CellRendererPixbuf()
     text_renderer = CellRendererText()
     column.pack_start(pixbuf_renderer, False)
     column.pack_start(text_renderer, False)
     column.set_sizing(TREE_VIEW_COLUMN_FIXED)
     column.set_resizable(False)
     column.set_attributes(text_renderer, text=1)
     column.set_attributes(pixbuf_renderer, pixbuf=4)
     return column
Example #14
0
 def __create_column(self):
     from gtk import TreeViewColumn, CellRendererText, TREE_VIEW_COLUMN_FIXED
     from gtk import CellRendererPixbuf
     column = TreeViewColumn()
     txt_renderer = CellRendererText()
     txt_renderer.props.ypad = 10
     txt_renderer.props.xpad = 10
     pb_renderer = CellRendererPixbuf()
     pb_renderer.props.ypad = 10
     pb_renderer.props.xpad = 10
     column.pack_start(pb_renderer, False)
     column.pack_start(txt_renderer, True)
     column.set_sizing(TREE_VIEW_COLUMN_FIXED)
     column.set_resizable(False)
     column.set_attributes(pb_renderer, pixbuf=0)
     column.set_attributes(txt_renderer, markup=1)
     return column
Example #15
0
	def __create_column(self):
		from gtk import TreeViewColumn, CellRendererText, TREE_VIEW_COLUMN_FIXED
		from gtk import CellRendererPixbuf
		column = TreeViewColumn()
		txt_renderer = CellRendererText()
		txt_renderer.props.ypad = 10
		txt_renderer.props.xpad = 10
		pb_renderer = CellRendererPixbuf()
		pb_renderer.props.ypad = 10
		pb_renderer.props.xpad = 10
		column.pack_start(pb_renderer, False)
		column.pack_start(txt_renderer, True)
		column.set_sizing(TREE_VIEW_COLUMN_FIXED)
		column.set_resizable(False)
		column.set_attributes(pb_renderer, pixbuf=0)
		column.set_attributes(txt_renderer, markup=1)
		return column
    def __init__(self, objectives, new):
        Expander.__init__(self)

        self.connect("enter-notify-event", self.onEnterNotifyEvent)
        self.connect("leave-notify-event", self.onLeaveNotifyEvent)

        vBox = VBox()
        self.add(vBox)

        # Data model
        self.model = ListStore(str, float)

        # Title bar
        hBox = HBox()
        self.set_property("label-widget", hBox)

        self.title = Label()
        hBox.pack_start(self.title)

        # Alternatives
        treeView = TreeView(self.model)
        #		treeView.set_headers_visible(False)
        vBox.pack_start(treeView)

        listStore_objectives = ListStore(str)
        for name in objectives:
            listStore_objectives.append((name, ))

        def combo_changed(_, path, text, model):
            model[path][0] = text

        cellRenderer = CellRendererCombo()
        cellRenderer.connect("edited", combo_changed, self.model)
        cellRenderer.set_property("text-column", 0)
        cellRenderer.set_property("editable", True)
        cellRenderer.set_property("has-entry", True)
        cellRenderer.set_property("model", listStore_objectives)

        treeViewColumn = TreeViewColumn("Alternative", cellRenderer, text=0)
        #		treeViewColumn = TreeViewColumn(None,cellRenderer,text=0)
        treeView.append_column(treeViewColumn)

        def spin_changed(_, path, value, model):
            model[path][1] = float(value.replace(",", "."))

        cellRenderer = CellRendererSpin()
        cellRenderer.connect("edited", spin_changed, self.model)
        cellRenderer.set_property("adjustment",
                                  Adjustment(1, 0, 100, 1, 10, 0))
        cellRenderer.set_property("editable", True)
        cellRenderer.set_property("digits", 2)

        treeViewColumn = TreeViewColumn(None, cellRenderer, text=1)
        treeView.append_column(treeViewColumn)

        # Add/remove alternative button box
        #		hButtonBox = HButtonBox()
        #		vBox.pack_start(hButtonBox, False)

        # Add alternative
        button = Button("gtk-add")
        button.connect("clicked", self.on_btnAdd_Alternative_clicked)
        button.set_use_stock(True)
        #		hButtonBox.pack_start(button)
        vBox.pack_start(button, False)

        #		# Remove alternative
        #		button = Button("gtk-remove")
        #		button.connect("clicked",self.on_btnDel_Alternative_clicked)
        #		button.set_use_stock(True)
        #		hButtonBox.pack_start(button)

        # Expand the requeriment and add an alternative if it's new
        if new:
            self.set_expanded(True)
            self.model.append((None, 1.0))

        # Show requeriment
        self.show_all()

        # Delete requeriment button (default is hidden)
        self.imgRemove = Image()
        self.imgRemove.connect("button-press-event", self.onDelRequeriment)
        self.imgRemove.set_from_stock("gtk-cancel", ICON_SIZE_MENU)
        hBox.pack_start(self.imgRemove)
Example #17
0
	def __init__(self, runaslib=True):
		"""Class constructor."""
		# Load Glade XML
		self.xml = gtk.glade.XML( "graph.glade" )

		# Make sure application shuts down if main window closes
		self.w = self.xml.get_widget( 'window_graph' )
		self.w.connect( 'delete_event', gtk.main_quit )

		# Get Windows child
		self.w_child = self.w.get_child()

		# Get a 2nd degree polynomial
		self.poly = None

		# Get widgets
		self.label_info = self.xml.get_widget( 'label_info' )
		self.txt_func_a_1 = self.xml.get_widget( 'txt_func_a_1' )
		self.txt_func_b_1 = self.xml.get_widget( 'txt_func_b_1' )
		self.txt_func_a_2 = self.xml.get_widget( 'txt_func_a_2' )
		self.txt_func_b_2 = self.xml.get_widget( 'txt_func_b_2' )
		self.txt_func_c_2 = self.xml.get_widget( 'txt_func_c_2' )

		# Axis widgets
		self.txt_axis_x_min = self.xml.get_widget( 'txt_axis_x_min' )
		self.txt_axis_x_max = self.xml.get_widget( 'txt_axis_x_max' )
		self.txt_axis_x_step = self.xml.get_widget( 'txt_axis_x_step' )
		self.txt_axis_y_min = self.xml.get_widget( 'txt_axis_y_min' )
		self.txt_axis_y_max = self.xml.get_widget( 'txt_axis_y_max' )
		self.txt_axis_y_step = self.xml.get_widget( 'txt_axis_y_step' )

		# Main tab buttons
		btn_draw = self.xml.get_widget( 'btn_draw' )
		btn_draw.connect( 'clicked', self.on_draw_clicked )
		self.set_button_icon( btn_draw, 'draw.svg' )

		btn_store = self.xml.get_widget( 'btn_store' )
		btn_store.connect( 'clicked', self.on_store_clicked )
		self.set_button_icon( btn_store, 'archive.svg' )

		self.btn_delete = self.xml.get_widget( 'btn_delete' )
		self.btn_delete.connect( 'clicked', self.on_delete_clicked )
		self.set_button_icon( self.btn_delete, 'delete.svg' )

		self.btn_color = self.xml.get_widget( 'btn_color' )
		self.btn_color.connect( 'clicked', self.on_color_clicked )
		self.set_button_icon( self.btn_color, 'color.svg' )
		self.color_dlg = None

		self.btn_animate = self.xml.get_widget( 'btn_animate' )
		self.btn_animate.connect( 'clicked', self.on_animate_clicked )
		self.set_button_icon( self.btn_animate, 'animate.svg' )

		# Config tab buttons
		btn_reset = self.xml.get_widget( 'btn_reset' )
		btn_reset.connect( 'clicked', self.on_reset_clicked )
		self.set_button_icon( btn_reset, 'undo.svg' )

		self.toggle_show_axis_numbers = self.xml.get_widget( "toggle_show_axis_numbers" )
		self.set_button_icon( self.toggle_show_axis_numbers, 'ruller.svg' )

		self.toggle_show_grid = self.xml.get_widget( "toggle_show_grid" )
		self.set_button_icon( self.toggle_show_grid, 'grid.svg' )

		# Setup draw area
		self.draw = self.xml.get_widget( 'drawing_area' )
		self.draw.connect( 'motion_notify_event', self.update_coords )
		self.draw.connect( 'button_press_event', self.on_draw_button_pressed )
		self.draw.connect( 'configure_event', self.on_draw_configure )
		self.draw.connect( "expose_event", self.on_draw_expose )
		self.draw.get_pango_context().set_font_description( pango.FontDescription( "fixed 6" ) )
		self.pixmap = None
		self.old_pixmap = None
		self.gc = None
		self.width = self.height = 0

		# More event handlers
		self.notebook = self.xml.get_widget( 'notebook_app' )
		self.notebook.connect( 'switch_page', self.on_tab_switched )

		# Template labels
		self.notebook_degree = self.xml.get_widget( 'notebook_degree' )
		self.list_functions = self.xml.get_widget( 'list_functions' )
		self.list_functions.connect( "cursor-changed", self.on_functions_updated )
		# setup the view ...
		cellr = gtk.CellRendererText()
		col = TreeViewColumn( _( 'Functions' ), cellr )
		col.set_cell_data_func( cellr, markup_func )
		col.set_expand( True )
		self.list_functions.append_column( col )

		cellr = gtk.CellRendererToggle()
		cellr.connect( "toggled", self.on_visible_toggled )
		pb = gtk.gdk.pixbuf_new_from_file( "icons/eye.png" )
		img = gtk.Image()
		img.set_from_pixbuf( pb )
		img.show()
		col = TreeViewColumn( None, cellr )
		col.set_widget( img )
		col.set_cell_data_func( cellr, toggle_visible_func )
		col.set_expand( False )
		self.list_functions.append_column( col )

		cellr = gtk.CellRendererToggle()
		cellr.connect( "toggled", self.on_info_toggled )
		pb = gtk.gdk.pixbuf_new_from_file( "icons/information.png" )
		img = gtk.Image()
		img.set_from_pixbuf( pb )
		img.show()
		col = TreeViewColumn( None, cellr )
		col.set_widget( img )
		col.set_cell_data_func( cellr, toggle_info_func )
		col.set_expand( False )
		self.list_functions.append_column( col )

		# ... and the model
		self.list_functions.set_model( ListStore( gobject.TYPE_PYOBJECT ) )

		# Labels
		self.label_function_1_template = self.xml.get_widget( 'label_function_1_template' )
		self.label_function_1_template.set_markup( Polynomial( 1 ).get_template_markup() )
		self.label_function_2_template = self.xml.get_widget( 'label_function_2_template' )
		self.label_function_2_template.set_markup( Polynomial( 2 ).get_template_markup() )

		# Info label
		self.label_info = self.xml.get_widget( 'label_info' )
		self.label_info.set_text( '' )

		self.label_coords = self.xml.get_widget( 'label_coords' )
		self.label_coords.set_text( '' )

		# a[n] labels
		self.xml.get_widget( "label_a_1" ).set_text( _( 'a1' ) + ' = ' ) 
		self.xml.get_widget( "label_b_1" ).set_text( _( 'a2' ) + ' = ' ) 
		self.xml.get_widget( "label_a_2" ).set_text( _( 'a1' ) + ' = ' ) 
		self.xml.get_widget( "label_b_2" ).set_text( _( 'a2' ) + ' = ' ) 
		self.xml.get_widget( "label_c_2" ).set_text( _( 'a3' ) + ' = ' ) 

		# More labels
		self.xml.get_widget( "label_from_1" ).set_text( _( 'From' ) )
		self.xml.get_widget( "label_from_2" ).set_text( _( 'From' ) )
		self.xml.get_widget( "label_until_1" ).set_text( _( 'To' ) )
		self.xml.get_widget( "label_until_2" ).set_text( _( 'To' ) )
		self.xml.get_widget( "label_step_1" ).set_text( _( 'Step' ) )
		self.xml.get_widget( "label_step_2" ).set_text( _( 'Step' ) )
		self.xml.get_widget( "label_axis" ).set_text( _( 'Axis' ) )
		self.xml.get_widget( "label_dec_1" ).set_text( _( 'Decimals' ) )
		self.xml.get_widget( "label_dec_2" ).set_text( _( 'Decimals' ) )

		# Spin
		self.spin_axis_x_dec = self.xml.get_widget( "spin_axis_x_dec" )
		self.spin_axis_y_dec = self.xml.get_widget( "spin_axis_y_dec" )
		self.spin_axis_x_dec.set_editable( False )
		self.spin_axis_y_dec.set_editable( False )

		# Tab labels
		self.xml.get_widget( "label_tab_graph" ).set_text( _( 'Graph Tab' ) )
		self.xml.get_widget( "label_tab_config" ).set_text( _( 'Config Tab' ) )

		# Get parameters
		self.txt_func_a_1 = self.xml.get_widget( 'txt_func_a_1' )
		self.txt_func_b_1 = self.xml.get_widget( 'txt_func_b_1' )
		self.txt_func_a_2 = self.xml.get_widget( 'txt_func_a_2' )
		self.txt_func_b_2 = self.xml.get_widget( 'txt_func_b_2' )
		self.txt_func_c_2 = self.xml.get_widget( 'txt_func_c_2' )

		# Setup colors
		cmap = gtk.gdk.colormap_get_system()
		self.color_bg = cmap.alloc_color( '#FFFFCC' )
		self.marked_point_color = cmap.alloc_color( '#00FF00' )

		# Setup initial axis values etc
		self.validate_parameters( None )
		self.update_buttons_status()

		# self.widget will be attached to the Activity
		# This can be any GTK widget except a window
		self.widget = self.w_child
		if not runaslib:
			self.w.show_all()
			gtk.main()	
Example #18
0
 def set_properties(self):
     view = self.view
     column = TreeViewColumn()
     view.append_column(column)
     column.set_sizing(TREE_VIEW_COLUMN_AUTOSIZE)
     column.set_spacing(12)
     renderer = CellRendererText()
     column.pack_start(renderer, True)
     column.set_attributes(renderer, text=0)
     column.set_resizable(True)
     column.set_reorderable(False)
     # Create column for line text.
     column = TreeViewColumn()
     view.append_column(column)
     column.set_sizing(TREE_VIEW_COLUMN_FIXED)
     renderer = CellRendererText()
     column.pack_start(renderer, True)
     column.set_attributes(renderer, text=1)
     column.set_resizable(False)
     column.set_spacing(12)
     column.set_fixed_width(250)
     column.set_reorderable(False)
     view.set_model(self.create_model())
     view.realize()
Example #19
0
 def __create_abbreviation_column(self):
     from gtk import TreeViewColumn, TREE_VIEW_COLUMN_GROW_ONLY
     from gtk import SORT_ASCENDING
     from gettext import gettext as _
     column = TreeViewColumn(_("Abbreviation"), self.__abvrenderer, text=0)
     column.set_property("expand", False)
     column.set_property("sizing", TREE_VIEW_COLUMN_GROW_ONLY)
     column.set_property("clickable", True)
     column.set_sort_column_id(0)
     column.set_property("sort-indicator", True)
     column.set_property("sort-order", SORT_ASCENDING)
     return column
Example #20
0
    def __init__(self):
        super(PeersTab, self).__init__('Peers', 'peers_tab', 'peers_tab_label')

        self.peer_menu = self.main_builder.get_object('menu_peer_tab')
        component.get('MainWindow').connect_signals(self)

        self.listview = self.main_builder.get_object('peers_listview')
        self.listview.props.has_tooltip = True
        self.listview.connect('button-press-event',
                              self._on_button_press_event)
        self.listview.connect('query-tooltip', self._on_query_tooltip)

        # flag, ip, client, downspd, upspd, country code, int_ip, seed/peer icon, progress
        self.liststore = ListStore(Pixbuf, str, str, int, int, str, float,
                                   Pixbuf, float)
        self.cached_flag_pixbufs = {}

        self.seed_pixbuf = icon_seeding
        self.peer_pixbuf = icon_downloading

        # key is ip address, item is row iter
        self.peers = {}

        # Country column
        column = TreeViewColumn()
        render = CellRendererPixbuf()
        column.pack_start(render, False)
        column.add_attribute(render, 'pixbuf', 0)
        column.set_sort_column_id(5)
        column.set_clickable(True)
        column.set_resizable(True)
        column.set_expand(False)
        column.set_min_width(20)
        column.set_reorderable(True)
        self.listview.append_column(column)

        # Address column
        column = TreeViewColumn(_('Address'))
        render = CellRendererPixbuf()
        column.pack_start(render, False)
        column.add_attribute(render, 'pixbuf', 7)
        render = CellRendererText()
        column.pack_start(render, False)
        column.add_attribute(render, 'text', 1)
        column.set_sort_column_id(6)
        column.set_clickable(True)
        column.set_resizable(True)
        column.set_expand(False)
        column.set_min_width(100)
        column.set_reorderable(True)
        self.listview.append_column(column)

        # Client column
        column = TreeViewColumn(_('Client'))
        render = CellRendererText()
        column.pack_start(render, False)
        column.add_attribute(render, 'text', 2)
        column.set_sort_column_id(2)
        column.set_clickable(True)
        column.set_resizable(True)
        column.set_expand(False)
        column.set_min_width(100)
        column.set_reorderable(True)
        self.listview.append_column(column)

        # Progress column
        column = TreeViewColumn(_('Progress'))
        render = CellRendererProgress()
        column.pack_start(render, True)
        column.set_cell_data_func(render, cell_data_peer_progress, 8)
        column.set_sort_column_id(8)
        column.set_clickable(True)
        column.set_resizable(True)
        column.set_expand(False)
        column.set_min_width(100)
        column.set_reorderable(True)
        self.listview.append_column(column)

        # Down Speed column
        column = TreeViewColumn(_('Down Speed'))
        render = CellRendererText()
        column.pack_start(render, False)
        column.set_cell_data_func(render, cell_data_speed_down, 3)
        column.set_sort_column_id(3)
        column.set_clickable(True)
        column.set_resizable(True)
        column.set_expand(False)
        column.set_min_width(50)
        column.set_reorderable(True)
        self.listview.append_column(column)

        # Up Speed column
        column = TreeViewColumn(_('Up Speed'))
        render = CellRendererText()
        column.pack_start(render, False)
        column.set_cell_data_func(render, cell_data_speed_up, 4)
        column.set_sort_column_id(4)
        column.set_clickable(True)
        column.set_resizable(True)
        column.set_expand(False)
        column.set_min_width(50)
        # Bugfix: Last column needs max_width set to stop scrollbar appearing
        column.set_max_width(150)
        column.set_reorderable(True)
        self.listview.append_column(column)

        self.listview.set_model(self.liststore)

        self.load_state()

        self.torrent_id = None
Example #21
0
 def __set_properties(self):
     from gtk import TreeViewColumn
     from gtk import TREE_VIEW_COLUMN_AUTOSIZE, CellRendererText
     from gtk import SELECTION_MULTIPLE
     view = self.__view
     view.get_selection().set_mode(SELECTION_MULTIPLE)
     # Create a column for selecting encodings.
     column = TreeViewColumn()
     view.append_column(column)
     column.set_sizing(TREE_VIEW_COLUMN_AUTOSIZE)
     column.set_spacing(12)
     renderer = CellRendererText()
     column.pack_start(renderer, True)
     column.set_attributes(renderer, text=0)
     column.set_resizable(True)
     # Create a column for character encoding.
     column = TreeViewColumn()
     view.append_column(column)
     column.set_sizing(TREE_VIEW_COLUMN_AUTOSIZE)
     renderer = CellRendererText()
     # Create the renderer for the Language column
     column.pack_start(renderer, True)
     column.set_attributes(renderer, text=1)
     column.set_resizable(True)
     column.set_spacing(12)
     # Set treeview properties
     view.columns_autosize()
     view.set_model(self.__create_model())
     #view.set_enable_search(True)
     return
Example #22
0
	def __create_column(self):
		from gtk import TreeViewColumn, CellRendererText, CellRendererPixbuf
		from gtk import TREE_VIEW_COLUMN_FIXED
		column = TreeViewColumn()
		pixbuf_renderer = CellRendererPixbuf()
		text_renderer = CellRendererText()
		column.pack_start(pixbuf_renderer, False)
		column.pack_start(text_renderer, False)
		column.set_sizing(TREE_VIEW_COLUMN_FIXED)
		column.set_resizable(False)
		column.set_attributes(text_renderer, text=1)
		column.set_attributes(pixbuf_renderer, pixbuf=4)
		return column
Example #23
0
	def __set_properties(self):
		from gtk import TreeView, CellRendererToggle, TreeViewColumn
		from gtk import TREE_VIEW_COLUMN_AUTOSIZE, CellRendererText
		from gtk import SORT_DESCENDING
		view = self.__view
		self.__renderer.set_property("activatable", True)
		# Create a column for selecting encodings.
		column = TreeViewColumn(_("Select"), self.__renderer)
		view.append_column(column)
		column.set_expand(False)
		column.set_sizing(TREE_VIEW_COLUMN_AUTOSIZE)
		column.add_attribute(self.__renderer, "active", 0)
		column.set_sort_indicator(True)
		column.set_sort_order(SORT_DESCENDING)
		column.set_sort_column_id(0)
		# Create a renderer for the character encoding column.
		renderer = CellRendererText()
		# Create a column for character encoding.
		column = TreeViewColumn(_("Character Encoding"), renderer, text=1)
		view.append_column(column)
		column.set_expand(True)
		column.set_sizing(TREE_VIEW_COLUMN_AUTOSIZE)
		column.set_sort_indicator(True)
		column.set_sort_order(SORT_DESCENDING)
		column.set_sort_column_id(1)
		# Create the renderer for the Language column
		renderer = CellRendererText()
		# Create a column for Language and Region and set the column's properties.
		column = TreeViewColumn(_("Language and Region"), renderer, text=2)
		view.append_column(column)
		column.set_expand(True)
		column.set_sizing(TREE_VIEW_COLUMN_AUTOSIZE)
		column.set_sort_indicator(True)
		column.set_sort_order(SORT_DESCENDING)
		column.set_sort_column_id(2)
		# Set treeview properties
		view.columns_autosize()
		view.set_model(self.__create_model())
		#view.set_enable_search(True)
		return
Example #24
0
	def __create_column(self):
		from gtk import TreeViewColumn, TREE_VIEW_COLUMN_GROW_ONLY
		from gtk import SORT_ASCENDING, CellRendererText
		column = TreeViewColumn(_("Language"), CellRendererText(), text=0)
		column.set_property("expand", False)
		column.set_property("sizing", TREE_VIEW_COLUMN_GROW_ONLY)
		column.set_property("clickable", True)
		column.set_sort_column_id(0)
		column.set_property("sort-indicator", True)
		column.set_property("sort-order", SORT_ASCENDING)
		return column
Example #25
0
 def __create_column(self,
                     title,
                     renderer,
                     text=0,
                     expand=False,
                     indicator=False):
     from gtk import TREE_VIEW_COLUMN_AUTOSIZE, SORT_DESCENDING
     from gtk import TreeViewColumn
     column = TreeViewColumn(title, renderer, text=text)
     column.set_expand(expand)
     column.set_sizing(TREE_VIEW_COLUMN_AUTOSIZE)
     column.set_sort_indicator(indicator)
     column.set_sort_order(SORT_DESCENDING)
     column.set_sort_column_id(text)
     return column
Example #26
0
	def __create_column(self, name, column):
		from gtk import TreeViewColumn, TREE_VIEW_COLUMN_GROW_ONLY
		from gtk import CellRendererText
		column = TreeViewColumn(name, CellRendererText(), text=column)
		column.set_property("sizing", TREE_VIEW_COLUMN_GROW_ONLY)
		return column
Example #27
0
 def set_properties(self):
     view = self.view
     column = TreeViewColumn()
     view.append_column(column)
     column.set_sizing(TREE_VIEW_COLUMN_AUTOSIZE)
     column.set_spacing(12)
     renderer = CellRendererText()
     column.pack_start(renderer, True)
     column.set_attributes(renderer, text=0)
     column.set_resizable(True)
     column.set_reorderable(False)
     # Create column for line text.
     column = TreeViewColumn()
     view.append_column(column)
     column.set_sizing(TREE_VIEW_COLUMN_FIXED)
     renderer = CellRendererText()
     column.pack_start(renderer, True)
     column.set_attributes(renderer, text=1)
     column.set_resizable(False)
     column.set_spacing(12)
     column.set_fixed_width(250)
     column.set_reorderable(False)
     view.set_model(self.create_model())
     view.realize()
Example #28
0
 def __set_properties(self):
     from gtk import TreeView, CellRendererToggle, TreeViewColumn
     from gtk import TREE_VIEW_COLUMN_AUTOSIZE, CellRendererText
     from gtk import SORT_DESCENDING, SELECTION_MULTIPLE
     from gtk import TREE_VIEW_COLUMN_FIXED
     view = self.__view
     #		view.get_selection().set_mode(SELECTION_MULTIPLE)
     # Create column for line numbers.
     column = TreeViewColumn()
     view.append_column(column)
     column.set_sizing(TREE_VIEW_COLUMN_AUTOSIZE)
     column.set_spacing(12)
     renderer = CellRendererText()
     column.pack_start(renderer, True)
     column.set_attributes(renderer, text=0)
     column.set_resizable(True)
     column.set_reorderable(False)
     # Create column for line text.
     column = TreeViewColumn()
     view.append_column(column)
     column.set_sizing(TREE_VIEW_COLUMN_FIXED)
     renderer = CellRendererText()
     column.pack_start(renderer, True)
     column.set_attributes(renderer, text=1)
     column.set_resizable(False)
     column.set_spacing(12)
     column.set_fixed_width(250)
     column.set_reorderable(False)
     view.set_model(self.__create_model())
     view.realize()
     return
Example #29
0
	def __create_column(self, title, renderer, text=0, expand=False, indicator=False):
		from gtk import TREE_VIEW_COLUMN_AUTOSIZE, SORT_DESCENDING
		from gtk import TreeViewColumn
		column = TreeViewColumn(title, renderer, text=text)
		column.set_expand(expand)
		column.set_sizing(TREE_VIEW_COLUMN_AUTOSIZE)
		column.set_sort_indicator(indicator)
		column.set_sort_order(SORT_DESCENDING)
		column.set_sort_column_id(text)
		return column