Skip to content

Commit

Permalink
Highlight View
Browse files Browse the repository at this point in the history
  • Loading branch information
noembryo authored Jun 6, 2018
1 parent 10a3ade commit f08e4a0
Show file tree
Hide file tree
Showing 10 changed files with 1,490 additions and 1,038 deletions.
77 changes: 39 additions & 38 deletions boot_config.py
Original file line number Diff line number Diff line change
@@ -1,38 +1,39 @@
# coding=utf-8
from __future__ import (absolute_import, division, print_function, unicode_literals)

import time
import sys, os
import traceback
from os.path import dirname, join, isdir

APP_NAME = "KoHighlights"
APP_DIR = dirname(os.path.abspath(sys.argv[0]))
os.chdir(APP_DIR) # Set the current working directory to the app's directory
SETTINGS_DIR = join(os.environ['APPDATA'], APP_NAME)
os.makedirs(SETTINGS_DIR) if not isdir(SETTINGS_DIR) else None


def except_hook(class_type, value, trace_back):
""" Print the error to a log file
"""
name = join(SETTINGS_DIR, "error_log_{}.txt".format(time.strftime("%Y-%m-%d")))
with open(name, "a") as log:
log.write('\nCrash@{}\n'.format(time.strftime("%Y-%m-%d %H:%M:%S")))
traceback.print_exception(class_type, value, trace_back, file=open(name, "a"))
sys.__excepthook__(class_type, value, trace_back)


sys.excepthook = except_hook

import gzip, json

try:
with gzip.GzipFile(join(SETTINGS_DIR, 'settings.json.gz'), 'rb') as settings:
app_config = json.loads(settings.read())
except IOError: # first run
app_config = {}

FIRST_RUN = not bool(app_config)
TITLE, AUTHOR, TYPE, PERCENT, MODIFIED, PATH = range(6)
PAGE, HIGHLIGHT_TEXT, DATE, PAGE_ID, COMMENT = range(5)
# coding=utf-8
from __future__ import (absolute_import, division, print_function, unicode_literals)

import time
import sys, os
import traceback
from os.path import dirname, join, isdir

APP_NAME = "KoHighlights"
APP_DIR = dirname(os.path.abspath(sys.argv[0]))
os.chdir(APP_DIR) # Set the current working directory to the app's directory
SETTINGS_DIR = join(os.environ['APPDATA'], APP_NAME)
os.makedirs(SETTINGS_DIR) if not isdir(SETTINGS_DIR) else None


def except_hook(class_type, value, trace_back):
""" Print the error to a log file
"""
name = join(SETTINGS_DIR, "error_log_{}.txt".format(time.strftime(str("%Y-%m-%d"))))
with open(name, "a") as log:
log.write(str('\nCrash@{}\n').format(time.strftime(str("%Y-%m-%d %H:%M:%S"))))
traceback.print_exception(class_type, value, trace_back, file=open(name, "a"))
sys.__excepthook__(class_type, value, trace_back)


sys.excepthook = except_hook

import gzip, json

try:
with gzip.GzipFile(join(SETTINGS_DIR, 'settings.json.gz'), 'rb') as settings:
app_config = json.loads(settings.read())
except IOError: # first run
app_config = {}

FIRST_RUN = not bool(app_config)
TITLE, AUTHOR, TYPE, PERCENT, MODIFIED, PATH = range(6)
PAGE, HIGHLIGHT_TEXT, DATE, PAGE_ID, COMMENT = range(5)
HIGHLIGHT_H, COMMENT_H, DATE_H, TITLE_H, PAGE_H, AUTHOR_H = range(6)
212 changes: 106 additions & 106 deletions gui_about.py
Original file line number Diff line number Diff line change
@@ -1,106 +1,106 @@
# -*- coding: utf-8 -*-

