This commit is contained in:
TheShadowOfHassen 2023-09-12 17:15:45 -04:00 committed by GitHub
commit 1336dd46f6
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
6 changed files with 78 additions and 3 deletions

2
.gitignore vendored
View file

@ -25,4 +25,4 @@ manuskript.log
snowflake*
test-projects
main.pyproject.user
*.glade#
ui/\#general.glade\#

View file

@ -0,0 +1,25 @@
import random
import datetime
class QuoteManager:
def __init__(self, language):
self.language = language
self.quotes = self.load_quotes()
print(self.quotes)
def load_quotes(self):
quote_file = "./resources/quotes/Quotes_"+self.language+".txt" # TODO translations
with open(quote_file, "r") as file:
quotes = file.readlines()
return quotes
def get_quote(self):
# Get seed
today = datetime.date.today()
split_date = str(today).split("-")
seed = split_date[0]+split_date[1]+split_date[2]
int(seed)
random.seed(seed)
return random.choice(self.quotes)

View file

@ -8,7 +8,7 @@ from gi.repository import Gtk
from manuskript.data import Info
from manuskript.util import validString, invalidString
from manuskript.quoteOfTheDay import QuoteManager
class GeneralView:
@ -28,6 +28,8 @@ class GeneralView:
self.licenseBuffer = builder.get_object("license")
self.nameBuffer = builder.get_object("name")
self.emailBuffer = builder.get_object("email")
self.quoteLabel = builder.get_object("quote_label")
self.titleBuffer.set_text(validString(self.info.title), -1)
self.subtitleBuffer.set_text(validString(self.info.subtitle), -1)
@ -54,6 +56,11 @@ class GeneralView:
self.nameBuffer.connect("inserted-text", self._nameInsertedText)
self.emailBuffer.connect("deleted-text", self._emailDeletedText)
self.emailBuffer.connect("inserted-text", self._emailInsertedText)
self.quoteManager = QuoteManager("English")
self.quoteLabel.set_text(self.quoteManager.get_quote())
def __titleChanged(self, buffer: Gtk.EntryBuffer):
self.info.title = invalidString(buffer.get_text())

View file

@ -0,0 +1,5 @@
"Don't say it was “delightful”; make us say “delightful” when weve read the description. You see all those words (horrifying, wonderful, hideous, exquisite) are only like saying to your readers, “Please will you give my job for me?”" -- C.S. Lewis
"Dont use words too big for the subject. Dont say “infinitely” when you mean “very”; otherwise youll have no word left when you want to talk about something really infinite" - C.S. Lewis
“Im not in a mood for writing; I must write on until I am.” -- Jane Austen
"Show Don't Tell" -- Pretty much everyone
"In descriptions of Nature one must seize on small details, grouping them so that when the reader closes his eyes he gets a picture. For instance, youll have a moonlit night if you write that on the mill dam a piece of glass from a broken bottle glittered like a bright little star, and that the black shadow of a dog or a wolf rolled past like a ball." -- Anton Pavlovich Chekhov

View file

@ -0,0 +1,8 @@
We'd be glad to get more quotes! However there are a few rules.
Rules for quotes:
1. They must be clean. If you have to edit them so they're clean that's fine.
2. They must pertain to writing. That doesn't just mean they are from authors but that they are useful/funny/insightful in a way that would encourage or at least make a writer think.
3. Follow the format please. Tab first than an opening quote and closing quote followed by the source.
If you have a question just open an issue.

View file

@ -435,7 +435,37 @@ along with Manuskript. If not, see <http://www.gnu.org/licenses/>.
<property name="can-focus">False</property>
<property name="orientation">vertical</property>
<child>
<placeholder/>
<object class="GtkLabel">
<property name="visible">True</property>
<property name="can-focus">False</property>
<property name="halign">start</property>
<property name="label" translatable="yes">Quote of The Day</property>
<attributes>
<attribute name="weight" value="bold"/>
</attributes>
</object>
<packing>
<property name="expand">False</property>
<property name="fill">True</property>
<property name="position">0</property>
</packing>
</child>
<child>
<object class="GtkLabel" id="quote_label">
<property name="visible">True</property>
<property name="can-focus">False</property>
<property name="wrap">True</property>
<property name="selectable">True</property>
<attributes>
<attribute name="style" value="normal"/>
<attribute name="scale" value="2"/>
</attributes>
</object>
<packing>
<property name="expand">False</property>
<property name="fill">True</property>
<property name="position">1</property>
</packing>
</child>
</object>
<packing>