예제 #1
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()
예제 #2
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()
예제 #3
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()
예제 #4
0
 def __init__(self, title, parent, max_value, label=None):
     self.max_value = max_value
     self.text_label = label
     self.stop = False
     self.value = 0.0
     BasicDialog.__init__(self, title, parent)
     self.set_size_request(330, 30)
예제 #5
0
    def init_ui(self):
        BasicDialog.init_ui(self)

        options = Gtk.ListStore(str)
        for extension in MIMETYPES_IMAGE.keys():
            if extension != _('ALL'):
                options.append([extension])
        label = Gtk.Label(_('Convert to') + ':')
        self.grid.attach(label, 0, 0, 1, 1)
        self.convert_to = Gtk.ComboBox.new_with_model_and_entry(options)
        self.convert_to.set_entry_text_column(0)
        self.convert_to.set_active(0)
        self.grid.attach(self.convert_to, 1, 0, 1, 1)
예제 #6
0
    def init_ui(self):
        BasicDialog.init_ui(self)

        self.label = Gtk.Label()
        self.grid.attach(self.label, 0, 0, 1, 1)
        if self.text_label is not None:
            self.label.set_label(self.text_label)

        self.progressbar = Gtk.ProgressBar()
        self.progressbar.set_size_request(300, 0)
        self.grid.attach(self.progressbar, 0, 1, 1, 1)

        button_stop = Gtk.Button()
        button_stop.set_size_request(40, 40)
        button_stop.set_image(
            Gtk.Image.new_from_stock(Gtk.STOCK_STOP, Gtk.IconSize.BUTTON))
        button_stop.connect('clicked', self.on_button_stop_clicked)
        self.grid.attach(button_stop, 1, 0, 1, 3)
예제 #7
0
    def init_ui(self):
        BasicDialog.init_ui(self)

        self.scrolledwindow1 = Gtk.ScrolledWindow()
        self.scrolledwindow1.set_size_request(630, 630)
        self.grid.attach(self.scrolledwindow1, 0, 0, 1, 1)

        self.viewport1 = MiniView()
        self.scrolledwindow1.add(self.viewport1)

        self.pages = {}

        self.scale = 100

        self.init_headerbar()

        if self.filename is not None:
            uri = "file://" + self.filename
            self.document = Poppler.Document.new_from_file(uri, None)
            self.hb.set_subtitle(os.path.basename(self.filename))
            self.set_page(0)

        self.show_all()
예제 #8
0
    def init_ui(self):
        BasicDialog.init_ui(self)

        label1 = Gtk.Label(_('Output file') + ':')
        label1.set_tooltip_text(_('Select the output file'))
        label1.set_alignment(0, .5)
        self.grid.attach(label1, 0, 0, 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, 0, 3, 1)
        hbox = Gtk.HBox()
        self.grid.attach(hbox, 0, 1, 4, 2)

        scrolledwindow = Gtk.ScrolledWindow()
        scrolledwindow.set_policy(Gtk.PolicyType.AUTOMATIC,
                                  Gtk.PolicyType.AUTOMATIC)
        scrolledwindow.set_shadow_type(Gtk.ShadowType.ETCHED_OUT)
        scrolledwindow.set_size_request(700, 500)
        hbox.pack_start(scrolledwindow, True, True, 0)

        liststore = Gtk.ListStore(GdkPixbuf.Pixbuf, str, str)
        self.iconview = Gtk.IconView.new()
        self.iconview.set_model(liststore)
        self.iconview.set_pixbuf_column(0)
        self.iconview.set_text_column(1)
        self.iconview.set_item_width(-1)
        self.iconview.set_reorderable(True)

        scrolledwindow.add(self.iconview)

        vbox2 = Gtk.VBox(spacing=0)
        vbox2.set_border_width(5)
        hbox.pack_start(vbox2, False, False, 0)

        button1 = Gtk.Button()
        button1.set_size_request(40, 40)
        button1.set_tooltip_text(_('Up'))
        button1.set_image(
            Gtk.Image.new_from_stock(Gtk.STOCK_GO_UP, Gtk.IconSize.BUTTON))
        button1.connect('clicked', self.on_button_up_clicked)
        vbox2.pack_start(button1, False, False, 0)

        button2 = Gtk.Button()
        button2.set_size_request(40, 40)
        button2.set_tooltip_text(_('Down'))
        button2.set_image(
            Gtk.Image.new_from_stock(Gtk.STOCK_GO_DOWN, Gtk.IconSize.BUTTON))
        button2.connect('clicked', self.on_button_down_clicked)
        vbox2.pack_start(button2, False, False, 0)

        button3 = Gtk.Button()
        button3.set_size_request(40, 40)
        button3.set_tooltip_text(_('Add'))
        button3.set_image(
            Gtk.Image.new_from_stock(Gtk.STOCK_ADD, Gtk.IconSize.BUTTON))
        button3.connect('clicked', self.on_button_add_clicked)
        vbox2.pack_start(button3, False, False, 0)

        button4 = Gtk.Button()
        button4.set_size_request(40, 40)
        button4.set_tooltip_text(_('Remove'))
        button4.set_image(
            Gtk.Image.new_from_stock(Gtk.STOCK_REMOVE, Gtk.IconSize.BUTTON))
        button4.connect('clicked', self.on_button_remove_clicked)
        vbox2.pack_start(button4, False, False, 0)

        if self.files:
            position = 0
            model = self.iconview.get_model()
            for filename in self.files:
                pixbuf = tools.get_pixbuf_from_pdf(filename, 200)
                if pixbuf is not None:
                    position += 1
                    if self.iconview.get_item_width() < pixbuf.get_width():
                        self.iconview.set_item_width(pixbuf.get_width())
                    model.insert(
                        position,
                        [pixbuf, os.path.basename(filename), filename])

        self.show_all()
