def get_menu(self):
        """Create and populate the menu."""

        menu = Gtk.Menu()

        self.change_state_item = add2menu(
            menu,
            text=_('Disable Touchpad'),
            conector_event='activate',
            conector_action=self.on_change_state_item)
        add2menu(menu,
                 text=_('Hide icon'),
                 conector_event='activate',
                 conector_action=self.on_hide_item)
        add2menu(menu,
                 text=_('Preferences'),
                 conector_event='activate',
                 conector_action=self.on_preferences_item)
        add2menu(menu)
        menu_help = add2menu(menu, text=_('Help'))
        menu_help.set_submenu(self.get_help_menu())
        add2menu(menu)
        add2menu(menu,
                 text=_('Exit'),
                 conector_event='activate',
                 conector_action=self.on_quit_item)
        #
        menu.show()
        return (menu)
Exemplo n.º 2
0
    def __init__(self):
        title = comun.APPNAME + ' | '+_('Calendar')
        Gtk.Dialog.__init__(self,title,None,Gtk.DialogFlags.MODAL | Gtk.DialogFlags.DESTROY_WITH_PARENT,(Gtk.STOCK_OK, Gtk.ResponseType.ACCEPT,Gtk.STOCK_CANCEL, Gtk.ResponseType.REJECT))
        self.set_size_request(300, 50)
        self.set_resizable(False)
        self.set_icon_from_file(comun.ICON)
        self.connect('destroy', self.close_application)
        #
        vbox0 = Gtk.VBox(spacing = 5)
        vbox0.set_border_width(5)
        self.get_content_area().add(vbox0)
        #
        frame1 = Gtk.Frame()
        vbox0.add(frame1)
        #
        table1 = Gtk.Table(rows = 1, columns = 2, homogeneous = False)
        table1.set_border_width(2)
        table1.set_col_spacings(2)
        table1.set_row_spacings(2)
        frame1.add(table1)
        #
        label = Gtk.Label(_('Calendar name')+':')
        label.set_alignment(0.,0.5)
        table1.attach(label, 0, 1, 0, 1,
                      xoptions = Gtk.AttachOptions.SHRINK,
                      yoptions = Gtk.AttachOptions.SHRINK)

        self.entry = Gtk.Entry()
        self.entry.set_width_chars(30)
        table1.attach(self.entry, 1, 2, 0, 1,
                      xoptions = Gtk.AttachOptions.FILL,
                      yoptions = Gtk.AttachOptions.FILL)
        #
        self.show_all()
Exemplo n.º 3
0
	def __init__(self,searched_text='',replacement_text=''):
		#
		Gtk.Dialog.__init__(self, 'uText | '+_('Search and replace'),None,Gtk.DialogFlags.MODAL | Gtk.DialogFlags.DESTROY_WITH_PARENT,(Gtk.STOCK_CANCEL, Gtk.ResponseType.REJECT,Gtk.STOCK_OK, Gtk.ResponseType.ACCEPT))
		self.set_position(Gtk.WindowPosition.CENTER_ALWAYS)
		#self.set_size_request(400, 230)
		self.connect('close', self.close_application)
		self.set_icon_from_file(comun.ICON)
		#
		vbox0 = Gtk.VBox(spacing = 5)
		vbox0.set_border_width(5)
		self.get_content_area().add(vbox0)
		#***************************************************************
		#***************************************************************
		frame1 = Gtk.Frame()
		vbox0.pack_start(frame1,False,True,1)
		table1 = Gtk.Table(2, 2, False)
		frame1.add(table1)
		#***************************************************************
		label1 = Gtk.Label(_('Search')+':')
		label1.set_alignment(0, 0.5)
		table1.attach(label1,0,1,0,1, xpadding=5, ypadding=5)
		self.search_text = Gtk.Entry()
		table1.attach(self.search_text,1,2,0,1, xpadding=5, ypadding=5)
		label2 = Gtk.Label(_('Replace with')+':')
		label2.set_alignment(0, 0.5)
		table1.attach(label2,0,1,1,2, xpadding=5, ypadding=5)
		self.replace_text = Gtk.Entry()
		table1.attach(self.replace_text,1,2,1,2, xpadding=5, ypadding=5)
		#
		self.search_text.set_text(searched_text)
		self.replace_text.set_text(replacement_text)
		#
		self.show_all()
Exemplo n.º 4
0
    def init_ui(self):
        BasicDialog.init_ui(self)

        label1 = Gtk.Label(_('Image resolution') + ':')
        label1.set_alignment(0, .5)
        self.grid.attach(label1, 0, 0, 1, 1)

        label2 = Gtk.Label(_('Append to file') + ':')
        label2.set_alignment(0, .5)
        self.grid.attach(label2, 0, 1, 1, 1)

        self.dpi_entry = Gtk.Entry()
        self.dpi_entry.set_tooltip_text(_('Set dpi to reduce file'))
        self.dpi_entry.set_text('100')
        self.grid.attach(self.dpi_entry, 1, 0, 1, 1)

        self.dpi_entry.set_activates_default(True)
        self.dpi_entry.grab_focus()

        self.append_entry = Gtk.Entry()
        self.append_entry.set_tooltip_text(_('Append to file to create output filename'))
        self.append_entry.set_text('_reduced')
        self.grid.attach(self.append_entry, 1, 1, 1, 1)

        self.show_all()
Exemplo n.º 5
0
 def on_button_add_clicked(self, widget):
     selection = self.treeview.get_selection()
     if selection.count_selected_rows() > 0:
         model, iter = selection.get_selected()
         treepath = model.get_path(iter)
         position = int(str(treepath))
     else:
         model = self.treeview.get_model()
         position = len(model)
     dialog = Gtk.FileChooserDialog(
         _('Select one or more pdf files'), self,
         Gtk.FileChooserAction.OPEN,
         (Gtk.STOCK_CANCEL, Gtk.ResponseType.CANCEL, Gtk.STOCK_OPEN,
          Gtk.ResponseType.OK))
     dialog.set_default_response(Gtk.ResponseType.OK)
     dialog.set_select_multiple(True)
     dialog.set_current_folder(os.getenv('HOME'))
     filter = Gtk.FileFilter()
     filter.set_name(_('Pdf files'))
     filter.add_mime_type('application/pdf')
     filter.add_pattern('*.pdf')
     dialog.add_filter(filter)
     preview = Gtk.Image()
     response = dialog.run()
     if response == Gtk.ResponseType.OK:
         filenames = dialog.get_filenames()
         if len(filenames) > 0:
             for i, filename in enumerate(filenames):
                 model.insert(position + i + 1, [filename])
     dialog.destroy()
    def get_menu(self):
        """Create and populate the menu."""
        menu = Gtk.Menu()

        self.pomodoro_start = Gtk.MenuItem.new_with_label(_('Start'))
        self.pomodoro_start.connect('activate', self.on_pomodoro_start)
        self.pomodoro_start.show()
        menu.append(self.pomodoro_start)

        separator1 = Gtk.SeparatorMenuItem()
        separator1.show()
        menu.append(separator1)
        #
        menu_preferences = Gtk.MenuItem.new_with_label(_('Preferences'))
        menu_preferences.connect('activate', self.on_preferences_item)
        menu_preferences.show()
        menu.append(menu_preferences)

        menu_help = Gtk.MenuItem.new_with_label(_('Help'))
        menu_help.set_submenu(self.get_help_menu())
        menu_help.show()
        menu.append(menu_help)
        #
        separator2 = Gtk.SeparatorMenuItem()
        separator2.show()
        menu.append(separator2)
        #
        menu_exit = Gtk.MenuItem.new_with_label(_('Exit'))
        menu_exit.connect('activate', self.on_quit_item)
        menu_exit.show()
        menu.append(menu_exit)
        #
        menu.show()
        return(menu)