# Form implementation generated from reading ui file 'D:\Apps\DEV\PROJECTS\KoHighlights\gui_about.ui'
#
# Created: Wed Oct 25 15:36:43 2017
# by: pyside-uic 0.2.15 running on PySide 1.2.4
#
# WARNING! All changes made in this file will be lost!

from PySide import QtCore, QtGui

class Ui_About(object):
def setupUi(self, About):
About.setObjectName("About")
About.setWindowModality(QtCore.Qt.ApplicationModal)
About.resize(480, 560)
About.setLocale(QtCore.QLocale(QtCore.QLocale.English, QtCore.QLocale.UnitedStates))
About.setModal(False)
self.verticalLayout = QtGui.QVBoxLayout(About)
self.verticalLayout.setObjectName("verticalLayout")
self.about_tabs = QtGui.QTabWidget(About)
self.about_tabs.setTabShape(QtGui.QTabWidget.Rounded)
self.about_tabs.setObjectName("about_tabs")
self.info_tab = QtGui.QWidget()
self.info_tab.setObjectName("info_tab")
self.verticalLayout_2 = QtGui.QVBoxLayout(self.info_tab)
self.verticalLayout_2.setContentsMargins(0, 0, 0, 0)
self.verticalLayout_2.setObjectName("verticalLayout_2")
self.scrollArea_2 = QtGui.QScrollArea(self.info_tab)
self.scrollArea_2.setStyleSheet("QScrollArea {background-color:transparent;}")
self.scrollArea_2.setWidgetResizable(True)
self.scrollArea_2.setObjectName("scrollArea_2")
self.scrollAreaWidgetContents_2 = QtGui.QWidget()
self.scrollAreaWidgetContents_2.setGeometry(QtCore.QRect(0, 0, 454, 483))
self.scrollAreaWidgetContents_2.setStyleSheet("background-color:transparent;")
self.scrollAreaWidgetContents_2.setObjectName("scrollAreaWidgetContents_2")
self.verticalLayout_6 = QtGui.QVBoxLayout(self.scrollAreaWidgetContents_2)
self.verticalLayout_6.setContentsMargins(6, 0, 6, 0)
self.verticalLayout_6.setObjectName("verticalLayout_6")
self.text_lbl = QtGui.QLabel(self.scrollAreaWidgetContents_2)
self.text_lbl.setText("")
self.text_lbl.setAlignment(QtCore.Qt.AlignLeading|QtCore.Qt.AlignLeft|QtCore.Qt.AlignTop)
self.text_lbl.setWordWrap(True)
self.text_lbl.setOpenExternalLinks(True)
self.text_lbl.setObjectName("text_lbl")
self.verticalLayout_6.addWidget(self.text_lbl)
self.scrollArea_2.setWidget(self.scrollAreaWidgetContents_2)
self.verticalLayout_2.addWidget(self.scrollArea_2)
self.about_tabs.addTab(self.info_tab, "")
self.log_tab = QtGui.QWidget()
self.log_tab.setObjectName("log_tab")
self.verticalLayout_8 = QtGui.QVBoxLayout(self.log_tab)
self.verticalLayout_8.setObjectName("verticalLayout_8")
self.log_txt = QtGui.QPlainTextEdit(self.log_tab)
self.log_txt.setFrameShape(QtGui.QFrame.WinPanel)
self.log_txt.setDocumentTitle("")
self.log_txt.setUndoRedoEnabled(False)
self.log_txt.setReadOnly(True)
self.log_txt.setPlainText("")
self.log_txt.setObjectName("log_txt")
self.verticalLayout_8.addWidget(self.log_txt)
self.about_tabs.addTab(self.log_tab, "")
self.verticalLayout.addWidget(self.about_tabs)
self.btn_box = QtGui.QFrame(About)
sizePolicy = QtGui.QSizePolicy(QtGui.QSizePolicy.Preferred, QtGui.QSizePolicy.Fixed)
sizePolicy.setHorizontalStretch(0)
sizePolicy.setVerticalStretch(0)
sizePolicy.setHeightForWidth(self.btn_box.sizePolicy().hasHeightForWidth())
self.btn_box.setSizePolicy(sizePolicy)
self.btn_box.setFrameShape(QtGui.QFrame.StyledPanel)
self.btn_box.setFrameShadow(QtGui.QFrame.Raised)
self.btn_box.setObjectName("btn_box")
self.horizontalLayout = QtGui.QHBoxLayout(self.btn_box)
self.horizontalLayout.setContentsMargins(0, 0, 0, 0)
self.horizontalLayout.setObjectName("horizontalLayout")
self.about_qt_btn = QtGui.QPushButton(self.btn_box)
self.about_qt_btn.setObjectName("about_qt_btn")
self.horizontalLayout.addWidget(self.about_qt_btn)
spacerItem = QtGui.QSpacerItem(92, 20, QtGui.QSizePolicy.Expanding, QtGui.QSizePolicy.Minimum)
self.horizontalLayout.addItem(spacerItem)
self.updates_btn = QtGui.QPushButton(self.btn_box)
self.updates_btn.setObjectName("updates_btn")
self.horizontalLayout.addWidget(self.updates_btn)
spacerItem1 = QtGui.QSpacerItem(40, 20, QtGui.QSizePolicy.Expanding, QtGui.QSizePolicy.Minimum)
self.horizontalLayout.addItem(spacerItem1)
self.close_btn = QtGui.QPushButton(self.btn_box)
self.close_btn.setObjectName("close_btn")
self.horizontalLayout.addWidget(self.close_btn)
self.verticalLayout.addWidget(self.btn_box)