예제 #9
0
 def __init__(self, title, files, afile, window):
     self.files = files
     self.afile = afile
     self.main_window = window
     BasicDialog.__init__(self, title, window)
예제 #10
0
    def init_ui(self):
        BasicDialog.init_ui(self)

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

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

        label3 = Gtk.Label(_('Pages in Page') + ':')
        label3.set_alignment(0, .5)
        self.grid.attach(label3, 0, 2, 1, 1)

        label4 = Gtk.Label(_('by'))
        label4.set_alignment(.5, .5)
        self.grid.attach(label4, 2, 2, 1, 1)

        label5 = Gtk.Label(_('Sort') + ':')
        label5.set_alignment(0, .5)
        self.grid.attach(label5, 0, 4, 1, 1)

        label6 = Gtk.Label(_('Set the margin') + ':')
        label6.set_alignment(0, .5)
        self.grid.attach(label6, 0, 5, 1, 1)

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

        liststore = Gtk.ListStore(str, float, float)
        liststore.append([_('A0'), 2383.9, 3370.4])
        liststore.append([_('A1'), 1683.8, 2383.9])
        liststore.append([_('A2'), 1190.6, 1683.8])
        liststore.append([_('A3'), 841.9, 1190.6])
        liststore.append([_('A4'), 595.3, 841.9])
        liststore.append([_('A5'), 419.5, 595.3])
        liststore.append([_('A6'), 297.6, 419.5])
        liststore.append([_('A7'), 209.8, 297.6])
        liststore.append([_('A8'), 147.4, 209.8])
        liststore.append([_('A9'), 104.9, 147.4])
        liststore.append([_('A10'), 73.7, 104.9])
        liststore.append([_('B0'), 2834.6, 73.7])
        liststore.append([_('B1'), 2004.1, 2834.6])
        liststore.append([_('B2'), 1417.3, 2004.1])
        liststore.append([_('B3'), 1000.6, 1417.3])
        liststore.append([_('B4'), 708.7, 1000.6])
        liststore.append([_('B5'), 498.9, 708.7])
        liststore.append([_('B6'), 354.3, 498.9])
        liststore.append([_('B7'), 249.4, 354.3])
        liststore.append([_('B8'), 175.7, 249.4])
        liststore.append([_('B9'), 124.7, 175.7])
        liststore.append([_('B10'), 87.9, 124.7])
        liststore.append([_('Letter (8 1/2x11)'), 612.0, 792.0])
        liststore.append([_('Note (8 1/2x11)'), 612.0, 792.0])
        liststore.append([_('Legal (8 1/2x14)'), 612.0, 1008.0])
        liststore.append([_('Executive (8 1/4x10 1/2)'), 522.0, 756.0])
        liststore.append([_('Halfetter (5 1/2x8 1/2)'), 396.0, 612.0])
        liststore.append([_('Halfexecutive (5 1/4x7 1/4)'), 378.0, 522.0])
        liststore.append([_('11x17 (11x17)'), 792.0, 1224.0])
        liststore.append([_('Statement (5 1/2x8 1/2)'), 396.0, 612.0])
        liststore.append([_('Folio (8 1/2x13)'), 612.0, 936.0])
        liststore.append([_('10x14 (10x14)'), 720.0, 1008.0])
        liststore.append([_('Ledger (17x11)'), 1224.0, 792.0])
        liststore.append([_('Tabloid (11x17)'), 792.0, 1224.0])
        self.entry1 = Gtk.ComboBox.new_with_model(model=liststore)
        self.entry1.set_tooltip_text(_('Select the size of the output file'))
        renderer_text = Gtk.CellRendererText()
        self.entry1.pack_start(renderer_text, True)
        self.entry1.add_attribute(renderer_text, "text", 0)
        self.entry1.set_active(0)
        self.grid.attach(self.entry1, 1, 0, 4, 1)

        liststore = Gtk.ListStore(str)
        liststore.append([_('Vertical')])
        liststore.append([_('Horizontal')])
        self.entry2 = Gtk.ComboBox.new_with_model(model=liststore)
        self.entry2.set_tooltip_text(_('Select the orientation of the page'))
        renderer_text = Gtk.CellRendererText()
        self.entry2.pack_start(renderer_text, True)
        self.entry2.add_attribute(renderer_text, "text", 0)
        self.entry2.set_active(0)
        self.grid.attach(self.entry2, 1, 1, 4, 1)

        self.entry3 = Gtk.SpinButton()
        self.entry3.set_tooltip_text(_('Select how many pages in a page'))
        self.entry3.set_adjustment(Gtk.Adjustment(1, 1, 100, 1, 10, 10))
        self.entry3.set_value(1)
        self.grid.attach(self.entry3, 1, 2, 1, 1)

        self.entry4 = Gtk.SpinButton()
        self.entry4.set_tooltip_text(_('rows by columns'))
        self.entry4.set_adjustment(Gtk.Adjustment(1, 1, 100, 1, 10, 10))
        self.entry4.set_value(2)
        self.grid.attach(self.entry4, 3, 2, 1, 1)

        liststore = Gtk.ListStore(str)
        liststore.append([_('By rows')])
        liststore.append([_('By columns')])
        self.entry5 = Gtk.ComboBox.new_with_model(model=liststore)
        self.entry5.set_tooltip_text(_('Select the combination sort'))
        renderer_text = Gtk.CellRendererText()
        self.entry5.pack_start(renderer_text, True)
        self.entry5.add_attribute(renderer_text, "text", 0)
        self.entry5.set_active(0)
        self.grid.attach(self.entry5, 1, 4, 4, 1)

        self.entry6 = Gtk.SpinButton()
        self.entry6.set_tooltip_text(_('The margin to the page in mm'))
        self.entry6.set_adjustment(Gtk.Adjustment(0, 0, 100, 1, 10, 10))
        self.entry6.set_value(0)
        self.grid.attach(self.entry6, 1, 5, 1, 1)

        self.extension = Gtk.Entry()
        self.extension.set_tooltip_text(_(
            'Append to file to create output filename'))
        self.extension.set_text(_('_combined'))
        self.grid.attach(self.extension, 1, 6, 4, 1)
