Skip to content

Commit

Permalink
Fix mypy errors
Browse files Browse the repository at this point in the history
  • Loading branch information
lovetox committed Jun 3, 2020
1 parent 21c6be6 commit e192882
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 12 deletions.
11 changes: 6 additions & 5 deletions gajim/gtk/filechoosers.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,8 @@
# You should have received a copy of the GNU General Public License
# along with Gajim. If not, see <http://www.gnu.org/licenses/>.

from typing import List

import os
import sys
from pathlib import Path
Expand All @@ -27,7 +29,6 @@
from gajim.common.i18n import _

from gajim.gtk.const import Filter
from gajim.gtk.types import FilterList # pylint: disable=unused-import


def _require_native() -> bool:
Expand Down Expand Up @@ -85,7 +86,7 @@ def _update_preview(self, filechooser):
class BaseFileOpenDialog:

_title = _('Choose File to Send…')
_filters = [Filter(_('All files'), '*', True)] # type: FilterList
_filters = [Filter(_('All files'), '*', True)]


class BaseAvatarChooserDialog:
Expand All @@ -96,7 +97,7 @@ class BaseAvatarChooserDialog:
if _require_native():
_filters = [Filter(_('PNG files'), '*.png', True),
Filter(_('JPEG files'), '*.jp*g', False),
Filter(_('SVG files'), '*.svg', False)] # type: FilterList
Filter(_('SVG files'), '*.svg', False)]
else:
_filters = [Filter(_('Images'), ['image/png',
'image/jpeg',
Expand All @@ -106,7 +107,7 @@ class BaseAvatarChooserDialog:
class NativeFileChooserDialog(Gtk.FileChooserNative, BaseFileChooser):

_title = ''
_filters = [] # type: FilterList
_filters: List[Filter] = []
_action = Gtk.FileChooserAction.OPEN

def __init__(self, accept_cb, cancel_cb=None, transient_for=None,
Expand Down Expand Up @@ -158,7 +159,7 @@ class NativeAvatarChooserDialog(BaseAvatarChooserDialog, NativeFileChooserDialog
class GtkFileChooserDialog(Gtk.FileChooserDialog, BaseFileChooser):

_title = ''
_filters = [] # type: FilterList
_filters: List[Filter] = []
_action = Gtk.FileChooserAction.OPEN
_preivew_size = (200, 200)

Expand Down
7 changes: 0 additions & 7 deletions gajim/gtk/types.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,10 +13,3 @@
# along with Gajim. If not, see <http://www.gnu.org/licenses/>.

# Types for typechecking

from typing import ClassVar
from typing import List

from gajim.gtk.const import Filter

FilterList = ClassVar[List[Filter]]

0 comments on commit e192882

Please sign in to comment.