self.retranslateUi(About)
self.about_tabs.setCurrentIndex(0)
QtCore.QObject.connect(self.close_btn, QtCore.SIGNAL("clicked()"), About.close)
QtCore.QMetaObject.connectSlotsByName(About)

def retranslateUi(self, About):
About.setWindowTitle(QtGui.QApplication.translate("About", "About KoHighlights", None, QtGui.QApplication.UnicodeUTF8))
self.about_tabs.setTabText(self.about_tabs.indexOf(self.info_tab), QtGui.QApplication.translate("About", "Information", None, QtGui.QApplication.UnicodeUTF8))
self.about_tabs.setTabText(self.about_tabs.indexOf(self.log_tab), QtGui.QApplication.translate("About", "Log", None, QtGui.QApplication.UnicodeUTF8))
self.about_qt_btn.setToolTip(QtGui.QApplication.translate("About", "Check online for an updated version", None, QtGui.QApplication.UnicodeUTF8))
self.about_qt_btn.setText(QtGui.QApplication.translate("About", "About Qt", None, QtGui.QApplication.UnicodeUTF8))
self.updates_btn.setToolTip(QtGui.QApplication.translate("About", "Check online for an updated version", None, QtGui.QApplication.UnicodeUTF8))
self.updates_btn.setText(QtGui.QApplication.translate("About", "Check for Updates", None, QtGui.QApplication.UnicodeUTF8))
self.close_btn.setText(QtGui.QApplication.translate("About", "Close", None, QtGui.QApplication.UnicodeUTF8))

import images_rc
# -*- coding: utf-8 -*-

# Form implementation generated from reading ui file 'D:\Apps\DEV\PROJECTS\KoHighlights\gui_about.ui'
#
# Created: Wed Jun 06 03:09:10 2018
# by: pyside-uic 0.2.15 running on PySide 1.2.4
#
# WARNING! All changes made in this file will be lost!

from PySide import QtCore, QtGui