Exemplo n.º 7
0
def resize_pdf_pages(selected, window):
    files = tools.get_files(selected)
    if files:
        cd = ResizeDialog(_('Resize PDF'), window)
        if cd.run() == Gtk.ResponseType.ACCEPT:
            size = cd.get_resize()
            if cd.is_vertical():
                width = size[0]
                height = size[1]
            else:
                width = size[1]
                height = size[0]
            extension = cd.get_extension()
            cd.hide()
            if extension:
                dialog = Progreso(_('Resize PDF'), window, 1)
                diboo = doitinbackground.DoItInBackgroundResizePages(
                    files, extension, width, height)
                dialog.connect('i-want-stop', diboo.stop_it)
                diboo.connect('start', dialog.set_max_value)
                diboo.connect('todo', dialog.set_todo_label)
                diboo.connect('donef', dialog.set_fraction)
                diboo.connect('finished', dialog.end_progress)
                diboo.connect('interrupted', dialog.end_progress)
                diboo.start()
                dialog.run()
        cd.destroy()
 def on_pomodoro_start(self, widget):
     if not self.active:
         self.active = True
         self.pomodoro_start.set_label(_('Stop'))
         self.notification.update('Pomodoro-Indicator',
                                  _('Session starts'),
                                  os.path.join(comun.ICONDIR,
                                               'pomodoro-start-%s.svg' % (
                                                 self.theme)))
         self.notification.show()
         self.countdown_session()
         interval = int(self.session_length * 60 / TOTAL_FRAMES)
         self.start_working_process(interval, self.countdown_session)
     else:
         self.stop_working_process()
         self.active = False
         self.pomodoros = 0
         self.frame = 0
         self.pomodoro_start.set_label(_('Start'))
         icon = os.path.join(comun.ICONDIR,
                             'pomodoro-start-%s.svg' % (self.theme))
         self.indicator.set_icon(icon)
         self.notification.update('Pomodoro-Indicator',
                                  _('Session stop'),
                                  icon)
         self.notification.show()
Exemplo n.º 9
0
    def remove_item(self, widget):

        model, tree_iter = self.selection.get_selected()
        if tree_iter is None:
            return
        if model[tree_iter][0] != 'folder':
            shared.pmanager.remove_phrase(model[tree_iter][1])
            model.remove(tree_iter)
        else:
            remove_folder = True
            if shared.config['warn_folder_delete']:
                dialog = Gtk.MessageDialog(self, 0, Gtk.MessageType.WARNING,
                                           Gtk.ButtonsType.OK_CANCEL,
                                           _('Delete folder'))
                dialog.format_secondary_text(
                    _('This will also delete the phrases in this folder.'))
                response = dialog.run()
                if response == Gtk.ResponseType.CANCEL:
                    remove_folder = False
                dialog.destroy()
            if remove_folder:
                iter_child = model.iter_children(tree_iter)
                for child in range(model.iter_n_children(tree_iter)):
                    shared.pmanager.remove_phrase(model[iter_child][1])
                    iter_child = model.iter_next(iter_child)
                model.remove(tree_iter)
Exemplo n.º 10
0
 def __init__(self, service):
     #
     Gtk.Dialog.__init__(
         self,
         'uText | '+_('set filename for %s' % (service)),
         None,
         Gtk.DialogFlags.MODAL | Gtk.DialogFlags.DESTROY_WITH_PARENT,
         (Gtk.STOCK_CANCEL, Gtk.ResponseType.REJECT,
          Gtk.STOCK_OK, Gtk.ResponseType.ACCEPT))
     self.set_position(Gtk.WindowPosition.CENTER_ALWAYS)
     # self.set_size_request(400, 230)
     self.connect('close', self.close_application)
     self.set_icon_from_file(comun.ICON)
     vbox0 = Gtk.VBox(spacing=5)
     vbox0.set_border_width(5)
     self.get_content_area().add(vbox0)
     frame1 = Gtk.Frame()
     vbox0.pack_start(frame1, False, True, 1)
     table1 = Gtk.Table(2, 2, False)
     frame1.add(table1)
     label0 = Gtk.Label(_('Set filename for %s' % (service))+':')
     label0.set_alignment(0, 0.5)
     table1.attach(label0, 0, 2, 0, 1, xpadding=5, ypadding=5)
     label1 = Gtk.Label(_('Filename')+':')
     label1.set_alignment(0, 0.5)
     table1.attach(label1, 0, 1, 1, 2, xpadding=5, ypadding=5)
     self.filename = Gtk.Entry()
     table1.attach(self.filename, 1, 2, 1, 2, xpadding=5, ypadding=5)
     self.show_all()
    def on_session_end(self, widget):
        self.active = True
        # One more pomodoro session has finished
        self.pomodoros += 1
        self.frame = TOTAL_FRAMES
        if self.pomodoros == self.max_pomodoros and self.max_pomodoros != 1:
            interval = int(self.long_break_length * 60 / TOTAL_FRAMES)
            message = _('Session {0} ends - long break starts'.format(self.pomodoros))
            # Add different sound file for a long break start
            sound_file = self.long_break_sound_file
        else:
            interval = int(self.break_length * 60 / TOTAL_FRAMES)
            message = _('Session {0} ends - break starts'.format(self.pomodoros))
            # Add different sound file for a long break start
            sound_file = self.session_sound_file
        # Set type of break's icons like an inversion of selected team
        icon = os.path.join(comun.ICONDIR,
                            'pomodoro-indicator-%s-%02d.svg' % (
                                 self.break_theme, self.frame))
        self.notification.update('Pomodoro-Indicator', message, icon)
        self.notification.show()
        # Add different sound file for a long break start
        if self.play_sounds:
            self.play(sound_file)
        self.indicator.set_icon(icon)
        # Stop trigger - what will been stopped: break or session
        self.isBreak = True

        self.countdown_break()
        self.start_working_process(interval, self.countdown_break)
Exemplo n.º 12
0
    def on_button_about_clicked(self, widget):
        ad = Gtk.AboutDialog()
        ad.set_name(comun.APPNAME)
        ad.set_version(comun.VERSION)
        ad.set_copyright('''
Copyrignt (c) 2010 - 2016
Lorenzo Carbonell Cerezo
''')
        ad.set_comments(_('A graphical interface for\nClamAV'))
        ad.set_license('''
This program is free software: you can redistribute it and/or modify it under
the terms of the GNU General Public License as published by the Free Software
Foundation, either version 3 of the License, or (at your option) any later
version.

This program is distributed in the hope that it will be useful, but 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/>.
''')
        ad.set_logo(GdkPixbuf.Pixbuf.new_from_file(comun.ICON))
        ad.set_icon(GdkPixbuf.Pixbuf.new_from_file(comun.ICON))
        ad.set_website('http://www.atareao.es')
        ad.set_website_label('http://www.atareao.es')
        ad.set_authors([
            'Lorenzo Carbonell <*****@*****.**>'])
        ad.set_documenters([
            'Lorenzo Carbonell <*****@*****.**>'])
        ad.set_program_name(_('Antiviral'))
        ad.run()
        ad.hide()
        ad.destroy()
Exemplo n.º 13
0
def combine_pdf_pages(selected, window):
    files = tools.get_files(selected)
    if files:
        cd = CombineDialog(_('Combine PDF pages'), window)
        if cd.run() == Gtk.ResponseType.ACCEPT:
            size = cd.get_size()
            if cd.is_vertical():
                width = size[0]
                height = size[1]
            else:
                width = size[1]
                height = size[0]
            filas = cd.get_rows()
            columnas = cd.get_columns()
            byrows = cd.is_sort_by_rows()
            margen = cd.get_margin()
            extension = cd.get_extension()
            cd.hide()
            if extension:
                dialog = Progreso(_('Combine PDF pages'), window, 1)
                diboo = doitinbackground.DoItInBackgroundCombine(
                    files, extension, filas, columnas, width, height,
                    margen, byrows)
                dialog.connect('i-want-stop', diboo.stop_it)
                diboo.connect('start', dialog.set_max_value)
                diboo.connect('todo', dialog.set_todo_label)
                diboo.connect('donef', dialog.set_fraction)
                diboo.connect('finished', dialog.end_progress)
                diboo.connect('interrupted', dialog.end_progress)
                diboo.start()
                dialog.run()
        cd.destroy()
Exemplo n.º 14
0
 def get_help_menu(self):
     help_menu = Gtk.Menu()
     #
     add2menu(help_menu, text=_("Web..."), conector_event="activate", conector_action=self.on_menu_project_clicked)
     add2menu(
         help_menu,
         text=_("Get help online..."),
         conector_event="activate",
         conector_action=self.on_menu_help_online_clicked,
     )
     add2menu(
         help_menu,
         text=_("Translate this application..."),
         conector_event="activate",
         conector_action=self.on_menu_translations_clicked,
     )
     add2menu(
         help_menu, text=_("Report a bug..."), conector_event="activate", conector_action=self.on_menu_bugs_clicked
     )
     add2menu(help_menu)
     add2menu(help_menu, text=_("About"), conector_event="activate", conector_action=self.on_about_activate)
     #
     help_menu.show()
     #
     return help_menu
