forked from Mirrors/apostrophe
working on new version ..
parent
08385d6e91
commit
0da94c29db
|
@ -32,8 +32,8 @@
|
||||||
}
|
}
|
||||||
|
|
||||||
#UberwriterWindow GtkTextView:selected {
|
#UberwriterWindow GtkTextView:selected {
|
||||||
background-color: @selected_bg_color;
|
background-color: #4D9FCE;
|
||||||
color: @selected_fg_color;
|
color: #FFF;
|
||||||
}
|
}
|
||||||
|
|
||||||
#UberwriterWindow GtkPaned, #UberwriterWindow GtkScrolledWindow,
|
#UberwriterWindow GtkPaned, #UberwriterWindow GtkScrolledWindow,
|
||||||
|
@ -88,7 +88,6 @@
|
||||||
|
|
||||||
#status_bar_box GtkButton:hover,
|
#status_bar_box GtkButton:hover,
|
||||||
#status_bar_box GtkButton:active:hover {
|
#status_bar_box GtkButton:active:hover {
|
||||||
|
|
||||||
transition: 0s ease-in;
|
transition: 0s ease-in;
|
||||||
color: #333;
|
color: #333;
|
||||||
background: #EEE;
|
background: #EEE;
|
||||||
|
@ -136,8 +135,4 @@
|
||||||
#UberwriterWindow GtkTreeView {
|
#UberwriterWindow GtkTreeView {
|
||||||
color: #333;
|
color: #333;
|
||||||
font-size: 10;
|
font-size: 10;
|
||||||
}
|
|
||||||
|
|
||||||
#UberwriterWindow GtkBox {
|
|
||||||
background: #FFF;
|
|
||||||
}
|
}
|
|
@ -1,183 +0,0 @@
|
||||||
/*@import url('reset.css');*/
|
|
||||||
/* @import this colorsheet to get the default values for every property.
|
|
||||||
* This is useful when writing special CSS tests that should not be
|
|
||||||
* inluenced by themes - not even the default ones.
|
|
||||||
* Keep in mind that the output will be very ugly and not look like
|
|
||||||
* anything GTK.
|
|
||||||
* Also, when adding new style properties, please add them here.
|
|
||||||
*/
|
|
||||||
|
|
||||||
/** {
|
|
||||||
color: inherit;
|
|
||||||
font-size: inherit;
|
|
||||||
background-color: initial;
|
|
||||||
font-family: inherit;
|
|
||||||
font-style: inherit;
|
|
||||||
font-variant: inherit;
|
|
||||||
font-weight: inherit;
|
|
||||||
text-shadow: inherit;
|
|
||||||
icon-shadow: inherit;
|
|
||||||
box-shadow: initial;
|
|
||||||
margin-top: initial;
|
|
||||||
margin-left: initial;
|
|
||||||
margin-bottom: initial;
|
|
||||||
margin-right: initial;
|
|
||||||
padding-top: initial;
|
|
||||||
padding-left: initial;
|
|
||||||
padding-bottom: initial;
|
|
||||||
padding-right: initial;
|
|
||||||
border-top-style: initial;
|
|
||||||
border-top-width: initial;
|
|
||||||
border-left-style: initial;
|
|
||||||
border-left-width: initial;
|
|
||||||
border-bottom-style: initial;
|
|
||||||
border-bottom-width: initial;
|
|
||||||
border-right-style: initial;
|
|
||||||
border-right-width: initial;
|
|
||||||
border-top-left-radius: initial;
|
|
||||||
border-top-right-radius: initial;
|
|
||||||
border-bottom-right-radius: initial;
|
|
||||||
border-bottom-left-radius: initial;
|
|
||||||
outline-style: initial;
|
|
||||||
outline-width: initial;
|
|
||||||
outline-offset: initial;
|
|
||||||
background-clip: initial;
|
|
||||||
background-origin: initial;
|
|
||||||
background-size: initial;
|
|
||||||
background-position: initial;
|
|
||||||
border-top-color: initial;
|
|
||||||
border-right-color: initial;
|
|
||||||
border-bottom-color: initial;
|
|
||||||
border-left-color: initial;
|
|
||||||
outline-color: initial;
|
|
||||||
background-repeat: initial;
|
|
||||||
background-image: initial;
|
|
||||||
border-image-source: initial;
|
|
||||||
border-image-repeat: initial;
|
|
||||||
border-image-slice: initial;
|
|
||||||
border-image-width: initial;
|
|
||||||
transition-property: initial;
|
|
||||||
transition-duration: initial;
|
|
||||||
transition-timing-function: initial;
|
|
||||||
transition-delay: initial;
|
|
||||||
gtk-key-bindings: initial;
|
|
||||||
|
|
||||||
-GtkWidget-focus-line-width: 0;
|
|
||||||
-GtkWidget-focus-padding: 0;
|
|
||||||
-GtkNotebook-initial-gap: 0;
|
|
||||||
}
|
|
||||||
*/
|
|
||||||
|
|
||||||
#UberwriterWindow {
|
|
||||||
background: #FFF;
|
|
||||||
color: #CCC;
|
|
||||||
}
|
|
||||||
#UberwriterWindow GtkTextView {
|
|
||||||
|
|
||||||
border: none;
|
|
||||||
-GtkWidget-cursor-color: shade(@selected_bg_color, 1.2);
|
|
||||||
-GtkWidget-cursor-aspect-ratio: 0.05;
|
|
||||||
background: transparent ;
|
|
||||||
color: #DDD;
|
|
||||||
/*font: Rough_Typewriter 15;*/
|
|
||||||
/*font: Georgia 15;*/
|
|
||||||
}
|
|
||||||
|
|
||||||
#UberwriterWindow GtkScrolledWindow {
|
|
||||||
background: transparent;
|
|
||||||
}
|
|
||||||
|
|
||||||
#UberwriterWindow GtkTextView:selected {
|
|
||||||
background-color: @selected_bg_color;
|
|
||||||
color: @selected_fg_color;
|
|
||||||
}
|
|
||||||
|
|
||||||
#UberwriterWindow GtkPaned {
|
|
||||||
background-color: transparent;
|
|
||||||
background-clip: initial;
|
|
||||||
background-origin: initial;
|
|
||||||
background-size: initial;
|
|
||||||
background-position: initial;
|
|
||||||
background-repeat: initial;
|
|
||||||
background-image: initial;
|
|
||||||
}
|
|
||||||
|
|
||||||
#status_bar_box GtkLabel{
|
|
||||||
color: #666;
|
|
||||||
transition: 500ms ease-in-out;
|
|
||||||
text-shadow: none;
|
|
||||||
}
|
|
||||||
|
|
||||||
#status_bar_box GtkButton {
|
|
||||||
/* finding reset */
|
|
||||||
background-color: initial;
|
|
||||||
text-shadow: inherit;
|
|
||||||
icon-shadow: inherit;
|
|
||||||
box-shadow: initial;
|
|
||||||
background-clip: initial;
|
|
||||||
background-origin: initial;
|
|
||||||
background-size: initial;
|
|
||||||
background-position: initial;
|
|
||||||
background-repeat: initial;
|
|
||||||
background-image: initial;
|
|
||||||
border-image-source: initial;
|
|
||||||
border-image-repeat: initial;
|
|
||||||
border-image-slice: initial;
|
|
||||||
border-image-width: initial;
|
|
||||||
|
|
||||||
border-style: none;
|
|
||||||
-GtkButton-images: true;
|
|
||||||
border-radius: 2px;
|
|
||||||
color: #666;
|
|
||||||
padding: 3px 5px;
|
|
||||||
|
|
||||||
-GtkButton-child-displacement-y: 0px;
|
|
||||||
-GtkButton-child-displacement-x: 0;
|
|
||||||
-GtkButton-default-border: 0;
|
|
||||||
-GtkButton-image-spacing: 5px;
|
|
||||||
-GtkButton-interior-focus: false;
|
|
||||||
-GtkButton-inner-border: 0;
|
|
||||||
|
|
||||||
transition: 500ms ease-in;
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
#status_bar_box GtkButton:hover,
|
|
||||||
#status_bar_box GtkButton:active:hover {
|
|
||||||
|
|
||||||
transition: 0s ease-in;
|
|
||||||
color: #666;
|
|
||||||
background: #222;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
#status_bar_box GtkButton:active {
|
|
||||||
color: #666;
|
|
||||||
box-shadow: inset 0 0 5px #333;
|
|
||||||
background-color: #222;
|
|
||||||
background-image: none;
|
|
||||||
box-shadow: 0 0 2px rgba(0,0,0,0.4)
|
|
||||||
}
|
|
||||||
|
|
||||||
#status_bar_box GtkLabel:insensitive {
|
|
||||||
color: rgba(0,0,0,0);
|
|
||||||
transition: 500ms ease-in-out;
|
|
||||||
}
|
|
||||||
|
|
||||||
#status_bar_box GtkButton:insensitive {
|
|
||||||
background: rgba(0,0,0,0);
|
|
||||||
transition: 500ms all ease-in-out;
|
|
||||||
box-shadow: 0 0 0 #000;
|
|
||||||
}
|
|
||||||
|
|
||||||
#status_bar_box GtkSeparator {
|
|
||||||
border-color: #666;
|
|
||||||
border-right: none;
|
|
||||||
transition: 500ms ease-in-out;
|
|
||||||
|
|
||||||
}
|
|
||||||
#status_bar_box GtkSeparator:insensitive {
|
|
||||||
background: rgba(0,0,0,0);
|
|
||||||
border-color: rgba(0,0,0,0);
|
|
||||||
transition: 500ms ease-in-out;
|
|
||||||
}
|
|
|
@ -1,96 +0,0 @@
|
||||||
#UberwriterWindow {
|
|
||||||
background: #333;
|
|
||||||
}
|
|
||||||
#UberwriterWindow GtkTextView {
|
|
||||||
border: none;
|
|
||||||
-GtkWidget-cursor-color: #FA5B0F;
|
|
||||||
-GtkWidget-cursor-aspect-ratio: 0.05;
|
|
||||||
background-color: transparent;
|
|
||||||
color: #F3F3F3;
|
|
||||||
}
|
|
||||||
#UberwriterWindow GtkTextView:selected {
|
|
||||||
background-color: #888;
|
|
||||||
color: #DDD;
|
|
||||||
}
|
|
||||||
#fullscreen_toggle:hover,
|
|
||||||
#fullscreen_toggle:active:hover,
|
|
||||||
#focus_toggle:hover,
|
|
||||||
#focus_toggle:active:hover {
|
|
||||||
color: #999;
|
|
||||||
background-color: #222;
|
|
||||||
background-image: none;
|
|
||||||
text-shadow: none;
|
|
||||||
-unico-border-gradient: none;
|
|
||||||
-unico-glow-radius: 0;
|
|
||||||
-unico-glow-color: #000;
|
|
||||||
-unico-outer-stroke-color: #000;
|
|
||||||
-unico-outer-stroke-gradient: none;
|
|
||||||
-unico-outer-stroke-width: 0;
|
|
||||||
-unico-inner-stroke-gradient: none;
|
|
||||||
-unico-inner-stroke-width: 1px;
|
|
||||||
-unico-border-gradient: none;
|
|
||||||
-unico-focus-outer-stroke-color: #000;
|
|
||||||
-unico-outer-stroke-width: 0 0 0 0;
|
|
||||||
-GtkButton-default-border: 0;
|
|
||||||
-GtkButton-image-spacing: 0;
|
|
||||||
-GtkButton-interior-focus: false;
|
|
||||||
-unico-focus-border-color: #000;
|
|
||||||
-unico-focus-outer-stroke-color: #000;
|
|
||||||
-unico-inner-stroke-color: #000;
|
|
||||||
-unico-inner-stroke-width: 0;
|
|
||||||
|
|
||||||
}
|
|
||||||
#fullscreen_toggle,
|
|
||||||
#focus_toggle {
|
|
||||||
border-style: none;
|
|
||||||
-unico-border-gradient: none;
|
|
||||||
-GtkButton-images: true;
|
|
||||||
transition: 0s ease-in-out;
|
|
||||||
color: #666;
|
|
||||||
padding: 3px 5px;
|
|
||||||
text-shadow: none;
|
|
||||||
-GtkButton-child-displacement-y: 0px;
|
|
||||||
-GtkButton-child-displacement-x: 0;
|
|
||||||
-GtkButton-default-border: 0;
|
|
||||||
-GtkButton-image-spacing: 5px;
|
|
||||||
-GtkButton-interior-focus: false;
|
|
||||||
-GtkButton-inner-border: 0;
|
|
||||||
|
|
||||||
}
|
|
||||||
#fullscreen_toggle:active,
|
|
||||||
#focus_toggle:active {
|
|
||||||
color: #666;
|
|
||||||
box-shadow: inset 0 0 3 #000;
|
|
||||||
background-color: #111;
|
|
||||||
background-image: none;
|
|
||||||
border: 0px solid #000;
|
|
||||||
border-color: #333;
|
|
||||||
-unico-border-gradient: none;
|
|
||||||
-unico-glow-radius: 0;
|
|
||||||
-unico-glow-color: #000;
|
|
||||||
-unico-outer-stroke-color: #000;
|
|
||||||
-unico-outer-stroke-gradient: none;
|
|
||||||
-unico-outer-stroke-width: 0;
|
|
||||||
-unico-inner-stroke-gradient: none;
|
|
||||||
-unico-inner-stroke-width: 1px;
|
|
||||||
-unico-border-gradient: none;
|
|
||||||
-unico-focus-outer-stroke-color: #000;
|
|
||||||
-unico-outer-stroke-width: 0 0 0 0;
|
|
||||||
-GtkButton-default-border: 0;
|
|
||||||
-GtkButton-image-spacing: 0;
|
|
||||||
-GtkButton-interior-focus: false;
|
|
||||||
-unico-focus-border-color: #000;
|
|
||||||
-unico-focus-outer-stroke-color: #000;
|
|
||||||
-unico-inner-stroke-color: #000;
|
|
||||||
-unico-inner-stroke-width: 1;
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
.separator {
|
|
||||||
border-color: #444;
|
|
||||||
border-style: solid;
|
|
||||||
|
|
||||||
-unico-border-gradient: none;
|
|
||||||
-unico-inner-stroke-color: alpha (#444, 0.6);
|
|
||||||
-unico-inner-stroke-gradient: none;
|
|
||||||
}
|
|
|
@ -39,8 +39,8 @@
|
||||||
</mime-types>
|
</mime-types>
|
||||||
</object>
|
</object>
|
||||||
<object class="UberwriterWindow" id="uberwriter_window">
|
<object class="UberwriterWindow" id="uberwriter_window">
|
||||||
<property name="app_paintable">True</property>
|
<property name="app_paintable">False</property>
|
||||||
<property name="can_focus">False</property>
|
<property name="can_focus">True</property>
|
||||||
<property name="title">UberWriter</property>
|
<property name="title">UberWriter</property>
|
||||||
<property name="default_width">800</property>
|
<property name="default_width">800</property>
|
||||||
<property name="default_height">500</property>
|
<property name="default_height">500</property>
|
||||||
|
@ -305,6 +305,15 @@
|
||||||
<signal name="activate" handler="menu_activate_fullscreen" swapped="no"/>
|
<signal name="activate" handler="menu_activate_fullscreen" swapped="no"/>
|
||||||
</object>
|
</object>
|
||||||
</child>
|
</child>
|
||||||
|
<child>
|
||||||
|
<object class="GtkMenuItem" id="mnu_sidebar">
|
||||||
|
<property name="visible">True</property>
|
||||||
|
<property name="can_focus">False</property>
|
||||||
|
<property name="label">Sidebar</property>
|
||||||
|
<accelerator key="F12" signal="activate"/>
|
||||||
|
<signal name="activate" handler="menu_toggle_sidebar" swapped="no"/>
|
||||||
|
</object>
|
||||||
|
</child>
|
||||||
<child>
|
<child>
|
||||||
<object class="GtkCheckMenuItem" id="dark_mode">
|
<object class="GtkCheckMenuItem" id="dark_mode">
|
||||||
<property name="visible">True</property>
|
<property name="visible">True</property>
|
||||||
|
@ -760,6 +769,7 @@
|
||||||
<property name="visible">True</property>
|
<property name="visible">True</property>
|
||||||
<property name="app_paintable">True</property>
|
<property name="app_paintable">True</property>
|
||||||
<property name="can_focus">True</property>
|
<property name="can_focus">True</property>
|
||||||
|
<property name="expand">True</property>
|
||||||
<child>
|
<child>
|
||||||
<object class="GtkBox" id="sidebar_box">
|
<object class="GtkBox" id="sidebar_box">
|
||||||
<property name="width_request">200</property>
|
<property name="width_request">200</property>
|
||||||
|
|
|
@ -3,7 +3,6 @@ from gi.repository import Gtk
|
||||||
|
|
||||||
import logging
|
import logging
|
||||||
logger = logging.getLogger('uberwriter')
|
logger = logging.getLogger('uberwriter')
|
||||||
logger.critical("RASDAOD JKJD ASJD SJ")
|
|
||||||
|
|
||||||
class FixTable():
|
class FixTable():
|
||||||
|
|
||||||
|
|
|
@ -66,7 +66,7 @@ class UberwriterSidebar():
|
||||||
self.parentwindow = parentwindow
|
self.parentwindow = parentwindow
|
||||||
self.paned_window = parentwindow.paned_window
|
self.paned_window = parentwindow.paned_window
|
||||||
self.sidebar_box = parentwindow.sidebar_box
|
self.sidebar_box = parentwindow.sidebar_box
|
||||||
|
self.sidebar_open = True
|
||||||
# (GtkBox *box,
|
# (GtkBox *box,
|
||||||
# GtkWidget *child,
|
# GtkWidget *child,
|
||||||
# gboolean expand,
|
# gboolean expand,
|
||||||
|
@ -84,7 +84,7 @@ class UberwriterSidebar():
|
||||||
self.sidebar_scrolledwindow.set_vexpand(True)
|
self.sidebar_scrolledwindow.set_vexpand(True)
|
||||||
|
|
||||||
self.store = Gtk.TreeStore(str, str)
|
self.store = Gtk.TreeStore(str, str)
|
||||||
self.active_shelf = Shelve("testshelve", ["/home/wolf/Documents/Texte"])
|
self.active_shelf = Shelve("testshelve", ["/home/wolf/Documents"])
|
||||||
self.active_shelf.get_tree(self.store)
|
self.active_shelf.get_tree(self.store)
|
||||||
|
|
||||||
self.treeview = Gtk.TreeView(self.store)
|
self.treeview = Gtk.TreeView(self.store)
|
||||||
|
@ -165,6 +165,7 @@ class UberwriterSidebar():
|
||||||
"""
|
"""
|
||||||
return self.treeview
|
return self.treeview
|
||||||
|
|
||||||
|
|
||||||
def context_menu_open_file(self, widget, data=None):
|
def context_menu_open_file(self, widget, data=None):
|
||||||
"""
|
"""
|
||||||
Open selected file with xdg-open
|
Open selected file with xdg-open
|
||||||
|
@ -172,5 +173,20 @@ class UberwriterSidebar():
|
||||||
selected_file = widget.filename
|
selected_file = widget.filename
|
||||||
subprocess.call(["xdg-open", selected_file])
|
subprocess.call(["xdg-open", selected_file])
|
||||||
|
|
||||||
|
def toggle_sidebar(self):
|
||||||
|
if self.sidebar_open:
|
||||||
|
self.close_sidebar()
|
||||||
|
else:
|
||||||
|
self.open_sidebar()
|
||||||
|
|
||||||
|
|
||||||
|
def open_sidebar(self):
|
||||||
|
# self.paned_window.set_property('min-position', 0)
|
||||||
|
self.paned_window.set_position(200)
|
||||||
|
self.sidebar_open = True
|
||||||
|
|
||||||
|
|
||||||
def close_sidebar(self):
|
def close_sidebar(self):
|
||||||
pass
|
# self.paned_window.set_property('min-position', 0)
|
||||||
|
self.paned_window.set_position(0)
|
||||||
|
self.sidebar_open = False
|
|
@ -27,7 +27,7 @@ locale.textdomain('uberwriter')
|
||||||
|
|
||||||
import mimetypes
|
import mimetypes
|
||||||
|
|
||||||
from gi.repository import Gtk, Gdk, GObject, WebKit # pylint: disable=E0611
|
from gi.repository import Gtk, Gdk, GObject, WebKit, Gio # pylint: disable=E0611
|
||||||
from gi.repository import Pango # pylint: disable=E0611
|
from gi.repository import Pango # pylint: disable=E0611
|
||||||
|
|
||||||
import cairo
|
import cairo
|
||||||
|
@ -50,6 +50,7 @@ print('This file is imported')
|
||||||
# Spellcheck
|
# Spellcheck
|
||||||
|
|
||||||
import locale
|
import locale
|
||||||
|
|
||||||
try:
|
try:
|
||||||
from gtkspellcheck import SpellChecker
|
from gtkspellcheck import SpellChecker
|
||||||
except ImportError:
|
except ImportError:
|
||||||
|
@ -282,7 +283,7 @@ class UberwriterWindow(Window):
|
||||||
if self.did_change == False:
|
if self.did_change == False:
|
||||||
self.did_change = True
|
self.did_change = True
|
||||||
title = self.get_title()
|
title = self.get_title()
|
||||||
self.set_title("* " + title)
|
self.set_headerbar_title("* " + title)
|
||||||
|
|
||||||
self.MarkupBuffer.markup_buffer(1)
|
self.MarkupBuffer.markup_buffer(1)
|
||||||
self.textchange = True
|
self.textchange = True
|
||||||
|
@ -386,19 +387,19 @@ class UberwriterWindow(Window):
|
||||||
|
|
||||||
if(w_width < 900):
|
if(w_width < 900):
|
||||||
self.MarkupBuffer.set_multiplier(8)
|
self.MarkupBuffer.set_multiplier(8)
|
||||||
pango_font = Pango.FontDescription("Ubuntu Mono 12px")
|
pango_font = Pango.FontDescription("Inconsolata 12px")
|
||||||
self.TextEditor.modify_font(pango_font)
|
self.TextEditor.modify_font(pango_font)
|
||||||
lm = (widget.get_size()[0] - 600) / 2
|
lm = (widget.get_size()[0] - 600) / 2
|
||||||
|
|
||||||
elif(w_width < 1400):
|
elif(w_width < 1400):
|
||||||
self.MarkupBuffer.set_multiplier(10)
|
self.MarkupBuffer.set_multiplier(10)
|
||||||
pango_font = Pango.FontDescription("Ubuntu Mono 15px")
|
pango_font = Pango.FontDescription("Inconsolata 15px")
|
||||||
self.TextEditor.modify_font(pango_font)
|
self.TextEditor.modify_font(pango_font)
|
||||||
lm = (widget.get_size()[0] - 700) / 2
|
lm = (widget.get_size()[0] - 700) / 2
|
||||||
|
|
||||||
else:
|
else:
|
||||||
self.MarkupBuffer.set_multiplier(13)
|
self.MarkupBuffer.set_multiplier(13)
|
||||||
pango_font = Pango.FontDescription("Ubuntu Mono 17px")
|
pango_font = Pango.FontDescription("Inconsolata 17px")
|
||||||
self.TextEditor.modify_font(pango_font)
|
self.TextEditor.modify_font(pango_font)
|
||||||
lm = (widget.get_size()[0] - 1000) / 2
|
lm = (widget.get_size()[0] - 1000) / 2
|
||||||
|
|
||||||
|
@ -425,7 +426,7 @@ class UberwriterWindow(Window):
|
||||||
if self.did_change:
|
if self.did_change:
|
||||||
self.did_change = False
|
self.did_change = False
|
||||||
title = self.get_title()
|
title = self.get_title()
|
||||||
self.set_title(title[2:])
|
self.set_headerbar_title(title[2:])
|
||||||
return Gtk.ResponseType.OK
|
return Gtk.ResponseType.OK
|
||||||
|
|
||||||
else:
|
else:
|
||||||
|
@ -461,7 +462,7 @@ class UberwriterWindow(Window):
|
||||||
f.close()
|
f.close()
|
||||||
|
|
||||||
self.filename = filename
|
self.filename = filename
|
||||||
self.set_title(os.path.basename(filename) + self.title_end)
|
self.set_headerbar_title(os.path.basename(filename) + self.title_end)
|
||||||
|
|
||||||
self.did_change = False
|
self.did_change = False
|
||||||
filechooser.destroy()
|
filechooser.destroy()
|
||||||
|
@ -499,7 +500,7 @@ class UberwriterWindow(Window):
|
||||||
f.close()
|
f.close()
|
||||||
|
|
||||||
self.filename = filename
|
self.filename = filename
|
||||||
self.set_title(os.path.basename(filename) + self.title_end)
|
self.set_headerbar_title(os.path.basename(filename) + self.title_end)
|
||||||
|
|
||||||
try:
|
try:
|
||||||
self.recent_manager.add_item(filename)
|
self.recent_manager.add_item(filename)
|
||||||
|
@ -579,7 +580,7 @@ class UberwriterWindow(Window):
|
||||||
dialog = Gtk.MessageDialog(self,
|
dialog = Gtk.MessageDialog(self,
|
||||||
Gtk.DialogFlags.MODAL | Gtk.DialogFlags.DESTROY_WITH_PARENT,
|
Gtk.DialogFlags.MODAL | Gtk.DialogFlags.DESTROY_WITH_PARENT,
|
||||||
Gtk.MessageType.INFO,
|
Gtk.MessageType.INFO,
|
||||||
None,
|
Gtk.ButtonsType.NONE,
|
||||||
_("You can not export to PDF.")
|
_("You can not export to PDF.")
|
||||||
)
|
)
|
||||||
dialog.format_secondary_markup(_("Please install <a href=\"apt:texlive\">texlive</a> from the software center."))
|
dialog.format_secondary_markup(_("Please install <a href=\"apt:texlive\">texlive</a> from the software center."))
|
||||||
|
@ -606,6 +607,9 @@ class UberwriterWindow(Window):
|
||||||
if self.check_change() == Gtk.ResponseType.CANCEL:
|
if self.check_change() == Gtk.ResponseType.CANCEL:
|
||||||
return
|
return
|
||||||
|
|
||||||
|
if self.focusmode:
|
||||||
|
self.focusmode_button.set_active(False)
|
||||||
|
|
||||||
filefilter = Gtk.FileFilter.new()
|
filefilter = Gtk.FileFilter.new()
|
||||||
filefilter.add_mime_type('text/x-markdown')
|
filefilter.add_mime_type('text/x-markdown')
|
||||||
filefilter.add_mime_type('text/plain')
|
filefilter.add_mime_type('text/plain')
|
||||||
|
@ -633,7 +637,7 @@ class UberwriterWindow(Window):
|
||||||
dialog = Gtk.MessageDialog(self,
|
dialog = Gtk.MessageDialog(self,
|
||||||
Gtk.DialogFlags.MODAL | Gtk.DialogFlags.DESTROY_WITH_PARENT,
|
Gtk.DialogFlags.MODAL | Gtk.DialogFlags.DESTROY_WITH_PARENT,
|
||||||
Gtk.MessageType.WARNING,
|
Gtk.MessageType.WARNING,
|
||||||
None,
|
Gtk.ButtonsType.NONE,
|
||||||
_("You have not saved your changes.")
|
_("You have not saved your changes.")
|
||||||
)
|
)
|
||||||
dialog.add_button(_("Close without Saving"), Gtk.ResponseType.NO)
|
dialog.add_button(_("Close without Saving"), Gtk.ResponseType.NO)
|
||||||
|
@ -667,7 +671,7 @@ class UberwriterWindow(Window):
|
||||||
|
|
||||||
self.did_change = False
|
self.did_change = False
|
||||||
self.filename = None
|
self.filename = None
|
||||||
self.set_title("New File" + self.title_end)
|
self.set_headerbar_title("New File" + self.title_end)
|
||||||
|
|
||||||
def menu_activate_focusmode(self, widget):
|
def menu_activate_focusmode(self, widget):
|
||||||
self.focusmode_button.emit('activate')
|
self.focusmode_button.emit('activate')
|
||||||
|
@ -675,6 +679,9 @@ class UberwriterWindow(Window):
|
||||||
def menu_activate_fullscreen(self, widget):
|
def menu_activate_fullscreen(self, widget):
|
||||||
self.fullscreen_button.emit('activate')
|
self.fullscreen_button.emit('activate')
|
||||||
|
|
||||||
|
def menu_toggle_sidebar(self, widget):
|
||||||
|
self.sidebar.toggle_sidebar()
|
||||||
|
|
||||||
def menu_activate_preview(self, widget):
|
def menu_activate_preview(self, widget):
|
||||||
self.preview_button.emit('activate')
|
self.preview_button.emit('activate')
|
||||||
|
|
||||||
|
@ -698,7 +705,7 @@ class UberwriterWindow(Window):
|
||||||
dialog = Gtk.MessageDialog(self,
|
dialog = Gtk.MessageDialog(self,
|
||||||
Gtk.DialogFlags.MODAL | Gtk.DialogFlags.DESTROY_WITH_PARENT,
|
Gtk.DialogFlags.MODAL | Gtk.DialogFlags.DESTROY_WITH_PARENT,
|
||||||
Gtk.MessageType.INFO,
|
Gtk.MessageType.INFO,
|
||||||
None,
|
Gtk.ButtonsType.NONE,
|
||||||
_("You can not enable the Spell Checker.")
|
_("You can not enable the Spell Checker.")
|
||||||
)
|
)
|
||||||
dialog.format_secondary_text(_("Please install 'hunspell' or 'aspell' dictionarys for your language from the software center."))
|
dialog.format_secondary_text(_("Please install 'hunspell' or 'aspell' dictionarys for your language from the software center."))
|
||||||
|
@ -776,10 +783,10 @@ class UberwriterWindow(Window):
|
||||||
|
|
||||||
# Making the background white
|
# Making the background white
|
||||||
|
|
||||||
white_background = helpers.get_media_path('white.png')
|
# white_background = helpers.get_media_path('white.png')
|
||||||
surface = cairo.ImageSurface.create_from_png(white_background)
|
# surface = cairo.ImageSurface.create_from_png(white_background)
|
||||||
self.background_pattern = cairo.SurfacePattern(surface)
|
# self.background_pattern = cairo.SurfacePattern(surface)
|
||||||
self.background_pattern.set_extend(cairo.EXTEND_REPEAT)
|
# self.background_pattern.set_extend(cairo.EXTEND_REPEAT)
|
||||||
# This saying that all links will be opened in default browser, but local files are opened in appropriate apps:
|
# This saying that all links will be opened in default browser, but local files are opened in appropriate apps:
|
||||||
self.webview.connect("navigation-requested", self.on_click_link)
|
self.webview.connect("navigation-requested", self.on_click_link)
|
||||||
else:
|
else:
|
||||||
|
@ -787,9 +794,9 @@ class UberwriterWindow(Window):
|
||||||
self.webview.destroy()
|
self.webview.destroy()
|
||||||
self.ScrolledWindow.add(self.TextEditor)
|
self.ScrolledWindow.add(self.TextEditor)
|
||||||
self.TextEditor.show()
|
self.TextEditor.show()
|
||||||
surface = cairo.ImageSurface.create_from_png(self.background_image)
|
# surface = cairo.ImageSurface.create_from_png(self.background_image)
|
||||||
self.background_pattern = cairo.SurfacePattern(surface)
|
# self.background_pattern = cairo.SurfacePattern(surface)
|
||||||
self.background_pattern.set_extend(cairo.EXTEND_REPEAT)
|
# self.background_pattern.set_extend(cairo.EXTEND_REPEAT)
|
||||||
self.queue_draw()
|
self.queue_draw()
|
||||||
|
|
||||||
def on_click_link(self, view, frame, req, data=None):
|
def on_click_link(self, view, frame, req, data=None):
|
||||||
|
@ -807,7 +814,7 @@ class UberwriterWindow(Window):
|
||||||
css_data = css.read()
|
css_data = css.read()
|
||||||
css.close()
|
css.close()
|
||||||
self.style_provider.load_from_data(css_data)
|
self.style_provider.load_from_data(css_data)
|
||||||
self.background_image = helpers.get_media_path('bg_dark.png')
|
# self.background_image = helpers.get_media_path('bg_dark.png')
|
||||||
self.MarkupBuffer.dark_mode(True)
|
self.MarkupBuffer.dark_mode(True)
|
||||||
|
|
||||||
else:
|
else:
|
||||||
|
@ -816,12 +823,12 @@ class UberwriterWindow(Window):
|
||||||
css_data = css.read()
|
css_data = css.read()
|
||||||
css.close()
|
css.close()
|
||||||
self.style_provider.load_from_data(css_data)
|
self.style_provider.load_from_data(css_data)
|
||||||
self.background_image = helpers.get_media_path('bg_light.png')
|
# self.background_image = helpers.get_media_path('bg_light.png')
|
||||||
self.MarkupBuffer.dark_mode(False)
|
self.MarkupBuffer.dark_mode(False)
|
||||||
|
|
||||||
surface = cairo.ImageSurface.create_from_png(self.background_image)
|
# surface = cairo.ImageSurface.create_from_png(self.background_image)
|
||||||
self.background_pattern = cairo.SurfacePattern(surface)
|
# self.background_pattern = cairo.SurfacePattern(surface)
|
||||||
self.background_pattern.set_extend(cairo.EXTEND_REPEAT)
|
# self.background_pattern.set_extend(cairo.EXTEND_REPEAT)
|
||||||
|
|
||||||
Gtk.StyleContext.add_provider_for_screen(
|
Gtk.StyleContext.add_provider_for_screen(
|
||||||
Gdk.Screen.get_default(), self.style_provider,
|
Gdk.Screen.get_default(), self.style_provider,
|
||||||
|
@ -843,7 +850,7 @@ class UberwriterWindow(Window):
|
||||||
self.TextBuffer.set_text(f.read())
|
self.TextBuffer.set_text(f.read())
|
||||||
f.close()
|
f.close()
|
||||||
self.MarkupBuffer.markup_buffer(0)
|
self.MarkupBuffer.markup_buffer(0)
|
||||||
self.set_title(os.path.basename(filename) + self.title_end)
|
self.set_headerbar_title(os.path.basename(filename) + self.title_end)
|
||||||
self.TextEditor.undo_stack = []
|
self.TextEditor.undo_stack = []
|
||||||
self.TextEditor.redo_stack = []
|
self.TextEditor.redo_stack = []
|
||||||
# ei = self.TextBuffer.get_end_iter()
|
# ei = self.TextBuffer.get_end_iter()
|
||||||
|
@ -859,9 +866,9 @@ class UberwriterWindow(Window):
|
||||||
else:
|
else:
|
||||||
logger.warning("No File arg")
|
logger.warning("No File arg")
|
||||||
|
|
||||||
def draw_bg(self, widget, context):
|
# def draw_bg(self, widget, context):
|
||||||
context.set_source(self.background_pattern)
|
# context.set_source(self.background_pattern)
|
||||||
context.paint()
|
# context.paint()
|
||||||
|
|
||||||
# Help Menu
|
# Help Menu
|
||||||
def open_launchpad_translation(self, widget, data=None):
|
def open_launchpad_translation(self, widget, data=None):
|
||||||
|
@ -958,8 +965,24 @@ class UberwriterWindow(Window):
|
||||||
|
|
||||||
self.set_name('UberwriterWindow')
|
self.set_name('UberwriterWindow')
|
||||||
|
|
||||||
|
self.use_headerbar = False
|
||||||
|
|
||||||
|
if self.use_headerbar == True:
|
||||||
|
self.hb = Gtk.HeaderBar()
|
||||||
|
self.hb.props.show_close_button = True
|
||||||
|
self.set_titlebar(self.hb)
|
||||||
|
self.hb.show()
|
||||||
|
|
||||||
|
bbtn = Gtk.MenuButton()
|
||||||
|
# icon = Gio.ThemedIcon(name="mail-send-receive-symbolic")
|
||||||
|
# image = Gtk.Image.new_from_gicon(icon, Gtk.IconSize.BUTTON)
|
||||||
|
# bbtn.add(image)
|
||||||
|
bbtn.set_popup(self.builder.get_object("menu1"))
|
||||||
|
self.hb.pack_start(bbtn)
|
||||||
|
self.hb.show_all()
|
||||||
|
|
||||||
self.title_end = " – UberWriter"
|
self.title_end = " – UberWriter"
|
||||||
self.set_title("New File" + self.title_end)
|
self.set_headerbar_title("New File" + self.title_end)
|
||||||
|
|
||||||
# Drag and drop
|
# Drag and drop
|
||||||
self.drag_dest_set(Gtk.DestDefaults.ALL, [], Gdk.DragAction.COPY)
|
self.drag_dest_set(Gtk.DestDefaults.ALL, [], Gdk.DragAction.COPY)
|
||||||
|
@ -1000,7 +1023,6 @@ class UberwriterWindow(Window):
|
||||||
|
|
||||||
# Setup light background
|
# Setup light background
|
||||||
|
|
||||||
|
|
||||||
self.TextEditor = TextEditor()
|
self.TextEditor = TextEditor()
|
||||||
|
|
||||||
base_leftmargin = 100
|
base_leftmargin = 100
|
||||||
|
@ -1016,17 +1038,18 @@ class UberwriterWindow(Window):
|
||||||
|
|
||||||
# Draw background
|
# Draw background
|
||||||
self.background_image = helpers.get_media_path('bg_light.png')
|
self.background_image = helpers.get_media_path('bg_light.png')
|
||||||
self.ScrolledWindow.connect('draw', self.draw_bg)
|
# self.ScrolledWindow.connect('draw', self.draw_bg)
|
||||||
surface = cairo.ImageSurface.create_from_png(self.background_image)
|
surface = cairo.ImageSurface.create_from_png(self.background_image)
|
||||||
self.background_pattern = cairo.SurfacePattern(surface)
|
self.background_pattern = cairo.SurfacePattern(surface)
|
||||||
self.background_pattern.set_extend(cairo.EXTEND_REPEAT)
|
self.background_pattern.set_extend(cairo.EXTEND_REPEAT)
|
||||||
|
|
||||||
|
|
||||||
|
# self.modify_bg(Gtk.StateType.NORMAL, Gdk.Color(1,1,1))
|
||||||
|
|
||||||
self.PreviewPane = builder.get_object('preview_scrolledwindow')
|
self.PreviewPane = builder.get_object('preview_scrolledwindow')
|
||||||
|
|
||||||
pangoFont = Pango.FontDescription("Ubuntu Mono 15px")
|
pangoFont = Pango.FontDescription("Ubuntu Mono 15px")
|
||||||
|
|
||||||
|
|
||||||
# self.scw = builder.get_object('scrolledwindow1')
|
# self.scw = builder.get_object('scrolledwindow1')
|
||||||
# self.scw.add(self.sidebar.get_treeview())
|
# self.scw.add(self.sidebar.get_treeview())
|
||||||
|
|
||||||
|
@ -1136,7 +1159,7 @@ class UberwriterWindow(Window):
|
||||||
self.paned_window = builder.get_object("main_pained")
|
self.paned_window = builder.get_object("main_pained")
|
||||||
self.sidebar_box = builder.get_object("sidebar_box")
|
self.sidebar_box = builder.get_object("sidebar_box")
|
||||||
self.sidebar = UberwriterSidebar(self)
|
self.sidebar = UberwriterSidebar(self)
|
||||||
|
self.sidebar_box.hide()
|
||||||
###
|
###
|
||||||
# Search and replace initialization
|
# Search and replace initialization
|
||||||
# Same interface as Sidebar ;)
|
# Same interface as Sidebar ;)
|
||||||
|
@ -1144,7 +1167,6 @@ class UberwriterWindow(Window):
|
||||||
|
|
||||||
self.searchreplace = UberwriterSearchAndReplace(self)
|
self.searchreplace = UberwriterSearchAndReplace(self)
|
||||||
|
|
||||||
|
|
||||||
# Window resize
|
# Window resize
|
||||||
self.connect("configure-event", self.window_resize)
|
self.connect("configure-event", self.window_resize)
|
||||||
self.connect("delete-event", self.on_delete_called)
|
self.connect("delete-event", self.on_delete_called)
|
||||||
|
@ -1181,8 +1203,13 @@ class UberwriterWindow(Window):
|
||||||
self.save_settings()
|
self.save_settings()
|
||||||
Gtk.main_quit()
|
Gtk.main_quit()
|
||||||
|
|
||||||
def save_settings(self):
|
def set_headerbar_title(self, title):
|
||||||
|
if self.use_headerbar:
|
||||||
|
self.hb.props.title = title
|
||||||
|
else:
|
||||||
|
self.set_title(title)
|
||||||
|
|
||||||
|
def save_settings(self):
|
||||||
if not os.path.exists(CONFIG_PATH):
|
if not os.path.exists(CONFIG_PATH):
|
||||||
try:
|
try:
|
||||||
os.makedirs(CONFIG_PATH)
|
os.makedirs(CONFIG_PATH)
|
||||||
|
|
Binary file not shown.
Before Width: | Height: | Size: 1.3 KiB |
Loading…
Reference in New Issue