예제 #11
0
 def __init__(self, title, window):
     BasicDialog.__init__(self, title, window)
     self.set_size_request(350, 150)
예제 #12
0
 def __init__(self, window=None):
     BasicDialog.__init__(self, _('Convert to'), window)
     self.set_size_request(300, 80)
예제 #13
0
 def __init__(self, title='', filename=None, window=None):
     self.filename = filename
     self.no_page = None
     BasicDialog.__init__(self, title, window)
     self.set_default_size(600, 600)
예제 #14
0
    def init_ui(self):
        BasicDialog.init_ui(self)

        label1 = Gtk.Label(_('Paper size') + ':')
        label1.set_alignment(0, 0.5)
        self.grid.attach(label1, 0, 0, 1, 1)

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

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

        liststore = Gtk.ListStore(str, float, float)
        liststore.append([_('A0'), 2383.9, 3370.4])
        liststore.append([_('A1'), 1683.8, 2383.9])
        liststore.append([_('A2'), 1190.6, 1683.8])
        liststore.append([_('A3'), 841.9, 1190.6])
        liststore.append([_('A4'), 595.3, 841.9])
        liststore.append([_('A5'), 419.5, 595.3])
        liststore.append([_('A6'), 297.6, 419.5])
        liststore.append([_('A7'), 209.8, 297.6])
        liststore.append([_('A8'), 147.4, 209.8])
        liststore.append([_('A9'), 104.9, 147.4])
        liststore.append([_('A10'), 73.7, 104.9])
        liststore.append([_('B0'), 2834.6, 73.7])
        liststore.append([_('B1'), 2004.1, 2834.6])
        liststore.append([_('B2'), 1417.3, 2004.1])
        liststore.append([_('B3'), 1000.6, 1417.3])
        liststore.append([_('B4'), 708.7, 1000.6])
        liststore.append([_('B5'), 498.9, 708.7])
        liststore.append([_('B6'), 354.3, 498.9])
        liststore.append([_('B7'), 249.4, 354.3])
        liststore.append([_('B8'), 175.7, 249.4])
        liststore.append([_('B9'), 124.7, 175.7])
        liststore.append([_('B10'), 87.9, 124.7])
        liststore.append([_('Letter (8 1/2x11)'), 612.0, 792.0])
        liststore.append([_('Note (8 1/2x11)'), 612.0, 792.0])
        liststore.append([_('Legal (8 1/2x14)'), 612.0, 1008.0])
        liststore.append([_('Executive (8 1/4x10 1/2)'), 522.0, 756.0])
        liststore.append([_('Halfetter (5 1/2x8 1/2)'), 396.0, 612.0])
        liststore.append([_('Halfexecutive (5 1/4x7 1/4)'), 378.0, 522.0])
        liststore.append([_('11x17 (11x17)'), 792.0, 1224.0])
        liststore.append([_('Statement (5 1/2x8 1/2)'), 396.0, 612.0])
        liststore.append([_('Folio (8 1/2x13)'), 612.0, 936.0])
        liststore.append([_('10x14 (10x14)'), 720.0, 1008.0])
        liststore.append([_('Ledger (17x11)'), 1224.0, 792.0])
        liststore.append([_('Tabloid (11x17)'), 792.0, 1224.0])
        self.entry1 = Gtk.ComboBox.new_with_model(model=liststore)
        self.entry1.set_tooltip_text(_('Select the size of the output file'))
        renderer_text = Gtk.CellRendererText()
        self.entry1.pack_start(renderer_text, True)
        self.entry1.add_attribute(renderer_text, "text", 0)
        self.entry1.set_active(0)

        self.grid.attach(self.entry1, 1, 0, 1, 1)

        liststore = Gtk.ListStore(str)
        liststore.append([_('Vertical')])
        liststore.append([_('Horizontal')])
        self.entry2 = Gtk.ComboBox.new_with_model(model=liststore)
        self.entry2.set_tooltip_text(_('Select the orientation of the page'))
        renderer_text = Gtk.CellRendererText()
        self.entry2.pack_start(renderer_text, True)
        self.entry2.add_attribute(renderer_text, "text", 0)
        self.entry2.set_active(0)

        self.grid.attach(self.entry2, 1, 1, 1, 1)

        self.extension = Gtk.Entry()
        self.extension.set_tooltip_text(
            _('Append to file to create output filename'))
        self.extension.set_text(_('_resized'))

        self.grid.attach(self.extension, 1, 2, 1, 1)
        self.show_all()
