Skip to content
This repository has been archived by the owner on Jan 3, 2024. It is now read-only.

add warning when recent comic does not exist #86

Merged
merged 2 commits into from
Oct 4, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
102 changes: 102 additions & 0 deletions forms/not_found_dialog.ui
Original file line number Diff line number Diff line change
@@ -0,0 +1,102 @@
<?xml version="1.0" encoding="UTF-8"?>
<ui version="4.0">
<class>NotFoundDialog</class>
<widget class="QDialog" name="NotFoundDialog">
<property name="windowModality">
<enum>Qt::ApplicationModal</enum>
</property>
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>506</width>
<height>363</height>
</rect>
</property>
<property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="Preferred">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="windowTitle">
<string>File not found</string>
</property>
<property name="windowIcon">
<iconset resource="../data/main_window_view.qrc">
<normaloff>:/others/pynocchio.png</normaloff>:/others/pynocchio.png</iconset>
</property>
<property name="locale">
<locale language="English" country="UnitedStates"/>
</property>
<property name="modal">
<bool>true</bool>
</property>
<layout class="QVBoxLayout" name="verticalLayout">
<item>
<widget class="QLabel" name="not_found_text_label">
<property name="sizePolicy">
<sizepolicy hsizetype="Expanding" vsizetype="Expanding">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="text">
<string>The file was not found</string>
</property>
<property name="alignment">
<set>Qt::AlignCenter</set>
</property>
</widget>
</item>
<item>
<layout class="QHBoxLayout" name="horizontalLayout">
<item>
<widget class="QPushButton" name="button_close">
<property name="sizePolicy">
<sizepolicy hsizetype="Maximum" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="text">
<string>Close</string>
</property>
<property name="icon">
<iconset>
<normaloff>:/icons/icons/edit-delete.svg</normaloff>:/icons/icons/edit-delete.svg</iconset>
</property>
<property name="default">
<bool>true</bool>
</property>
<property name="flat">
<bool>false</bool>
</property>
</widget>
</item>
</layout>
</item>
</layout>
</widget>
<resources>
<include location="../data/main_window_view.qrc"/>
</resources>
<connections>
<connection>
<sender>button_close</sender>
<signal>clicked()</signal>
<receiver>NotFoundDialog</receiver>
<slot>close()</slot>
<hints>
<hint type="sourcelabel">
<x>271</x>
<y>337</y>
</hint>
<hint type="destinationlabel">
<x>271</x>
<y>180</y>
</hint>
</hints>
</connection>
</connections>
</ui>
2 changes: 1 addition & 1 deletion pynocchio.pro
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
SOURCES = pynocchio/main_window_view.py pynocchio/bookmark_manager_dialog.py pynocchio/go_to_page_dialog.py pynocchio/preference_dialog.py pynocchio/uic_files/custom_widgets/status_bar.py

FORMS = forms/about_dialog.ui forms/bookmark_manager_dialog.ui forms/go_to_page_dialog.ui forms/preference_dialog.ui forms/main_window_view.ui
FORMS = forms/about_dialog.ui forms/not_found_dialog.ui forms/bookmark_manager_dialog.ui forms/go_to_page_dialog.ui forms/preference_dialog.ui forms/main_window_view.ui

TRANSLATIONS = en-US.ts es.ts fi-FI.ts fr-FR.ts nl-NL.ts pl-PL.ts pt-BR.ts pt-PT.ts tr-TR.ts

Expand Down
4 changes: 4 additions & 0 deletions pynocchio/main_window_view.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
from .bookmark_manager_dialog import BookmarkManagerDialog
from .bookmark import TemporaryBookmark
from .about_dialog import AboutDialog
from .not_found_dialog import NotFoundDialog
from .uic_files import main_window_view_ui

logging.basicConfig(level=logging.INFO)
Expand Down Expand Up @@ -421,6 +422,9 @@ def open_recent_file(self):
files.remove(filename)
self.model.save_recent_files(files)
self.update_recent_file_actions()
not_found_dialog = NotFoundDialog(self)
not_found_dialog.show()
not_found_dialog.exec_()

def set_current_file(self, filename):

Expand Down
12 changes: 12 additions & 0 deletions pynocchio/not_found_dialog.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
# -*- coding: utf-8 -*-

from PyQt5 import QtWidgets
from .uic_files import not_found_dialog_ui


class NotFoundDialog(QtWidgets.QDialog):

def __init__(self, parent=None):
super(NotFoundDialog, self).__init__(parent=parent)
self.ui = not_found_dialog_ui.Ui_NotFoundDialog()
self.ui.setupUi(self)
64 changes: 64 additions & 0 deletions pynocchio/uic_files/not_found_dialog_ui.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,64 @@
# -*- coding: utf-8 -*-