Exemplo n.º 15
0
    def set_touch_enabled(self, enabled):
        """Enable or disable the touchpads and update the indicator status
			and menu items.
			:param enabled: If True enable the touchpads."""
        if enabled and not self.touchpad.are_all_touchpad_enabled():
            if self.touchpad.enable_all_touchpads():
                if self.show_notifications:
                    self.show_notification('enabled')
                self.change_state_item.set_label(_('Disable Touchpad'))
                if self.indicator.get_status(
                ) != appindicator.IndicatorStatus.PASSIVE:
                    self.indicator.set_status(
                        appindicator.IndicatorStatus.ACTIVE)
                configuration = Configuration()
                configuration.set('touchpad_enabled',
                                  self.touchpad.are_all_touchpad_enabled())
                configuration.save()
        elif not enabled and self.touchpad.are_all_touchpad_enabled():
            if self.touchpad.disable_all_touchpads():
                if self.show_notifications:
                    self.show_notification('disabled')
                self.change_state_item.set_label(_('Enable Touchpad'))
                if self.indicator.get_status(
                ) != appindicator.IndicatorStatus.PASSIVE:
                    self.indicator.set_status(
                        appindicator.IndicatorStatus.ATTENTION)
                configuration = Configuration()
                configuration.set('touchpad_enabled',
                                  self.touchpad.are_all_touchpad_enabled())
                configuration.save()
Exemplo n.º 16
0
 def rotate_some_pages(self, selected):
     files = tools.get_files(selected)
     if files:
         file0 = files[0]
         filename, filext = os.path.splitext(file0)
         file_out = filename + '_rotated.pdf'
         last_page = cairoapi.get_num_of_pages(file0)
         spd = SelectPagesRotateDialog(_('Rotate some pages'), last_page,
                                       file_out)
         if spd.run() == Gtk.ResponseType.ACCEPT:
             ranges = tools.get_ranges(spd.entry1.get_text())
             if spd.rbutton1.get_active():
                 degrees = 270
             elif spd.rbutton2.get_active():
                 degrees = 90
             else:
                 degrees = 180
             spd.destroy()
             if len(ranges) > 0:
                 dialog = Progreso(_('Rotate some pages in pdf'), None, 1)
                 diboo = DoitInBackgroundOnlyOne(
                     pdfapi.rotate_ranges_in_pdf, file0, file_out,
                     degrees, ranges)
                 diboo.connect('done', dialog.increase)
                 diboo.start()
                 dialog.run()
         else:
             spd.destroy()
Exemplo n.º 17
0
 def create_pdf_from_images(self, selected):
     files = tools.get_files(selected)
     if files:
         file_in = files[0]
         filename, filext = os.path.splitext(file_in)
         file_out = filename + '_from_images.pdf'
         cpfi = CreatePDFFromImagesDialog(
             _('Create pdf from images'), files, file_out)
         if cpfi.run() == Gtk.ResponseType.ACCEPT:
             cpfi.hide()
             files = cpfi.get_png_files()
             if cpfi.is_vertical():
                 width, height = cpfi.get_size()
             else:
                 height, width = cpfi.get_size()
             margin = cpfi.get_margin()
             file_out = cpfi.get_file_out()
             cpfi.destroy()
             if file_out:
                 dialog = Progreso(_('Convert pdfs to png'), None, 1)
                 diboo = DoitInBackgroundOnlyOne(
                     tools.create_from_images, file_out, files, width,
                     height, margin)
                 diboo.connect('done', dialog.increase)
                 diboo.start()
                 dialog.run()
         cpfi.destroy()
Exemplo n.º 18
0
	def on_entry11_key_release_event(self,widget,event):
		actual_key = widget.get_text()
		key=event.keyval
		# numeros / letras mayusculas / letras minusculas
		if ((key>47) and (key<58)) or ((key > 64) and (key < 91)) or ((key > 96) and (key < 123)):
			if Gdk.keyval_is_upper(event.keyval):
				keyval=Gdk.keyval_name(Gdk.keyval_to_lower(event.keyval))
			else:
				keyval=Gdk.keyval_name(event.keyval)
			self.entry11.set_text(keyval)
			key=''
			if self.ctrl.get_active() == True:
				key+='<Primary>'
			if self.alt.get_active() == True:
				key+='<Alt>'
			key += self.entry11.get_text()
			desktop_environment = get_desktop_environment()
			if desktop_environment == 'gnome':			
				if key in get_shortcuts() and key!=self.key:
					dialog = Gtk.MessageDialog(	parent = self,
											flags = Gtk.DialogFlags.MODAL | Gtk.DialogFlags.DESTROY_WITH_PARENT,
											type = Gtk.MessageType.ERROR,
											buttons = Gtk.ButtonsType.OK_CANCEL,
											message_format = _('This shortcut <Control> + <Alt> + ')+keyval+_(' is assigned'))
					msg = _('This shortcut <Control> + <Alt> + ')+keyval+_(' is assigned')
					dialog.set_property('title', 'Error')
					dialog.set_property('text', msg)
					dialog.run()
					dialog.destroy()
					self.entry11.set_text(actual_key)
				else:
					self.entry11.set_text(keyval)
					self.key = keyval
Exemplo n.º 19
0
 def resize_pdf_pages(self, selected):
     files = tools.get_files(selected)
     if files:
         file_in = files[0]
         filename, filext = os.path.splitext(file_in)
         file_out = filename + '_resized' + filext
         cd = ResizeDialog(_('Resize pages'), file_out)
         if cd.run() == Gtk.ResponseType.ACCEPT:
             size = cd.get_size()
             if cd.is_vertical():
                 width = size[0]
                 height = size[1]
             else:
                 width = size[1]
                 height = size[0]
             file_out = cd.get_file_out()
             cd.destroy()
             if file_out:
                 dialog = Progreso(_('Convert pdfs to png'), None, 1)
                 diboo = DoitInBackgroundOnlyOne(
                     pdfapi.resize, file_in, file_out, width, height)
                 diboo.connect('done', dialog.increase)
                 diboo.start()
                 dialog.run()
         cd.destroy()
Exemplo n.º 20
0
    def init_ui(self):
        BasicDialog.init_ui(self)

        label = Gtk.Label(_('Pages') + ':')
        label.set_tooltip_text(_('Type page number and/or page\nranges\
 separated by commas\ncounting from start of the\ndocument ej. 1,4,6-9'))
        label.set_alignment(0, .5)
        self.grid.attach(label, 0, 0, 1, 1)

        self.entry1 = Gtk.Entry()
        self.entry1.set_tooltip_text(_('Type page number and/or page\nranges\
 separated by commas\ncounting from start of the\ndocument ej. 1,4,6-9'))
        self.grid.attach(self.entry1, 1, 0, 1, 1)

        if self.afile is not None:
            label = Gtk.Label(_('Output file') + ':')
            label.set_tooltip_text(_('Select the output file'))
            label.set_alignment(0, .5)
            self.grid.attach(label, 0, 1, 1, 1)

            self.output_file = Gtk.Button.new_with_label(self.afile)
            self.output_file.connect('clicked',
                                     self.on_button_output_file_clicked,
                                     self.main_window)
            self.grid.attach(self.output_file, 1, 1, 1, 1)
        self.show_all()
Exemplo n.º 21
0
    def init_ui(self):
        BasicDialog.init_ui(self)

        label1 = Gtk.Label(_('Password') + ':')
        label1.set_alignment(0, .5)
        self.grid.attach(label1, 0, 0, 1, 1)

        self.entry = Gtk.Entry()
        self.entry.set_tooltip_text(_('Set password'))
        self.grid.attach(self.entry, 1, 0, 1, 1)

        self.image = Gtk.Image()
        if comun.is_package():
            self.image = Gtk.Image.new_from_icon_name(
                'pdf-tools-password-hide', Gtk.IconSize.BUTTON)
        else:
            self.image = Gtk.Image.new_from_file(
                os.path.join(comun.ICONDIR, 'pdf-tools-password-hide.svg'))
        self.entry.set_visibility(False)
        button_visibility = Gtk.Button()
        button_visibility.add(self.image)
        button_visibility.connect('clicked', self.on_button_visibility_clicked)
        self.grid.attach(button_visibility, 2, 0, 1, 1)

        self.show_all()