class Ui_About(object):
def setupUi(self, About):
About.setObjectName("About")
About.setWindowModality(QtCore.Qt.ApplicationModal)
About.resize(480, 560)
About.setLocale(QtCore.QLocale(QtCore.QLocale.English, QtCore.QLocale.UnitedStates))
About.setModal(False)
self.verticalLayout = QtGui.QVBoxLayout(About)
self.verticalLayout.setObjectName("verticalLayout")
self.about_tabs = QtGui.QTabWidget(About)
self.about_tabs.setTabShape(QtGui.QTabWidget.Rounded)
self.about_tabs.setObjectName("about_tabs")
self.info_tab = QtGui.QWidget()
self.info_tab.setObjectName("info_tab")
self.verticalLayout_2 = QtGui.QVBoxLayout(self.info_tab)
self.verticalLayout_2.setContentsMargins(0, 0, 0, 0)
self.verticalLayout_2.setObjectName("verticalLayout_2")
self.scrollArea_2 = QtGui.QScrollArea(self.info_tab)
self.scrollArea_2.setStyleSheet("QScrollArea {background-color:transparent;}")
self.scrollArea_2.setWidgetResizable(True)
self.scrollArea_2.setObjectName("scrollArea_2")
self.scrollAreaWidgetContents_2 = QtGui.QWidget()
self.scrollAreaWidgetContents_2.setGeometry(QtCore.QRect(0, 0, 454, 483))
self.scrollAreaWidgetContents_2.setStyleSheet("background-color:transparent;")
self.scrollAreaWidgetContents_2.setObjectName("scrollAreaWidgetContents_2")
self.verticalLayout_6 = QtGui.QVBoxLayout(self.scrollAreaWidgetContents_2)
self.verticalLayout_6.setContentsMargins(6, 0, 6, 0)
self.verticalLayout_6.setObjectName("verticalLayout_6")
self.text_lbl = QtGui.QLabel(self.scrollAreaWidgetContents_2)
self.text_lbl.setText("")
self.text_lbl.setAlignment(QtCore.Qt.AlignLeading|QtCore.Qt.AlignLeft|QtCore.Qt.AlignTop)
self.text_lbl.setWordWrap(True)
self.text_lbl.setOpenExternalLinks(True)
self.text_lbl.setObjectName("text_lbl")
self.verticalLayout_6.addWidget(self.text_lbl)
self.scrollArea_2.setWidget(self.scrollAreaWidgetContents_2)
self.verticalLayout_2.addWidget(self.scrollArea_2)
self.about_tabs.addTab(self.info_tab, "")
self.log_tab = QtGui.QWidget()
self.log_tab.setObjectName("log_tab")
self.verticalLayout_8 = QtGui.QVBoxLayout(self.log_tab)
self.verticalLayout_8.setObjectName("verticalLayout_8")
self.log_txt = QtGui.QPlainTextEdit(self.log_tab)
self.log_txt.setFrameShape(QtGui.QFrame.WinPanel)
self.log_txt.setDocumentTitle("")
self.log_txt.setUndoRedoEnabled(False)
self.log_txt.setReadOnly(True)
self.log_txt.setPlainText("")
self.log_txt.setObjectName("log_txt")
self.verticalLayout_8.addWidget(self.log_txt)
self.about_tabs.addTab(self.log_tab, "")
self.verticalLayout.addWidget(self.about_tabs)
self.btn_box = QtGui.QFrame(About)
sizePolicy = QtGui.QSizePolicy(QtGui.QSizePolicy.Preferred, QtGui.QSizePolicy.Fixed)
sizePolicy.setHorizontalStretch(0)
sizePolicy.setVerticalStretch(0)
sizePolicy.setHeightForWidth(self.btn_box.sizePolicy().hasHeightForWidth())
self.btn_box.setSizePolicy(sizePolicy)
self.btn_box.setFrameShape(QtGui.QFrame.StyledPanel)
self.btn_box.setFrameShadow(QtGui.QFrame.Raised)
self.btn_box.setObjectName("btn_box")
self.horizontalLayout = QtGui.QHBoxLayout(self.btn_box)
self.horizontalLayout.setContentsMargins(0, 0, 0, 0)
self.horizontalLayout.setObjectName("horizontalLayout")
self.about_qt_btn = QtGui.QPushButton(self.btn_box)
self.about_qt_btn.setObjectName("about_qt_btn")
self.horizontalLayout.addWidget(self.about_qt_btn)
spacerItem = QtGui.QSpacerItem(92, 20, QtGui.QSizePolicy.Expanding, QtGui.QSizePolicy.Minimum)
self.horizontalLayout.addItem(spacerItem)
self.updates_btn = QtGui.QPushButton(self.btn_box)
self.updates_btn.setObjectName("updates_btn")
self.horizontalLayout.addWidget(self.updates_btn)
spacerItem1 = QtGui.QSpacerItem(40, 20, QtGui.QSizePolicy.Expanding, QtGui.QSizePolicy.Minimum)
self.horizontalLayout.addItem(spacerItem1)
self.close_btn = QtGui.QPushButton(self.btn_box)
self.close_btn.setObjectName("close_btn")
self.horizontalLayout.addWidget(self.close_btn)
self.verticalLayout.addWidget(self.btn_box)