예제 #15
0
 def __init__(self, title, files, afile, window):
     self.files = files
     self.afile = afile
     self.main_window = window
     BasicDialog.__init__(self, title, window)
     self.set_size_request(400, 600)
예제 #16
0
    def init_ui(self):
        BasicDialog.init_ui(self)
        label1 = Gtk.Label(_('Paper size') + ':')
        label1.set_tooltip_text(_('Select the size of the output file'))
        label1.set_alignment(0, .5)
        self.grid.attach(label1, 0, 0, 1, 1)

        label2 = Gtk.Label(_('Orientation') + ':')
        label2.set_tooltip_text(_('Select the orientation of the page'))
        label2.set_alignment(0, .5)
        self.grid.attach(label2, 0, 1, 1, 1)

        label3 = Gtk.Label(_('Margen') + ':')
        label3.set_tooltip_text(_('Select the size of the margin'))
        label3.set_alignment(0, .5)
        self.grid.attach(label3, 0, 2, 1, 1)

        label4 = Gtk.Label(_('Output file') + ':')
        label4.set_tooltip_text(_('Select the output file'))
        label4.set_alignment(0, .5)
        self.grid.attach(label4, 0, 3, 1, 1)

        liststore = Gtk.ListStore(str, float, float)
        liststore.append([_('A0'), 2383.9, 3370.4])
        liststore.append([_('A1'), 1683.8, 2383.9])
        liststore.append([_('A2'), 1190.6, 1683.8])
        liststore.append([_('A3'), 841.9, 1190.6])
        liststore.append([_('A4'), 595.3, 841.9])
        liststore.append([_('A5'), 419.5, 595.3])
        liststore.append([_('A6'), 297.6, 419.5])
        liststore.append([_('A7'), 209.8, 297.6])
        liststore.append([_('A8'), 147.4, 209.8])
        liststore.append([_('A9'), 104.9, 147.4])
        liststore.append([_('A10'), 73.7, 104.9])
        liststore.append([_('B0'), 2834.6, 73.7])
        liststore.append([_('B1'), 2004.1, 2834.6])
        liststore.append([_('B2'), 1417.3, 2004.1])
        liststore.append([_('B3'), 1000.6, 1417.3])
        liststore.append([_('B4'), 708.7, 1000.6])
        liststore.append([_('B5'), 498.9, 708.7])
        liststore.append([_('B6'), 354.3, 498.9])
        liststore.append([_('B7'), 249.4, 354.3])
        liststore.append([_('B8'), 175.7, 249.4])
        liststore.append([_('B9'), 124.7, 175.7])
        liststore.append([_('B10'), 87.9, 124.7])
        liststore.append([_('Letter (8 1/2x11)'), 612.0, 792.0])
        liststore.append([_('Note (8 1/2x11)'), 612.0, 792.0])
        liststore.append([_('Legal (8 1/2x14)'), 612.0, 1008.0])
        liststore.append([_('Executive (8 1/4x10 1/2)'), 522.0, 756.0])
        liststore.append([_('Halfetter (5 1/2x8 1/2)'), 396.0, 612.0])
        liststore.append([_('Halfexecutive (5 1/4x7 1/4)'), 378.0, 522.0])
        liststore.append([_('11x17 (11x17)'), 792.0, 1224.0])
        liststore.append([_('Statement (5 1/2x8 1/2)'), 396.0, 612.0])
        liststore.append([_('Folio (8 1/2x13)'), 612.0, 936.0])
        liststore.append([_('10x14 (10x14)'), 720.0, 1008.0])
        liststore.append([_('Ledger (17x11)'), 1224.0, 792.0])
        liststore.append([_('Tabloid (11x17)'), 792.0, 1224.0])
        self.entry1 = Gtk.ComboBox.new_with_model(model=liststore)
        renderer_text = Gtk.CellRendererText()
        self.entry1.pack_start(renderer_text, True)
        self.entry1.add_attribute(renderer_text, "text", 0)
        self.entry1.set_active(0)
        self.grid.attach(self.entry1, 1, 1, 1, 1)

        liststore = Gtk.ListStore(str)
        liststore.append([_('Vertical')])
        liststore.append([_('Horizontal')])
        self.entry2 = Gtk.ComboBox.new_with_model(model=liststore)
        renderer_text = Gtk.CellRendererText()
        self.entry2.pack_start(renderer_text, True)
        self.entry2.add_attribute(renderer_text, "text", 0)
        self.entry2.set_active(0)
        self.grid.attach(self.entry2, 1, 2, 1, 1)

        liststore = Gtk.ListStore(str)
        liststore.append([_('No margin')])
        liststore.append([_('small margin')])
        liststore.append([_('big margin')])
        self.entry3 = Gtk.ComboBox.new_with_model(model=liststore)
        renderer_text = Gtk.CellRendererText()
        self.entry3.pack_start(renderer_text, True)
        self.entry3.add_attribute(renderer_text, "text", 0)
        self.entry3.set_active(0)
        self.grid.attach(self.entry3, 1, 3, 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, 0, 4, 2, 1)

        hbox = Gtk.HBox()
        self.grid.attach(hbox, 0, 5, 2, 8)
        # vbox0.pack_start(hbox, True, True, 0)

        scrolledwindow = Gtk.ScrolledWindow()
        scrolledwindow.set_policy(
            Gtk.PolicyType.AUTOMATIC, Gtk.PolicyType.AUTOMATIC)
        scrolledwindow.set_shadow_type(Gtk.ShadowType.ETCHED_OUT)
        scrolledwindow.set_size_request(450, 300)
        hbox.pack_start(scrolledwindow, True, True, 0)

        liststore = Gtk.ListStore(GdkPixbuf.Pixbuf, str, str)
        self.iconview = Gtk.IconView.new()
        self.iconview.set_model(liststore)
        self.iconview.set_pixbuf_column(0)
        self.iconview.set_text_column(1)
        self.iconview.set_item_width(-1)
        self.iconview.set_reorderable(True)

        scrolledwindow.add(self.iconview)

        vbox2 = Gtk.VBox(spacing=0)
        vbox2.set_border_width(5)
        hbox.pack_start(vbox2, False, False, 0)

        self.button1 = Gtk.Button()
        self.button1.set_size_request(40, 40)
        self.button1.set_tooltip_text(_('Up'))
        self.button1.set_image(
            Gtk.Image.new_from_stock(Gtk.STOCK_GO_UP, Gtk.IconSize.BUTTON))
        self.button1.connect('clicked', self.on_button_up_clicked)
        vbox2.pack_start(self.button1, False, False, 0)

        self.button2 = Gtk.Button()
        self.button2.set_size_request(40, 40)
        self.button2.set_tooltip_text(_('Down'))
        self.button2.set_image(
            Gtk.Image.new_from_stock(Gtk.STOCK_GO_DOWN, Gtk.IconSize.BUTTON))
        self.button2.connect('clicked', self.on_button_down_clicked)
        vbox2.pack_start(self.button2, False, False, 0)

        self.button3 = Gtk.Button()
        self.button3.set_size_request(40, 40)
        self.button3.set_tooltip_text(_('Add'))
        self.button3.set_image(
            Gtk.Image.new_from_stock(Gtk.STOCK_ADD, Gtk.IconSize.BUTTON))
        self.button3.connect('clicked', self.on_button_add_clicked)
        vbox2.pack_start(self.button3, False, False, 0)

        self.button4 = Gtk.Button()
        self.button4.set_size_request(40, 40)
        self.button4.set_tooltip_text(_('Remove'))
        self.button4.set_image(
            Gtk.Image.new_from_stock(Gtk.STOCK_REMOVE, Gtk.IconSize.BUTTON))
        self.button4.connect('clicked', self.on_button_remove_clicked)
        vbox2.pack_start(self.button4, False, False, 0)

        if self.files:
            position = 0
            model = self.iconview.get_model()
            for filename in self.files:
                pixbuf = GdkPixbuf.Pixbuf.new_from_file_at_size(filename,
                                                                200, 200)
                if pixbuf is not None:
                    position += 1
                    if self.iconview.get_item_width() < pixbuf.get_width():
                        self.iconview.set_item_width(pixbuf.get_width())
                    model.insert(position,
                                 [pixbuf,
                                  os.path.basename(filename),
                                  filename])
        self.show_all()
예제 #17
0
 def __init__(self, title, window):
     BasicDialog.__init__(self, title, window)