Exemplo n.º 22
0
 def on_button_add_clicked(self, widget):
     selection = self.treeview.get_selection()
     if selection.count_selected_rows() > 0:
         model, iter = selection.get_selected()
         treepath = model.get_path(iter)
         position = int(str(treepath))
     else:
         model = self.treeview.get_model()
         position = len(model)
     dialog = Gtk.FileChooserDialog(_('Select one or more pdf files'),
                                    self,
                                    Gtk.FileChooserAction.OPEN,
                                    (Gtk.STOCK_CANCEL,
                                     Gtk.ResponseType.CANCEL,
                                     Gtk.STOCK_OPEN,
                                     Gtk.ResponseType.OK))
     dialog.set_default_response(Gtk.ResponseType.OK)
     dialog.set_select_multiple(True)
     dialog.set_current_folder(os.getenv('HOME'))
     filter = Gtk.FileFilter()
     filter.set_name(_('Pdf files'))
     filter.add_mime_type('application/pdf')
     filter.add_pattern('*.pdf')
     dialog.add_filter(filter)
     preview = Gtk.Image()
     response = dialog.run()
     if response == Gtk.ResponseType.OK:
         filenames = dialog.get_filenames()
         if len(filenames) > 0:
             for i, filename in enumerate(filenames):
                 model.insert(position+i+1, [filename])
     dialog.destroy()
Exemplo n.º 23
0
    def get_menu(self):
        """Create and populate the menu."""
        menu = Gtk.Menu()

        self.change_state_item = add2menu(
            menu,
            text=_('Disable Touchpad'),
            conector_event='activate',
            conector_action=self.on_change_state_item)
        add2menu(
            menu,
            text=_('Hide icon'),
            conector_event='activate',
            conector_action=self.on_hide_item)
        add2menu(
            menu,
            text=_('Preferences'),
            conector_event='activate',
            conector_action=self.on_preferences_item)

        add2menu(menu)

        menu_help = add2menu(menu, text=_('Help'))
        menu_help.set_submenu(self.get_help_menu())
        add2menu(menu)
        add2menu(
            menu,
            text=_('Exit'),
            conector_event='activate',
            conector_action=self.on_quit_item)

        menu.show()
        return(menu)
 def on_scroll(self, widget, steps, direcction):
     if direcction == Gdk.ScrollDirection.UP:
         backlight = self.backlightManager.get_backlight()
         backlight += 10 * steps
         self.set_backlight(backlight)
         if self.show_value:
             self.indicator.set_label(str(int(self.backlight)), '')
         else:
             self.indicator.set_label('', '')
         if self.show_notifications:
             self.notification.update('Backlight-Indicator',
                                      _('Backlight') + ': %s' % backlight,
                                      comun.STATUS_ICON[self.theme][0])
             self.notification.show()
     elif direcction == Gdk.ScrollDirection.DOWN:
         backlight = self.backlightManager.get_backlight()
         backlight -= 10 * steps
         self.set_backlight(backlight)
         if self.show_value:
             self.indicator.set_label(str(int(self.backlight)), '')
         else:
             self.indicator.set_label('', '')
         if self.show_notifications:
             self.notification.update('Backlight-Indicator',
                                      _('Backlight') + ': %s' % backlight,
                                      comun.STATUS_ICON[self.theme][0])
             self.notification.show()
Exemplo n.º 25
0
	def __init__(self, parent=None):
		Gtk.Dialog.__init__(self,_('Remove pages from document'),parent,Gtk.DialogFlags.MODAL | Gtk.DialogFlags.DESTROY_WITH_PARENT,(Gtk.STOCK_OK, Gtk.ResponseType.ACCEPT,Gtk.STOCK_CANCEL,Gtk.ResponseType.CANCEL))
		self.set_position(Gtk.WindowPosition.CENTER_ALWAYS)
		self.set_size_request(300, 120)
		self.set_resizable(False)
		self.set_icon_from_file(comun.ICON)
		self.connect('destroy', self.close_application)
		#
		vbox0 = Gtk.VBox(spacing = 5)
		vbox0.set_border_width(5)
		self.get_content_area().add(vbox0)
		#
		notebook = Gtk.Notebook()
		vbox0.add(notebook)
		#
		frame1 = Gtk.Frame()
		notebook.append_page(frame1,tab_label = Gtk.Label(_('Select Pages')))
		#
		table1 = Gtk.Table(rows = 3, columns = 3, homogeneous = False)
		table1.set_border_width(5)
		table1.set_col_spacings(5)
		table1.set_row_spacings(5)
		frame1.add(table1)
		#
		label1 = Gtk.Label(_('Pages')+':')
		label1.set_tooltip_text(_('Type page number and/or page\nranges separated by commas\ncounting from start of the\ndocument ej. 1,4,6-9'))
		label1.set_alignment(0,.5)
		table1.attach(label1,0,1,0,1, xoptions = Gtk.AttachOptions.FILL, yoptions = Gtk.AttachOptions.SHRINK)
		#
		self.entry1 = Gtk.Entry()
		self.entry1.set_tooltip_text(_('Type page number and/or page\nranges separated by commas\ncounting from start of the\ndocument ej. 1,4,6-9'))
		table1.attach(self.entry1,1,3,0,1, xoptions = Gtk.AttachOptions.EXPAND, yoptions = Gtk.AttachOptions.SHRINK)
		#
		self.show_all()
Exemplo n.º 26
0
    def __set_ui(self):
        handycolumn = Handy.Column()
        handycolumn.set_maximum_width(700)
        handycolumn.set_margin_top(24)
        self.add(handycolumn)

        box = Gtk.Box.new(Gtk.Orientation.VERTICAL, 5)
        handycolumn.add(box)

        label = Gtk.Label(_('Google calendar permissions'))
        label.set_name('special')
        label.set_alignment(0, 0.5)
        box.add(label)

        listbox0 = Gtk.ListBox()
        box.add(listbox0)

        self.switch1 = Gtk.Switch()
        self.switch1.connect('button-press-event',self.on_switch1_changed)
        self.switch1.connect('activate',self.on_switch1_changed)

        self.switch1.set_valign(Gtk.Align.CENTER)

        listbox0.add(SettingRow(_('Permissions for Google Calendar'),
                        _('Enable read and write permissions for Google Calendar.'),
                        self.switch1))

        self.switch1.set_active(os.path.exists(comun.TOKEN_FILE))
Exemplo n.º 27
0
 def rotate_or_flip(self, selected):
     files = tools.get_files(selected)
     if len(files) > 0:
         file0 = files[0]
         fd = FlipDialog(_('Rotate files'), file0)
         degrees = 0
         if fd.run() == Gtk.ResponseType.ACCEPT:
             fd.hide()
             if fd.rbutton1.get_active():
                 rotate = ROTATE_000
             elif fd.rbutton2.get_active():
                 rotate = ROTATE_090
             elif fd.rbutton3.get_active():
                 rotate = ROTATE_180
             elif fd.rbutton4.get_active():
                 rotate = ROTATE_270
             flip_vertical = fd.switch1.get_active()
             flip_horizontal = fd.switch2.get_active()
             overwrite = fd.rbutton0.get_active()
             dialog = Progreso(_('Rotate pdf files'), None, len(files))
             diboo = DoitInBackgroundWithArgs(
                 cairoapi.rotate_and_flip_pages, files, rotate,
                 flip_vertical, flip_horizontal, overwrite)
             diboo.connect('done', dialog.increase)
             diboo.connect('todo', dialog.set_todo_label)
             dialog.connect('i-want-stop', diboo.stop_it)
             diboo.start()
             dialog.run()
         fd.destroy()