# Form implementation generated from reading ui file 'forms/not_found_dialog.ui'
#
# Created by: PyQt5 UI code generator 5.11.2
#
# WARNING! All changes made in this file will be lost!

from PyQt5 import QtCore, QtGui, QtWidgets

class Ui_NotFoundDialog(object):
def setupUi(self, NotFoundDialog):
NotFoundDialog.setObjectName("NotFoundDialog")
NotFoundDialog.setWindowModality(QtCore.Qt.ApplicationModal)
NotFoundDialog.resize(506, 363)
sizePolicy = QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.Preferred, QtWidgets.QSizePolicy.Preferred)
sizePolicy.setHorizontalStretch(0)
sizePolicy.setVerticalStretch(0)
sizePolicy.setHeightForWidth(NotFoundDialog.sizePolicy().hasHeightForWidth())
NotFoundDialog.setSizePolicy(sizePolicy)
icon = QtGui.QIcon()
icon.addPixmap(QtGui.QPixmap(":/others/pynocchio.png"), QtGui.QIcon.Normal, QtGui.QIcon.Off)
NotFoundDialog.setWindowIcon(icon)
NotFoundDialog.setLocale(QtCore.QLocale(QtCore.QLocale.English, QtCore.QLocale.UnitedStates))
NotFoundDialog.setModal(True)
self.verticalLayout = QtWidgets.QVBoxLayout(NotFoundDialog)
self.verticalLayout.setObjectName("verticalLayout")
self.not_found_text_label = QtWidgets.QLabel(NotFoundDialog)
sizePolicy = QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.Expanding, QtWidgets.QSizePolicy.Expanding)
sizePolicy.setHorizontalStretch(0)
sizePolicy.setVerticalStretch(0)
sizePolicy.setHeightForWidth(self.not_found_text_label.sizePolicy().hasHeightForWidth())
self.not_found_text_label.setSizePolicy(sizePolicy)
self.not_found_text_label.setAlignment(QtCore.Qt.AlignCenter)
self.not_found_text_label.setObjectName("not_found_text_label")
self.verticalLayout.addWidget(self.not_found_text_label)
self.horizontalLayout = QtWidgets.QHBoxLayout()
self.horizontalLayout.setObjectName("horizontalLayout")
self.button_close = QtWidgets.QPushButton(NotFoundDialog)
sizePolicy = QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.Maximum, QtWidgets.QSizePolicy.Fixed)
sizePolicy.setHorizontalStretch(0)
sizePolicy.setVerticalStretch(0)
sizePolicy.setHeightForWidth(self.button_close.sizePolicy().hasHeightForWidth())
self.button_close.setSizePolicy(sizePolicy)
icon1 = QtGui.QIcon()
icon1.addPixmap(QtGui.QPixmap(":/icons/icons/edit-delete.svg"), QtGui.QIcon.Normal, QtGui.QIcon.Off)
self.button_close.setIcon(icon1)
self.button_close.setDefault(True)
self.button_close.setFlat(False)
self.button_close.setObjectName("button_close")
self.horizontalLayout.addWidget(self.button_close)
self.verticalLayout.addLayout(self.horizontalLayout)

self.retranslateUi(NotFoundDialog)
self.button_close.clicked.connect(NotFoundDialog.close)
QtCore.QMetaObject.connectSlotsByName(NotFoundDialog)

def retranslateUi(self, NotFoundDialog):
_translate = QtCore.QCoreApplication.translate
NotFoundDialog.setWindowTitle(_translate("NotFoundDialog", "File not found"))
self.not_found_text_label.setText(_translate("NotFoundDialog", "The file was not found"))
self.button_close.setText(_translate("NotFoundDialog", "Close"))

from . import main_window_view_rc
2 changes: 1 addition & 1 deletion tox.ini
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ commands =
[testenv:flake8]
basepython=python
deps=flake8
commands=flake8 pynocchio --exclude=.git,__pycache__,pynocchio/uic_files/go_to_page_dialog_ui.py,pynocchio/uic_files/main_window_view_rc.py,pynocchio/uic_files/preference_dialog_ui.py,pynocchio/uic_files/bookmark_manager_dialog_ui.py,pynocchio/uic_files/about_dialog_ui.py,pynocchio/uic_files/main_window_view_ui.py,pynocchio/uic_files/style_rc.py
commands=flake8 pynocchio --exclude=.git,__pycache__,pynocchio/uic_files/go_to_page_dialog_ui.py,pynocchio/uic_files/main_window_view_rc.py,pynocchio/uic_files/preference_dialog_ui.py,pynocchio/uic_files/bookmark_manager_dialog_ui.py,pynocchio/uic_files/about_dialog_ui.py,pynocchio/uic_files/not_found_dialog_ui.py,pynocchio/uic_files/main_window_view_ui.py,pynocchio/uic_files/style_rc.py

[testenv]
setenv =
Expand Down