self.retranslateUi(About)
self.about_tabs.setCurrentIndex(0)
QtCore.QObject.connect(self.close_btn, QtCore.SIGNAL("clicked()"), About.close)
QtCore.QMetaObject.connectSlotsByName(About)

def retranslateUi(self, About):
About.setWindowTitle(QtGui.QApplication.translate("About", "About KoHighlights", None, QtGui.QApplication.UnicodeUTF8))
self.about_tabs.setTabText(self.about_tabs.indexOf(self.info_tab), QtGui.QApplication.translate("About", "Information", None, QtGui.QApplication.UnicodeUTF8))
self.about_tabs.setTabText(self.about_tabs.indexOf(self.log_tab), QtGui.QApplication.translate("About", "Log", None, QtGui.QApplication.UnicodeUTF8))
self.about_qt_btn.setToolTip(QtGui.QApplication.translate("About", "Check online for an updated version", None, QtGui.QApplication.UnicodeUTF8))
self.about_qt_btn.setText(QtGui.QApplication.translate("About", "About Qt", None, QtGui.QApplication.UnicodeUTF8))
self.updates_btn.setToolTip(QtGui.QApplication.translate("About", "Check online for an updated version", None, QtGui.QApplication.UnicodeUTF8))
self.updates_btn.setText(QtGui.QApplication.translate("About", "Check for Updates", None, QtGui.QApplication.UnicodeUTF8))
self.close_btn.setText(QtGui.QApplication.translate("About", "Close", None, QtGui.QApplication.UnicodeUTF8))

import images_rc
94 changes: 47 additions & 47 deletions gui_auto_info.py
Original file line number Diff line number Diff line change
@@ -1,47 +1,47 @@
# -*- coding: utf-8 -*-

# Form implementation generated from reading ui file 'D:\Apps\DEV\PROJECTS\KoHighlights\gui_auto_info.ui'
#
# Created: Wed Oct 25 15:36:43 2017
# by: pyside-uic 0.2.15 running on PySide 1.2.4
#
# WARNING! All changes made in this file will be lost!

from PySide import QtCore, QtGui