Exemplo n.º 28
0
 def combine_pdf_pages(self, selected):
     files = tools.get_files(selected)
     if files:
         file_in = files[0]
         filename, filext = os.path.splitext(file_in)
         file_out = filename + '_combined' + filext
         cd = CombineDialog(_('Combine pages'), file_out)
         if cd.run() == Gtk.ResponseType.ACCEPT:
             size = cd.get_size()
             if cd.is_vertical():
                 width = size[0]
                 height = size[1]
             else:
                 width = size[1]
                 height = size[0]
             filas = cd.get_rows()
             columnas = cd.get_columns()
             byrows = cd.is_sort_by_rows()
             margen = cd.get_margin()
             file_out = cd.get_file_out()
             cd.destroy()
             if file_out:
                 dialog = Progreso(_('Convert pdfs to png'), None, 1)
                 diboo = DoitInBackgroundOnlyOne(
                     pdfapi.combine, file_in, file_out, filas, columnas,
                     width, height, margen, byrows)
                 diboo.connect('done', dialog.increase)
                 diboo.start()
                 dialog.run()
    def __init__(self,googlecalendar = None):
        self.googlecalendar = googlecalendar
        Gtk.Dialog.__init__(self)
        self.set_title(comun.APPNAME + ' | '+_('Preferences'))
        self.set_modal(True)
        self.set_destroy_with_parent(True)
        self.set_size_request(1000, 400)
        self.set_resizable(False)
        self.set_icon_from_file(comun.ICON)

        mainbox = Gtk.Box.new(Gtk.Orientation.HORIZONTAL, 5)
        mainbox.set_border_width(5)
        self.get_content_area().add(mainbox)

        # Login, calendar, options

        scrolledwindow = Gtk.ScrolledWindow()
        scrolledwindow.set_policy(Gtk.PolicyType.AUTOMATIC,
                                  Gtk.PolicyType.AUTOMATIC)
        scrolledwindow.set_shadow_type(Gtk.ShadowType.ETCHED_OUT)
        scrolledwindow.set_visible(True)
        scrolledwindow.set_size_request(200, 400)
        scrolledwindow.set_property('min-content-width', 200)
        mainbox.pack_start(scrolledwindow, False, False, 0)

        sidebar = Gtk.ListBox()
        sidebar.connect('row-activated', self.on_row_activated)
        scrolledwindow.add(sidebar)

        option1 = SideWidget(_('Google Calendar'),
                             'preferences-system-privacy-symbolic')
        sidebar.add(option1)
        option2 = SideWidget(_('Calendar options'),
                             'appointment-symbolic')
        sidebar.add(option2)
        option3 = SideWidget(_('General options'),
                             'preferences-system-symbolic')
        sidebar.add(option3)

        self.stack = Gtk.Stack()
        sw = Gtk.ScrolledWindow(child=self.stack)
        mainbox.pack_start(sw, True, True, 0)

        option1.set_stack('loginOption')

        self.loginOption = LoginOption()
        self.stack.add_named(self.loginOption, 'loginOption')

        option2.set_stack('calendarOption')
        self.calendarOption = CalendarOption(self.googlecalendar)
        self.stack.add_named(self.calendarOption, 'calendarOption')

        option3.set_stack('otherOption')
        self.otherOption = OtherOption()
        self.stack.add_named(self.otherOption, 'otherOption')

        self.center()

        self.show_all()
Exemplo n.º 30
0
 def change_status(self, widget=None):
     self.monitor_clipboard = not self.monitor_clipboard
     if self.monitor_clipboard:
         self.menu_capture.set_label(_('Not capture'))
         self.indicator.set_icon(comun.STATUS_ICON[self.theme])
     else:
         self.menu_capture.set_label(_('Capture'))
         self.indicator.set_icon(comun.DISABLED_ICON[self.theme])
Exemplo n.º 31
0
    def load_information(self):
        try:
            self.raspberryClient.connect()
        except Exception as exception:
            print(exception)
            return
        meminfo = self.raspberryClient.read_file('/proc/meminfo')

        memtotal = re.findall(r'MemTotal:\s*(\d*)', meminfo)
        memtotal = float(memtotal[0]) / 1024.0 if memtotal else 0.0
        self.ram_total.set_text(str(int(memtotal)) + ' ' + _('MB'))

        memfree = re.findall(r'MemFree:\s*(\d*)', meminfo)
        memfree = float(memfree[0]) / 1024.0 if memfree else 0.0
        self.ram_free.set_text(str(int(memfree)) + ' ' + _('MB'))
        self.ram_free_progress.set_value(memfree / memtotal)

        buffers = re.findall(r'Buffers:\s*(\d*)', meminfo)
        buffers = float(buffers[0]) / 1024.0 if buffers else 0.0

        cached = re.findall(r'Cached:\s*(\d*)', meminfo)
        cached = float(cached[0]) / 1024.0 if cached else 0.0

        memused = memtotal - (memfree + buffers + cached)
        self.ram_used.set_text(str(int(memused)) + ' ' + _('MB'))
        self.ram_used_progress.set_value(memused / memtotal)

        memshared = re.findall(r'Shmem:\s*(\d*)', meminfo)
        memshared = float(memshared[0]) / 1024.0 if memshared else 0.0
        self.ram_shared.set_text(str(int(memshared)) + ' ' + _('MB'))
        self.ram_shared_progress.set_value(memshared / memtotal)

        buffcache = buffers + cached
        self.ram_buffcache.set_text(str(int(buffcache)) + ' ' + _('MB'))
        self.ram_buffcache_progress.set_value(buffcache / memtotal)

        memavailable = re.findall(r'MemAvailable:\s*(\d*)', meminfo)
        memavailable = float(memavailable[0]) / 1024.0 if memavailable else 0.0
        self.ram_available.set_text(str(int(memavailable)) + ' ' + _('MB'))
        self.ram_available_progress.set_value(memavailable / memtotal)

        swaptotal = re.findall(r'SwapTotal:\s*(\d*)', meminfo)
        swaptotal = float(swaptotal[0]) / 1024.0 if swaptotal else 0.0
        self.swap_total.set_text(str(int(swaptotal)) + ' ' + _('MB'))

        swapfree = re.findall(r'SwapFree:\s*(\d*)', meminfo)
        swapfree = float(swapfree[0]) / 1024.0 if swapfree else 0.0
        self.swap_free.set_text(str(int(swapfree)) + ' ' + _('MB'))
        self.swap_free_progress.set_value(swapfree / swaptotal)

        swapcached = re.findall(r'SwapCached:\s*(\d*)', meminfo)
        swapcached = float(swapcached[0]) / 1024.0 if swapcached else 0.0
        self.swap_cached.set_text(str(int(swapcached)) + ' ' + _('MB'))
        self.swap_cached_progress.set_value(swapcached / swaptotal)

        swapused = swaptotal - (swapfree + swapcached)
        self.swap_used.set_text(str(int(swapused)) + ' ' + _('MB'))
        self.swap_used_progress.set_value(swapused / swaptotal)
Exemplo n.º 32
0
	def show_notification(self, kind):
		"""Show a notification of type kind"""

		if kind == 'enabled':
			self.notification.update('Touchpad-Indicator',
						_('Touchpad Enabled'), self.active_icon)
		elif kind == 'disabled':
			self.notification.update('Touchpad-Indicator',
						_('Touchpad Disabled'), self.attention_icon)
		self.notification.show()
Exemplo n.º 33
0
 def get_margin(self):
     tree_iter = self.entry3.get_active_iter()
     if tree_iter is not None:
         model = self.entry3.get_model()
         vertical = model[tree_iter][0]
         if vertical == _('small margin'):
             return 1
         elif vertical == _('big margin'):
             return 2
     return 0
Exemplo n.º 34
0
 def get_margin(self):
     tree_iter = self.entry3.get_active_iter()
     if tree_iter is not None:
         model = self.entry3.get_model()
         vertical = model[tree_iter][0]
         if vertical == _('small margin'):
             return 1
         elif vertical == _('big margin'):
             return 2
     return 0
