Esempio n. 1
0
 def __init__(self):
     from scal3.ui_gtk.mywidgets.text_widgets import ReadOnlyTextView
     gtk.VBox.__init__(self)
     self.initVars()
     ####
     self.textview = ReadOnlyTextView()
     self.textview.set_wrap_mode(gtk.WrapMode.WORD)
     self.textview.set_justification(gtk.Justification.CENTER)
     self.textbuff = self.textview.get_buffer()
     ##
     self.expander = gtk.Expander()
     self.expander.connect('activate', self.expanderExpanded)
     if ui.pluginsTextInsideExpander:
         self.expander.add(self.textview)
         pack(self, self.expander)
         self.expander.set_expanded(ui.pluginsTextIsExpanded)
         self.textview.show()
     else:
         pack(self, self.textview)
Esempio n. 2
0
    def __init__(self, event, **kwargs):
        checkEventsReadOnly()
        gtk.Dialog.__init__(self, **kwargs)
        self.set_title(_("History") + ": " + event.summary)
        self.event = event
        self.objectCache = {}  # hash(str) -> data(dict)

        dialog_add_button(
            self,
            gtk.STOCK_CLOSE,
            _("_Close"),
            gtk.ResponseType.OK,
        )

        self.connect("response", self.onResponse)

        treev = gtk.TreeView()
        treev.set_headers_clickable(True)
        trees = gtk.ListStore(
            str,  # hashBefore (hidden)
            str,  # hashAfter (hidden)
            str,  # formatted date & time
            str,  # change msg (names or the number of changed params)
        )
        treev.set_model(trees)
        treev.connect("cursor-changed", self.treeviewCursorChanged)
        # treev.connect("button-press-event", self.treeviewCursorChanged)
        # FIXME: what is the signal for deselecting / unselecting a row?
        self.trees = trees
        self.treev = treev

        treevSwin = gtk.ScrolledWindow()
        treevSwin.add(treev)
        treevSwin.set_policy(
            gtk.PolicyType.AUTOMATIC,
            gtk.PolicyType.AUTOMATIC,
        )

        hpan = gtk.HPaned()
        hpan.add1(treevSwin)
        leftVbox = gtk.VBox()
        hpan.add2(leftVbox)
        hpan.set_position(600)
        pack(self.vbox, hpan, expand=True, fill=True)

        actionBox = gtk.VBox(spacing=5)
        pack(leftVbox, actionBox, padding=30)

        # revertButton = gtk.Button()
        # revertButton.set_label(_("Revert this vhange"))
        # revertButton.set_image(gtk.Image.new_from_stock(
        # 	gtk.STOCK_UNDO,
        # 	gtk.IconSize.BUTTON,
        # ))
        # revertButton.connect("clicked", self.revertClicked)
        # pack(actionBox, revertButton, padding=1)
        # self.revertButton = revertButton

        checkoutAfterButton = gtk.Button()
        checkoutAfterButton.set_label(_("Select revision after this change"))
        checkoutAfterButton.set_image(
            gtk.Image.new_from_stock(
                gtk.STOCK_UNDO,
                gtk.IconSize.BUTTON,
            ))
        checkoutAfterButton.connect("clicked", self.checkoutAfterClicked)
        pack(actionBox, checkoutAfterButton, padding=1)
        self.checkoutAfterButton = checkoutAfterButton

        checkoutBeforeButton = gtk.Button()
        checkoutBeforeButton.set_label(_("Select revision before this change"))
        checkoutBeforeButton.set_image(
            gtk.Image.new_from_stock(
                gtk.STOCK_UNDO,
                gtk.IconSize.BUTTON,
            ))
        checkoutBeforeButton.connect("clicked", self.checkoutBeforeClicked)
        pack(actionBox, checkoutBeforeButton, padding=1)
        self.checkoutBeforeButton = checkoutBeforeButton

        self.setButtonsSensitive(False)

        combo = gtk.ComboBoxText()
        for text in self.textViewTypes:
            combo.append_text(_(text))
        combo.set_active(1)
        combo.connect("changed", self.viewTypeComboChanged)
        self.viewTypeCombo = combo

        textTypeHbox = gtk.HBox()
        pack(textTypeHbox, gtk.Label(_("View type") + ": "))
        pack(textTypeHbox, self.viewTypeCombo)
        pack(leftVbox, textTypeHbox)

        self.textview = ReadOnlyTextView()
        self.textview.set_wrap_mode(gtk.WrapMode.NONE)
        self.textview.set_justification(gtk.Justification.LEFT)
        self.textbuff = self.textview.get_buffer()

        cmpTreev = gtk.TreeView()
        cmpTreev.set_headers_clickable(True)
        cmpTrees = gtk.ListStore(
            str,  # change symbol ("M", "+", "-", "")
            str,  # key
            str,  # old value
            str,  # new value
        )
        cmpTreev.set_model(cmpTrees)
        # cmpTreev.connect("cursor-changed", self.cmpTreeviewCursorChanged)
        self.cmpTrees = cmpTrees
        self.cmpTreev = cmpTreev

        cell = gtk.CellRendererText()
        col = gtk.TreeViewColumn("", cell, text=0)
        col.set_resizable(True)
        cmpTreev.append_column(col)

        cell = gtk.CellRendererText()
        col = gtk.TreeViewColumn(_("Key"), cell, text=1)
        col.set_resizable(True)
        cmpTreev.append_column(col)

        cell = gtk.CellRendererText()
        col = gtk.TreeViewColumn(_("Old Value"), cell, text=2)
        col.set_resizable(True)
        cmpTreev.append_column(col)

        cell = gtk.CellRendererText()
        col = gtk.TreeViewColumn(_("New Value"), cell, text=3)
        col.set_resizable(True)
        cmpTreev.append_column(col)

        leftSwin = gtk.ScrolledWindow()
        leftSwin.set_policy(
            gtk.PolicyType.AUTOMATIC,
            gtk.PolicyType.AUTOMATIC,
        )
        pack(leftVbox, leftSwin, expand=True, fill=True)
        self.leftSwin = leftSwin

        cell = gtk.CellRendererText()
        col = gtk.TreeViewColumn(_("Time"), cell, text=2)
        treev.append_column(col)

        cell = gtk.CellRendererText()
        col = gtk.TreeViewColumn(_("Change Summary"), cell, text=3)
        treev.append_column(col)
        col.set_property("expand", True)

        self.load()
        self.vbox.show_all()
        self.resize(ud.screenW, ud.screenH * 0.9)  # FIXME