class Ui_AutoInfo(object):
def setupUi(self, AutoInfo):
AutoInfo.setObjectName("AutoInfo")
AutoInfo.setWindowModality(QtCore.Qt.NonModal)
AutoInfo.resize(300, 100)
sizePolicy = QtGui.QSizePolicy(QtGui.QSizePolicy.Expanding, QtGui.QSizePolicy.Expanding)
sizePolicy.setHorizontalStretch(0)
sizePolicy.setVerticalStretch(0)
sizePolicy.setHeightForWidth(AutoInfo.sizePolicy().hasHeightForWidth())
AutoInfo.setSizePolicy(sizePolicy)
AutoInfo.setLocale(QtCore.QLocale(QtCore.QLocale.English, QtCore.QLocale.UnitedStates))
AutoInfo.setModal(True)
self.verticalLayout = QtGui.QVBoxLayout(AutoInfo)
self.verticalLayout.setContentsMargins(0, 0, 0, 0)
self.verticalLayout.setObjectName("verticalLayout")
self.label = QtGui.QLabel(AutoInfo)
sizePolicy = QtGui.QSizePolicy(QtGui.QSizePolicy.Expanding, QtGui.QSizePolicy.Expanding)
sizePolicy.setHorizontalStretch(0)
sizePolicy.setVerticalStretch(0)
sizePolicy.setHeightForWidth(self.label.sizePolicy().hasHeightForWidth())
self.label.setSizePolicy(sizePolicy)
self.label.setFrameShape(QtGui.QFrame.Box)
self.label.setFrameShadow(QtGui.QFrame.Raised)
self.label.setText("")
self.label.setTextFormat(QtCore.Qt.AutoText)
self.label.setAlignment(QtCore.Qt.AlignCenter)
self.label.setObjectName("label")
self.verticalLayout.addWidget(self.label)

self.retranslateUi(AutoInfo)
QtCore.QMetaObject.connectSlotsByName(AutoInfo)

def retranslateUi(self, AutoInfo):
AutoInfo.setWindowTitle(QtGui.QApplication.translate("AutoInfo", "Info", None, QtGui.QApplication.UnicodeUTF8))

import images_rc
# -*- coding: utf-8 -*-

# Form implementation generated from reading ui file 'D:\Apps\DEV\PROJECTS\KoHighlights\gui_auto_info.ui'
#
# Created: Wed Jun 06 03:09:10 2018
# by: pyside-uic 0.2.15 running on PySide 1.2.4
#
# WARNING! All changes made in this file will be lost!

from PySide import QtCore, QtGui

class Ui_AutoInfo(object):
def setupUi(self, AutoInfo):
AutoInfo.setObjectName("AutoInfo")
AutoInfo.setWindowModality(QtCore.Qt.NonModal)
AutoInfo.resize(300, 100)
sizePolicy = QtGui.QSizePolicy(QtGui.QSizePolicy.Expanding, QtGui.QSizePolicy.Expanding)
sizePolicy.setHorizontalStretch(0)
sizePolicy.setVerticalStretch(0)
sizePolicy.setHeightForWidth(AutoInfo.sizePolicy().hasHeightForWidth())
AutoInfo.setSizePolicy(sizePolicy)
AutoInfo.setLocale(QtCore.QLocale(QtCore.QLocale.English, QtCore.QLocale.UnitedStates))
AutoInfo.setModal(True)
self.verticalLayout = QtGui.QVBoxLayout(AutoInfo)
self.verticalLayout.setContentsMargins(0, 0, 0, 0)
self.verticalLayout.setObjectName("verticalLayout")
self.label = QtGui.QLabel(AutoInfo)
sizePolicy = QtGui.QSizePolicy(QtGui.QSizePolicy.Expanding, QtGui.QSizePolicy.Expanding)
sizePolicy.setHorizontalStretch(0)
sizePolicy.setVerticalStretch(0)
sizePolicy.setHeightForWidth(self.label.sizePolicy().hasHeightForWidth())
self.label.setSizePolicy(sizePolicy)
self.label.setFrameShape(QtGui.QFrame.Box)
self.label.setFrameShadow(QtGui.QFrame.Raised)
self.label.setText("")
self.label.setTextFormat(QtCore.Qt.AutoText)
self.label.setAlignment(QtCore.Qt.AlignCenter)
self.label.setObjectName("label")
self.verticalLayout.addWidget(self.label)

self.retranslateUi(AutoInfo)
QtCore.QMetaObject.connectSlotsByName(AutoInfo)

def retranslateUi(self, AutoInfo):
AutoInfo.setWindowTitle(QtGui.QApplication.translate("AutoInfo", "Info", None, QtGui.QApplication.UnicodeUTF8))

import images_rc
Loading

0 comments on commit f08e4a0

Please sign in to comment.