Exemplo n.º 35
0
	def get_help_menu(self):
		help_menu =Gtk.Menu()
		#
		add2menu(help_menu,text = _('Homepage...'),conector_event = 'activate',conector_action = lambda x: webbrowser.open('https://launchpad.net/touchpad-indicator'))
		add2menu(help_menu,text = _('Get help online...'),conector_event = 'activate',conector_action = lambda x: webbrowser.open('https://answers.launchpad.net/touchpad-indicator'))
		add2menu(help_menu,text = _('Translate this application...'),conector_event = 'activate',conector_action = lambda x: webbrowser.open('https://translations.launchpad.net/touchpad-indicator'))
		add2menu(help_menu,text = _('Report a bug...'),conector_event = 'activate',conector_action = lambda x: webbrowser.open('https://bugs.launchpad.net/touchpad-indicator'))
		add2menu(help_menu)
		web = add2menu(help_menu,text = _('Homepage'),conector_event = 'activate',conector_action = lambda x: webbrowser.open('http://www.atareao.es/tag/cryptfolder-indicator'))
		twitter = add2menu(help_menu,text = _('Follow us in Twitter'),conector_event = 'activate',conector_action = lambda x: webbrowser.open('https://twitter.com/atareao'))
		googleplus = add2menu(help_menu,text = _('Follow us in Google+'),conector_event = 'activate',conector_action = lambda x: webbrowser.open('https://plus.google.com/118214486317320563625/posts'))
		facebook = add2menu(help_menu,text = _('Follow us in Facebook'),conector_event = 'activate',conector_action = lambda x: webbrowser.open('http://www.facebook.com/elatareao'))
		add2menu(help_menu)
		#		
		web.set_image(Gtk.Image.new_from_file(os.path.join(comun.SOCIALDIR,'web.svg')))
		web.set_always_show_image(True)
		twitter.set_image(Gtk.Image.new_from_file(os.path.join(comun.SOCIALDIR,'twitter.svg')))
		twitter.set_always_show_image(True)
		googleplus.set_image(Gtk.Image.new_from_file(os.path.join(comun.SOCIALDIR,'googleplus.svg')))
		googleplus.set_always_show_image(True)
		facebook.set_image(Gtk.Image.new_from_file(os.path.join(comun.SOCIALDIR,'facebook.svg')))
		facebook.set_always_show_image(True)
		
		add2menu(help_menu)
		add2menu(help_menu,text = _('About'),conector_event = 'activate',conector_action = self.on_about_item)
		#
		help_menu.show()
		return(help_menu)
Exemplo n.º 36
0
    def set_phrase_dir(self, widget):

        shared.cmanager.edit('phrases_dir', widget.get_filename())
        shared.cmanager.write_config()
        dialog = Gtk.MessageDialog(self, 0, Gtk.MessageType.WARNING,
                                   Gtk.ButtonsType.OK, _('Restart app'))
        dialog.format_secondary_text(
            _('Phrase editing and creation will not \
function corectly until application is restarted.'))
        dialog.run()
        dialog.destroy()
Exemplo n.º 37
0
    def init_adicional_popover(self):
        BaseDialogWithApply.init_adicional_popover(self)
        self.popover_listbox.add(generate_title_row(_('Watermark'), True))

        self.zoom_entry, row = generate_spinbutton_row(_('Zoom'), None)
        self.zoom_entry.set_adjustment(Gtk.Adjustment(1, 100, 1000, 1, 100, 0))
        self.popover_listbox.add(row)
        self.file_entry, row = generate_button_row(
            _('Watermark'), self.on_button_watermark_clicked)
        self.file_entry.set_label(_('Select watermark file'))
        self.popover_listbox.add(row)
Exemplo n.º 38
0
    def __init__(self, args):
        Gtk.Window.__init__(self)
        if len(args) < 2:
            Gtk.main_quit()
        self.set_title(_('Install package'))
        self.connect('delete-event', Gtk.main_quit)
        self.set_position(Gtk.WindowPosition.CENTER_ALWAYS)
        self.set_icon_from_file(comun.ICON)
        self.set_size_request(600, 50)
        grid = Gtk.Grid()
        grid.set_margin_bottom(MARGIN)
        grid.set_margin_left(MARGIN)
        grid.set_margin_right(MARGIN)
        grid.set_margin_top(MARGIN)

        grid.set_column_spacing(MARGIN)
        grid.set_row_spacing(MARGIN)
        self.add(grid)

        if args[1].find('apt://') > -1:
            self.apps = args[1].split('apt://')[1].split(',')
        elif args[1].find('apt:') > -1:
            self.apps = args[1].split('apt:')[1].split(',')
        else:
            Gtk.main_quit()
        if len(self.apps) > 0:
            label = Gtk.Label(
                _('Install this packages: %s?') % (joiner(self.apps)))
        label.set_alignment(0, 0.5)
        grid.attach(label, 0, 0, 2, 1)
        expander = Gtk.Expander()
        expander.connect('notify::expanded', self.on_expanded)
        grid.attach(expander, 0, 1, 2, 2)

        alignment = Gtk.Alignment()
        # alignment.set_padding(1, 0, 2, 2)
        alignment.props.xscale = 1
        scrolledwindow = Gtk.ScrolledWindow()
        scrolledwindow.set_hexpand(True)
        scrolledwindow.set_vexpand(True)
        self.terminal = SmartTerminal(self)
        scrolledwindow.add(self.terminal)
        alignment.add(scrolledwindow)
        expander.add(alignment)

        button_ok = Gtk.Button(_('Ok'))
        grid.attach(button_ok, 0, 3, 1, 1)
        button_ok.connect('clicked', self.on_button_ok_clicked)
        button_cancel = Gtk.Button(_('Cancel'))
        button_cancel.connect('clicked', self.on_button_cancel_clicked)
        grid.attach(button_cancel, 1, 3, 1, 1)

        self.is_added = False
        self.show_all()
Exemplo n.º 39
0
    def show_notification(self, kind):
        """Show a notification of type kind"""

        if kind == 'enabled':
            self.notification.update('Touchpad-Indicator',
                                     _('Touchpad Enabled'), self.active_icon)
        elif kind == 'disabled':
            self.notification.update('Touchpad-Indicator',
                                     _('Touchpad Disabled'),
                                     self.attention_icon)
        self.notification.show()
 def update_menu(self, check=False):
     #
     now = datetime.datetime.now()
     normal_icon = os.path.join(comun.ICONDIR,
                                '%s-%s-normal.svg' % (now.day, self.theme))
     starred_icon = os.path.join(
         comun.ICONDIR, '%s-%s-starred.svg' % (now.day, self.theme))
     #
     self.indicator.set_icon(normal_icon)
     self.indicator.set_attention_icon(starred_icon)
     #
     events2 = self.googlecalendar.getNextTenEvents(self.visible_calendars)
     self.menu_today.set_label(now.strftime('%A, %d %B %Y'))
     if check and len(self.events) > 0:
         for event in events2:
             if not is_event_in_events(event, self.events):
                 msg = _('New event:') + '\n'
                 if 'summary' in event.keys():
                     msg += event.get_start_date_string(
                     ) + ' - ' + event['summary']
                 else:
                     msg += event.get_start_date_string()
                 self.notification.update('Calendar Indicator', msg,
                                          comun.ICON_NEW_EVENT)
                 self.notification.show()
         for event in self.events:
             if not is_event_in_events(event, events2):
                 msg = _('Event finished:') + '\n'
                 if 'summary' in event.keys():
                     msg += event.get_start_date_string(
                     ) + ' - ' + event['summary']
                 else:
                     msg += event.get_start_date_string()
                 self.notification.update('Calendar Indicator', msg,
                                          comun.ICON_FINISHED_EVENT)
                 self.notification.show()
     self.events = events2
     for i, event in enumerate(self.events):
         self.menu_events[i].set_event(event)
         self.menu_events[i].set_visible(True)
     for i in range(len(self.events), 10):
         self.menu_events[i].set_visible(False)
     now = datetime.datetime.now()
     if len(self.events) > 0:
         com = self.events[0].get_start_date()
         if now.year == com.year and now.month == com.month and now.day == com.day and now.hour == com.hour:
             self.indicator.set_status(
                 appindicator.IndicatorStatus.ATTENTION)
         else:
             self.indicator.set_status(appindicator.IndicatorStatus.ACTIVE)
     else:
         self.indicator.set_status(appindicator.IndicatorStatus.ACTIVE)
     while Gtk.events_pending():
         Gtk.main_iteration()
