small fixes
This commit is contained in:
parent
e526de786e
commit
968f18e107
|
@ -202,43 +202,50 @@
|
||||||
<property name="can-focus">True</property>
|
<property name="can-focus">True</property>
|
||||||
<property name="position">800</property>
|
<property name="position">800</property>
|
||||||
<child>
|
<child>
|
||||||
<object class="GtkViewport" id="viewport1">
|
<object class="GtkScrolledWindow">
|
||||||
<property name="visible">True</property>
|
<property name="visible">True</property>
|
||||||
<property name="can-focus">False</property>
|
<property name="can-focus">True</property>
|
||||||
|
<property name="shadow-type">in</property>
|
||||||
<child>
|
<child>
|
||||||
<object class="GtkListBox" id="pdf_list_box">
|
<object class="GtkViewport">
|
||||||
<property name="visible">True</property>
|
<property name="visible">True</property>
|
||||||
<property name="can-focus">False</property>
|
<property name="can-focus">False</property>
|
||||||
<child type="placeholder">
|
<child>
|
||||||
<object class="GtkBox">
|
<object class="GtkListBox" id="pdf_list_box">
|
||||||
<property name="visible">True</property>
|
<property name="visible">True</property>
|
||||||
<property name="can-focus">False</property>
|
<property name="can-focus">False</property>
|
||||||
<property name="halign">center</property>
|
<child type="placeholder">
|
||||||
<property name="valign">center</property>
|
<object class="GtkBox">
|
||||||
<property name="spacing">5</property>
|
|
||||||
<child>
|
|
||||||
<object class="GtkImage">
|
|
||||||
<property name="visible">True</property>
|
<property name="visible">True</property>
|
||||||
<property name="can-focus">False</property>
|
<property name="can-focus">False</property>
|
||||||
<property name="icon-name">dialog-information</property>
|
<property name="halign">center</property>
|
||||||
|
<property name="valign">center</property>
|
||||||
|
<property name="spacing">5</property>
|
||||||
|
<child>
|
||||||
|
<object class="GtkImage">
|
||||||
|
<property name="visible">True</property>
|
||||||
|
<property name="can-focus">False</property>
|
||||||
|
<property name="icon-name">dialog-information</property>
|
||||||
|
</object>
|
||||||
|
<packing>
|
||||||
|
<property name="expand">False</property>
|
||||||
|
<property name="fill">True</property>
|
||||||
|
<property name="position">0</property>
|
||||||
|
</packing>
|
||||||
|
</child>
|
||||||
|
<child>
|
||||||
|
<object class="GtkLabel">
|
||||||
|
<property name="visible">True</property>
|
||||||
|
<property name="can-focus">False</property>
|
||||||
|
<property name="label" translatable="yes">Open a file to begin</property>
|
||||||
|
</object>
|
||||||
|
<packing>
|
||||||
|
<property name="expand">False</property>
|
||||||
|
<property name="fill">True</property>
|
||||||
|
<property name="position">1</property>
|
||||||
|
</packing>
|
||||||
|
</child>
|
||||||
</object>
|
</object>
|
||||||
<packing>
|
|
||||||
<property name="expand">False</property>
|
|
||||||
<property name="fill">True</property>
|
|
||||||
<property name="position">0</property>
|
|
||||||
</packing>
|
|
||||||
</child>
|
|
||||||
<child>
|
|
||||||
<object class="GtkLabel">
|
|
||||||
<property name="visible">True</property>
|
|
||||||
<property name="can-focus">False</property>
|
|
||||||
<property name="label" translatable="yes">Open a file to begin</property>
|
|
||||||
</object>
|
|
||||||
<packing>
|
|
||||||
<property name="expand">False</property>
|
|
||||||
<property name="fill">True</property>
|
|
||||||
<property name="position">1</property>
|
|
||||||
</packing>
|
|
||||||
</child>
|
</child>
|
||||||
</object>
|
</object>
|
||||||
</child>
|
</child>
|
||||||
|
@ -247,7 +254,7 @@
|
||||||
</object>
|
</object>
|
||||||
<packing>
|
<packing>
|
||||||
<property name="resize">True</property>
|
<property name="resize">True</property>
|
||||||
<property name="shrink">True</property>
|
<property name="shrink">False</property>
|
||||||
</packing>
|
</packing>
|
||||||
</child>
|
</child>
|
||||||
<child>
|
<child>
|
||||||
|
|
|
@ -41,7 +41,6 @@ class PdfPage(Gtk.DrawingArea):
|
||||||
self.page: fitz.Page = page
|
self.page: fitz.Page = page
|
||||||
pix = self.page.get_pixmap(dpi=96) # type: ignore
|
pix = self.page.get_pixmap(dpi=96) # type: ignore
|
||||||
self.set_size_request(pix.width, pix.height)
|
self.set_size_request(pix.width, pix.height)
|
||||||
print(f"w: {pix.width}, h: {pix.height}")
|
|
||||||
self.set_app_paintable(True) # type: ignore
|
self.set_app_paintable(True) # type: ignore
|
||||||
self.connect("draw", self.on_draw, {})
|
self.connect("draw", self.on_draw, {})
|
||||||
|
|
||||||
|
@ -49,7 +48,9 @@ class PdfPage(Gtk.DrawingArea):
|
||||||
# app: Application = widget.get_window().get_application() # type: ignore
|
# app: Application = widget.get_window().get_application() # type: ignore
|
||||||
width = widget.get_allocated_width()
|
width = widget.get_allocated_width()
|
||||||
height = widget.get_allocated_height()
|
height = widget.get_allocated_height()
|
||||||
print(f"alloc w: {width}, h: {height}")
|
|
||||||
|
cr.set_source_rgba(255, 255, 255)
|
||||||
|
cr.paint()
|
||||||
|
|
||||||
sctx = widget.get_style_context()
|
sctx = widget.get_style_context()
|
||||||
Gtk.render_background(sctx, cr, 0, 0, width, height)
|
Gtk.render_background(sctx, cr, 0, 0, width, height)
|
||||||
|
@ -59,12 +60,6 @@ class PdfPage(Gtk.DrawingArea):
|
||||||
cr.set_source_surface(ims, 0, 0)
|
cr.set_source_surface(ims, 0, 0)
|
||||||
cr.paint()
|
cr.paint()
|
||||||
|
|
||||||
cr.set_source_rgba(255, 0, 0)
|
|
||||||
cr.set_line_width(10)
|
|
||||||
cr.move_to(0, 0)
|
|
||||||
cr.line_to(width, height)
|
|
||||||
cr.stroke()
|
|
||||||
|
|
||||||
|
|
||||||
@Gtk.Template.from_file("MainWindow.glade")
|
@Gtk.Template.from_file("MainWindow.glade")
|
||||||
class MainWindow(Gtk.ApplicationWindow):
|
class MainWindow(Gtk.ApplicationWindow):
|
||||||
|
|
Loading…
Reference in New Issue