Exemplo n.º 41
0
 def __init__(self, parent=None):
     Gtk.Dialog.__init__(
         self, _('Remove pages from document'), parent,
         Gtk.DialogFlags.MODAL | Gtk.DialogFlags.DESTROY_WITH_PARENT,
         (Gtk.STOCK_OK, Gtk.ResponseType.ACCEPT, Gtk.STOCK_CANCEL,
          Gtk.ResponseType.CANCEL))
     self.set_position(Gtk.WindowPosition.CENTER_ALWAYS)
     self.set_size_request(300, 120)
     self.set_resizable(False)
     self.set_icon_from_file(comun.ICON)
     self.connect('destroy', self.close_application)
     #
     vbox0 = Gtk.VBox(spacing=5)
     vbox0.set_border_width(5)
     self.get_content_area().add(vbox0)
     #
     notebook = Gtk.Notebook()
     vbox0.add(notebook)
     #
     frame1 = Gtk.Frame()
     notebook.append_page(frame1, tab_label=Gtk.Label(_('Select Pages')))
     #
     table1 = Gtk.Table(rows=3, columns=3, homogeneous=False)
     table1.set_border_width(5)
     table1.set_col_spacings(5)
     table1.set_row_spacings(5)
     frame1.add(table1)
     #
     label1 = Gtk.Label(_('Pages') + ':')
     label1.set_tooltip_text(
         _('Type page number and/or page\nranges separated by commas\ncounting from start of the\ndocument ej. 1,4,6-9'
           ))
     label1.set_alignment(0, .5)
     table1.attach(label1,
                   0,
                   1,
                   0,
                   1,
                   xoptions=Gtk.AttachOptions.FILL,
                   yoptions=Gtk.AttachOptions.SHRINK)
     #
     self.entry1 = Gtk.Entry()
     self.entry1.set_tooltip_text(
         _('Type page number and/or page\nranges separated by commas\ncounting from start of the\ndocument ej. 1,4,6-9'
           ))
     table1.attach(self.entry1,
                   1,
                   3,
                   0,
                   1,
                   xoptions=Gtk.AttachOptions.EXPAND,
                   yoptions=Gtk.AttachOptions.SHRINK)
     #
     self.show_all()
Exemplo n.º 42
0
 def __init__(self, parent):
     #
     Gtk.Dialog.__init__(self,
                         'Indicator-USB | '+_('Preferences'),
                         parent,
                         Gtk.DialogFlags.MODAL |
                         Gtk.DialogFlags.DESTROY_WITH_PARENT,
                         (Gtk.STOCK_CANCEL, Gtk.ResponseType.REJECT,
                             Gtk.STOCK_OK, Gtk.ResponseType.ACCEPT))
     self.set_position(Gtk.WindowPosition.CENTER_ALWAYS)
     self.set_icon_from_file(comun.ICON)
     #
     vbox0 = Gtk.VBox(spacing=5)
     vbox0.set_border_width(5)
     self.get_content_area().add(vbox0)
     # ***************************************************************
     notebook = Gtk.Notebook.new()
     vbox0.add(notebook)
     # ***************************************************************
     vbox11 = Gtk.VBox(spacing=5)
     vbox11.set_border_width(5)
     notebook.append_page(vbox11, Gtk.Label.new(_('General')))
     frame11 = Gtk.Frame()
     vbox11.pack_start(frame11, False, True, 1)
     table11 = Gtk.Table(2, 3, False)
     frame11.add(table11)
     # ***************************************************************
     label11 = Gtk.Label(_('Show disks')+':')
     label11.set_alignment(0, 0.5)
     table11.attach(label11, 0, 1, 0, 1, xpadding=5, ypadding=5)
     self.autostart = Gtk.Switch()
     table11.attach(self.autostart, 1, 2, 0, 1,
                    xpadding=5,
                    ypadding=5,
                    xoptions=Gtk.AttachOptions.SHRINK)
     label12 = Gtk.Label(_('Show disks')+':')
     label12.set_alignment(0, 0.5)
     table11.attach(label12, 0, 1, 1, 2, xpadding=5, ypadding=5)
     self.show_disks = Gtk.Switch()
     table11.attach(self.show_disks, 1, 2, 1, 2,
                    xpadding=5,
                    ypadding=5,
                    xoptions=Gtk.AttachOptions.SHRINK)
     label14 = Gtk.Label(_('Show network folders')+':')
     label14.set_alignment(0, 0.5)
     table11.attach(label14, 0, 1, 2, 3, xpadding=5, ypadding=5)
     self.show_net = Gtk.Switch()
     table11.attach(self.show_net, 1, 2, 2, 3,
                    xpadding=5,
                    ypadding=5,
                    xoptions=Gtk.AttachOptions.SHRINK)
     self.load_preferences()
     self.show_all()
Exemplo n.º 43
0
 def end(self, anobject, ok, *args):
     self.is_installing = False
     self.button_cancel.set_label(_('Exit'))
     if ok is True:
         kind = Gtk.MessageType.INFO
         message = _('Installation completed!')
     else:
         kind = Gtk.MessageType.ERROR
         message = _('Installation NOT completed!')
     dialog = Gtk.MessageDialog(self, 0, kind, Gtk.ButtonsType.OK, message)
     dialog.run()
     dialog.destroy()
Exemplo n.º 44
0
    def new_folder(self, menu_item):

        model, tree_iter = self.selection.get_selected()
        tree_iter = None
        name = _('New folder')
        name_count = 0
        while not self.name_unique(model, name):
            name_count += 1
            name = _('New folder') + ' ' + str(name_count)
        self.treestore.append(tree_iter,
                              ['folder', name, '', self.color_normal])
        self.sort_treeview()
Exemplo n.º 45
0
 def on_button_cancel_clicked(self, button):
     if self.is_installing:
         dialog = Gtk.MessageDialog()
         dialog.set_markup(_('Do you want to stop the installation?'))
         dialog.set_property('message-type', Gtk.MessageType.INFO)
         dialog.add_button(_('Ok'), Gtk.ResponseType.OK)
         dialog.add_button(_('Cancel'), Gtk.ResponseType.CANCEL)
         ans = dialog.run()
         if dialog.run() == Gtk.ResponseType.OK:
             GLib.idle_add(dialog.hide)
             self.terminal.stop()
         GLib.idle_add(dialog.destroy)
Exemplo n.º 46
0
def main(args):
    if os.geteuid() != 0:
        dialog = Gtk.MessageDialog()
        dialog.set_markup(_('You must be root to run this tool'))
        dialog.set_property('message-type', Gtk.MessageType.ERROR)
        dialog.add_button(_('Ok'), Gtk.ResponseType.OK)
        dialog.run()
        return
    installer = Installer(args)
    installer.run()
    installer.destroy()
    exit(0)
Exemplo n.º 47
0
def main():
	DBusGMainLoop(set_as_default=True)
	bus = dbus.SessionBus()
	request = bus.request_name('es.atareao.TouchpadIndicator',dbus.bus.NAME_FLAG_DO_NOT_QUEUE)
	if request == dbus.bus.REQUEST_NAME_REPLY_EXISTS or len(sys.argv)>1:
		print('Another instance of Touchpad Indicator is working')
		usage_msg = _('usage: %prog [options]')
		parser = OptionParser(usage=usage_msg, add_help_option=False)
		parser.add_option('-h', '--help',
				action='store_true',
				dest='help',
				default=False,
				help=_('show this help and exit.'))
		parser.add_option('-c', '--change-state',
				action='store_true',
				dest='change',
				default=False,
				help=_('change the touchpad state. If indicator is not running launch it.'))
		parser.add_option('-s', '--show-icon',
				action='store_true',
				dest='show',
				default=False,
				help=_('show the icon if indicator is hidden. Default action. If indicator is not running launch it.'))
		parser.add_option('-l', '--list-devices',
				action='store_true',
				dest='list',
				default=False,
				help=_('list devices'))
		(options, args) = parser.parse_args()
		if options.help:
			parser.print_help()
		elif options.list:
			device_list.list()
		elif options.change:
			change_status()
		else: # show by default
			make_visible()
		exit(0)
	else: # first!!!
		####################################################################
		print('#####################################################')
		print(machine_information.get_information())
		print('Touchpad-Indicator version: %s'%comun.VERSION)
		print('#####################################################')
		####################################################################
		Notify.init("touchpad-indicator")
		object = bus.get_object('es.atareao.TouchpadIndicator',\
									'/es/atareao/TouchpadIndicator')
		my_service = dbus.Interface(object,'es.atareao.TouchpadIndicator')
		tpi=TouchpadIndicator()
		Gtk.main()
	exit(0)
Exemplo n.º 48
0
 def __init__(self, parent):
     Gtk.Dialog.__init__(self,
                         '2Gif | '+_('Donate'),
                         parent,
                         Gtk.DialogFlags.MODAL |
                         Gtk.DialogFlags.DESTROY_WITH_PARENT,
                         (Gtk.STOCK_OK, Gtk.ResponseType.ACCEPT))
     self.set_position(Gtk.WindowPosition.CENTER_ALWAYS)
     self.set_size_request(300, 300)
     self.connect('close', self.close_ok)
     self.set_icon_from_file(comun.ICON)
     #
     hbox = Gtk.Box.new(Gtk.Orientation.HORIZONTAL, 5)
     hbox.set_border_width(5)
     self.get_content_area().add(hbox)
     vbox = Gtk.Box.new(Gtk.Orientation.VERTICAL, 5)
     vbox.set_border_width(5)
     hbox.pack_start(vbox, True, True, 5)
     frame = Gtk.Frame()
     vbox.pack_start(frame, True, True, 5)
     internal_box = Gtk.Box.new(Gtk.Orientation.VERTICAL, 5)
     frame.add(internal_box)
     label = Gtk.Label()
     label.set_markup('<b>%s</b>' % ('Help to support 2Gif'))
     internal_box.pack_start(label, False, False, 5)
     internal_box.pack_start(
         Gtk.Image.new_from_pixbuf(
             GdkPixbuf.Pixbuf.new_from_file_at_size(comun.ICON, 150, -1)),
         False, False, 5)
     internal_box.pack_start(Gtk.Label(_('Via')+':'), False, False, 5)
     logo1 = Gtk.EventBox()
     logo1.add(Gtk.Image.new_from_pixbuf(
          GdkPixbuf.Pixbuf.new_from_file_at_size(
             comun.PAYPAL_LOGO, 150, -1,)))
     logo1.connect('button_press_event',
                   self.on_support_clicked)
     internal_box.pack_start(logo1, False, False, 5)
     logo2 = Gtk.EventBox()
     logo2.add(Gtk.Image.new_from_pixbuf(
          GdkPixbuf.Pixbuf.new_from_file_at_size(
             comun.BITCOIN_LOGO, 150, -1,)))
     logo2.connect('button_press_event',
                   self.on_support_clicked)
     internal_box.pack_start(logo2, False, False, 5)
     logo3 = Gtk.EventBox()
     logo3.add(Gtk.Image.new_from_pixbuf(
          GdkPixbuf.Pixbuf.new_from_file_at_size(
             comun.FLATTR_LOGO, 150, -1,)))
     logo3.connect('button_press_event',
                   self.on_support_clicked)
     internal_box.pack_start(logo3, False, False, 5)
     self.show_all()
Exemplo n.º 49
0
 def __init__(self):
     #
     Gtk.Dialog.__init__(self, 'YouTube Indicator | ' + _('Preferences'),
                               None,
                               Gtk.DialogFlags.MODAL |
                               Gtk.DialogFlags.DESTROY_WITH_PARENT,
                               (Gtk.STOCK_CANCEL,
                                Gtk.ResponseType.REJECT,
                                Gtk.STOCK_OK,
                                Gtk.ResponseType.ACCEPT))
     self.set_position(Gtk.WindowPosition.CENTER_ALWAYS)
     # self.set_size_request(400, 230)
     self.connect('close', self.close_application)
     self.set_icon_from_file(comun.ICON)
     #
     vbox0 = Gtk.VBox(spacing=5)
     vbox0.set_border_width(5)
     self.get_content_area().add(vbox0)
     frame1 = Gtk.Frame()
     vbox0.pack_start(frame1, False, True, 1)
     table1 = Gtk.Table(4, 2, False)
     frame1.add(table1)
     label1 = Gtk.Label(_('Capture clipboard'))
     label1.set_alignment(0, 0.5)
     table1.attach(label1, 0, 1, 0, 1, xpadding=5, ypadding=5)
     self.switch1 = Gtk.Switch()
     table1.attach(self.switch1, 1, 2, 0, 1, xpadding=5, ypadding=5,
                   xoptions=Gtk.AttachOptions.SHRINK)
     label2 = Gtk.Label(_('Autostart'))
     label2.set_alignment(0, 0.5)
     table1.attach(label2, 0, 1, 1, 2, xpadding=5, ypadding=5)
     self.switch2 = Gtk.Switch()
     table1.attach(self.switch2, 1, 2, 1, 2, xpadding=5, ypadding=5,
                   xoptions=Gtk.AttachOptions.SHRINK)
     label3 = Gtk.Label(_('Icon light'))
     label3.set_alignment(0, 0.5)
     table1.attach(label3, 0, 1, 2, 3, xpadding=5, ypadding=5)
     self.switch3 = Gtk.Switch()
     table1.attach(self.switch3, 1, 2, 2, 3, xpadding=5, ypadding=5,
                   xoptions=Gtk.AttachOptions.SHRINK)
     self.downloaddir = Gtk.Entry()
     self.downloaddir.set_sensitive(False)
     table1.attach(self.downloaddir, 0, 1, 3, 4, xpadding=5, ypadding=5,
                   xoptions=Gtk.AttachOptions.SHRINK)
     dirbutton = Gtk.Button(_('Select folder'))
     dirbutton.connect('clicked', self.on_dirbutton_clicked)
     table1.attach(dirbutton, 1, 2, 3, 4, xpadding=5, ypadding=5,
                   xoptions=Gtk.AttachOptions.SHRINK)
     #
     self.load_preferences()
     #
     self.show_all()
Exemplo n.º 50
0
	def get_help_menu(self):
		help_menu =Gtk.Menu()
		#		
		add2menu(help_menu,text = _('Application Web...'),conector_event = 'activate',conector_action = lambda x: webbrowser.open('https://launchpad.net/my-weather-indicator'))
		add2menu(help_menu,text = _('Get help online...'),conector_event = 'activate',conector_action = lambda x: webbrowser.open('https://answers.launchpad.net/my-weather-indicator'))
		add2menu(help_menu,text = _('Translate this application...'),conector_event = 'activate',conector_action = lambda x: webbrowser.open('https://translations.launchpad.net/my-weather-indicator'))
		add2menu(help_menu,text = _('Report a bug...'),conector_event = 'activate',conector_action = lambda x: webbrowser.open('https://bugs.launchpad.net/my-weather-indicator'))
		add2menu(help_menu)
		add2menu(help_menu,text = _('About'),conector_event = 'activate',conector_action = self.on_about_activate)
		#
		help_menu.show()
		#
		return help_menu
Exemplo n.º 51
0
 def read_preferences(self):
     configuration = Configuration()
     self.first_time = configuration.get('first-time')
     self.version = configuration.get('version')
     self.theme = configuration.get('theme')
     self.monitor_clipboard = configuration.get('monitor-clipboard')
     self.downloaddir = configuration.get('download-dir')
     if self.monitor_clipboard:
         self.menu_capture.set_label(_('Not capture'))
         self.indicator.set_icon(comun.STATUS_ICON[self.theme])
     else:
         self.menu_capture.set_label(_('Capture'))
         self.indicator.set_icon(comun.DISABLED_ICON[self.theme])
Exemplo n.º 52
0
	def on_button_release(self,widget,event):
		fdia = Gtk.FontChooserDialog(_('Select font name'))
		fdia.set_preview_text(_('One day I saw a cow wearing a military uniform'))
		fdia.set_font('%s %s'%(self.font,self.size))
		if fdia.run() == Gtk.ResponseType.OK:
			fontname = fdia.get_font()
			fdia.destroy()
			if fontname:
				values = fontname.split(' ')
				font = ' '.join(values[:-1])
				size = int(values[-1])
				self.set_font_and_size(font,size)
		fdia.destroy()
		self.emit('clicked')
 def start_automatically(self):
     if self.wid != 0:
         GLib.source_remove(self.wid)
         self.wid = 0
     self.working_menu_item.set_label(_('Stop'))
     self.indicator.set_icon(comun.STATUS_ICON[self.theme][0])
     if self.show_notifications:
         self.notification.update('Backlight-Indicator',
                                  _('Session starts'),
                                  comun.STATUS_ICON[self.theme][0])
         self.notification.show()
     self.do_the_work()
     self.wid = GLib.timeout_add_seconds(self.sample_time * 60,
                                         self.do_the_work)
	def menu_evolution_response(self,widget):	
		self.menu_offon(False)
		temperatures = []
		humidities = []
		cloudinesses = []
		for data in self.weatherservice1.get_hourly_weather():
			value = time.mktime(data['datetime'].timetuple()) * 1000 + data['datetime'].microsecond / 1000
			temperatures.append([value,float(data['temperature'])])
			humidities.append([value,float(data['avehumidity'])])
			cloudinesses.append([value,float(data['cloudiness'])])
		title = _('Forecast for next hours')
		subtitle = _('Weather service')+': OpenWeatherMap'
		graph = Graph(title,subtitle,temperature=temperatures,humidity=humidities,cloudiness=cloudinesses)
		self.menu_offon(True)