Skip to content

Commit

Permalink
Merge branch 'master' of github.com:peppy0510/PyWinSecure
Browse files Browse the repository at this point in the history
  • Loading branch information
peppy0510 committed Apr 22, 2019
2 parents bfd6140 + fd30e07 commit ba8d69f
Show file tree
Hide file tree
Showing 6 changed files with 27 additions and 107 deletions.
2 changes: 1 addition & 1 deletion makebuild.spec
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ Analysis = Analysis # noqa

__appname__ = 'PyWinSecure'
__default_python_path__ = 'C:\\Program Files\\Python36'
__api_ms_win_crt_path__ = 'C:\\Windows\\WinSxS\\amd64_microsoft-windows-m..namespace-downlevel_31bf3856ad364e35_10.0.17763.1_none_b82ac495d943b9d7'
__api_ms_win_crt_path__ = 'C:\\Windows\\WinSxS\\amd64_microsoft-windows-m..namespace-downlevel_31bf3856ad364e35_10.0.17134.1_none_ace56707ea44b3c5'


class Path():
Expand Down
10 changes: 5 additions & 5 deletions makeinstaller.iss
Original file line number Diff line number Diff line change
Expand Up @@ -2,19 +2,19 @@

[Setup]
AppName="PyWinSecure"
AppVerName="PyWinSecure 0.1.1"
AppVerName="PyWinSecure 0.1.2"
DefaultDirName="{pf}\PyWinSecure"
DefaultGroupName="PyWinSecure"
AppVersion="0.1.1"
AppVersion="0.1.2"
AppCopyright="Taehong Kim"
AppPublisher="Taehong Kim"
UninstallDisplayIcon="{app}\PyWinSecure.exe"
Compression=lzma2/max
SolidCompression=yes
OutputDir="dist"
OutputBaseFilename="PyWinSecure-0.1.1-Setup"
; VersionInfoVersion="0.1.1"
VersionInfoProductVersion="0.1.1"
OutputBaseFilename="PyWinSecure-0.1.2-Setup"
; VersionInfoVersion="0.1.2"
VersionInfoProductVersion="0.1.2"
VersionInfoCompany="Taehong Kim"
VersionInfoCopyright="Taehong Kim"
ArchitecturesInstallIn64BitMode="x64"
Expand Down
77 changes: 20 additions & 57 deletions source/main.pyw
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@


__appname__ = 'PyWinSecure'
__version__ = '0.1.1'
__version__ = '0.1.2'
__author__ = 'Taehong Kim'
__email__ = '[email protected]'
__license__ = ''
Expand All @@ -13,8 +13,6 @@ __doc__ = '''
import glob
import os
import subprocess
import sys
import threading
import wx

from icon import FrameIcon
Expand All @@ -23,8 +21,6 @@ from preference import Preference
from statusbar import StatusBar
from wininstance import kill_existing_instances
from winscreens import get_screens
# from wininstance import get_current_real_cwq
# threadListLock = threading.Lock()


class ListBoxListDnD(wx.FileDropTarget):
Expand All @@ -41,54 +37,33 @@ class ListBoxListDnD(wx.FileDropTarget):
if not os.path.isdir(path):
inpaths.pop(i)
continue
self.parent.debug_line('IMPORT: {}'.format(path))
self.parent.debug_line('{}'.format(path))
self.parent.FuncPanel.set_rootdirs(inpaths)
self.parent.set_status(' IMPORT FINISHED')
return 0


class SubprocessThread(threading.Thread):

def __init__(self, command):
self.command = command
self.stdout = None
self.stderr = None
threading.Thread.__init__(self)

def run(self):
p = subprocess.Popen(self.command,
shell=True,
stdout=subprocess.PIPE,
stderr=subprocess.PIPE)
self.stdout, self.stderr = p.communicate()


class FuncPanel(wx.Panel):

def __init__(self, parent):
wx.Panel.__init__(self, parent=parent)
self.parent = parent
self.rootdirs = []
# self.Tool = FuncPanelTool(self)
# self.Bind(wx.EVT_SIZE, self.OnSize)

font = wx.Font(10, wx.DEFAULT, wx.NORMAL, wx.BOLD)

self.ShowButton = wx.Button(self, id=wx.ID_ANY, label="Show", pos=wx.DefaultPosition,
size=wx.DefaultSize, style=0, validator=wx.DefaultValidator,
name=wx.ButtonNameStr)

self.ShowButton.Bind(wx.EVT_BUTTON, self.OnShowButton)
self.ShowButton = wx.Button(self, id=wx.ID_ANY, label='Show')
self.ShowButton.SetFont(font)
self.ShowButton.SetRect((4, 5, 120, 35))
self.ShowButton.Bind(wx.EVT_BUTTON, self.OnShowButton)

self.HideButton = wx.Button(self, id=wx.ID_ANY, label="Hide", pos=wx.DefaultPosition,
size=wx.DefaultSize, style=0, validator=wx.DefaultValidator,
name=wx.ButtonNameStr)
self.HideButton.Bind(wx.EVT_BUTTON, self.OnHideButton)
self.HideButton = wx.Button(self, id=wx.ID_ANY, label='Hide')
self.HideButton.SetFont(font)

self.HideButton.SetRect((127, 5, 120, 35))
self.HideButton.Bind(wx.EVT_BUTTON, self.OnHideButton)

def subprocess(self, command):
subprocess.call(command, shell=True)

def OnShowButton(self, event):
self.parent.init_debug()
Expand All @@ -98,15 +73,11 @@ class FuncPanel(wx.Panel):
self.parent.set_status('NO DIRECTORIES HAS BEEN SET')
return
self.parent.set_status('SHOW ...')

for v in pathparams:
command = 'attrib -s -h "%s"' % (v)
command = 'attrib -s -h "{}"'.format(v)
self.parent.debug_line('{}'.format(v))
proc = SubprocessThread(command)
# myclass = MyClass()
proc.start()
proc.join()
# proc = subprocess.Popen(command, stdout=subprocess.PIPE)
# proc.communicate()
self.subprocess(command)
self.parent.set_status('SHOW FINISHED')

def OnHideButton(self, event):
Expand All @@ -119,13 +90,9 @@ class FuncPanel(wx.Panel):
self.parent.set_status('HIDE ...')

for v in pathparams:
command = 'attrib +s +h "%s"' % (v)
command = 'attrib +s +h "{}"'.format(v)
self.parent.debug_line('{}'.format(v))
proc = SubprocessThread(command)
proc.start()
proc.join()
# proc = subprocess.Popen(command, stdout=subprocess.PIPE)
# proc.communicate()
self.subprocess(command)
self.parent.set_status('HIDE FINISHED')

def set_rootdirs(self, rootdirs):
Expand Down Expand Up @@ -161,8 +128,6 @@ class DebugPanel(wx.TextCtrl):
self.parent = parent
self.SetCursor(wx.Cursor(wx.CURSOR_ARROW))
self.SetMargins(left=5)
# self.SetMargins(left=5, top=50)
# wx.CURSOR_ARROWWAIT | wx.CURSOR_WAIT


class MainFrame(wx.Frame, Preference, FrameIcon, MenuBar, StatusBar):
Expand All @@ -176,17 +141,17 @@ class MainFrame(wx.Frame, Preference, FrameIcon, MenuBar, StatusBar):
self.defaultStyle = wx.CLIP_CHILDREN | wx.FRAME_SHAPED | wx.MINIMIZE_BOX |\
wx.MAXIMIZE_BOX | wx.SYSTEM_MENU | wx.CLOSE_BOX | wx.CAPTION |\
wx.RESIZE_BORDER | wx.TAB_TRAVERSAL | wx.BORDER_DEFAULT
wx.Frame.__init__(self, parent, id=wx.ID_ANY, pos=wx.DefaultPosition,
size=wx.Size(300, 300), style=self.defaultStyle)
# 268

wx.Frame.__init__(self, parent, id=wx.ID_ANY)
Preference.__init__(self)
FrameIcon.__init__(self)
MenuBar.__init__(self)
StatusBar.__init__(self)

self.SetTitle(self.__appname__)
self.SetMinSize((300, 300))
self.SetMinSize((268, 300))
self.SetMaxSize((-1, -1))
self.SetSize((350, 300))
# self.SetWindowStyle(self.defaultStyle | wx.STAY_ON_TOP)
self.SetWindowStyle(self.defaultStyle)
w, h = self.GetSize()
Expand All @@ -210,11 +175,12 @@ class MainFrame(wx.Frame, Preference, FrameIcon, MenuBar, StatusBar):
finish_y = min([v.finish.y for v in screens])
if x + margin < finish_x and y + margin < finish_y:
self.SetSize(size)
self.SetPosition(position) # print('Enabled', style)
self.SetPosition(position)

alwaysontop = self.get_preference('alwaysontop')
alwaysontop = True if alwaysontop is None else alwaysontop
self.SetAlwaysOnTopValue(alwaysontop)
self.Update()
self.Show()

def init_debug(self):
Expand All @@ -237,11 +203,8 @@ class MainFrame(wx.Frame, Preference, FrameIcon, MenuBar, StatusBar):
self.FuncPanel.SetSize(width, split)
self.DebugPanel.SetPosition((0, split))
self.DebugPanel.SetSize(width, height - split)
# self.StatusBar.SetSize(width, 30)
# self.StatusBar.SetStatusWidths([width])

def OnClose(self, event=None):
# print(self.GetScreenPosition())
self.set_preference('size', list(self.GetClientSize()))
self.set_preference('position', list(self.GetScreenPosition()))
self.set_preference('alwaysontop', self.AlwaysOnTopMenuItem.IsChecked())
Expand Down
7 changes: 0 additions & 7 deletions source/menubar.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,13 +30,6 @@ def make_menuitem(label, menu, bind=None, kind=wx.ITEM_NORMAL):
SettingsMenu = wx.Menu()
self.AlwaysOnTopMenuItem = make_menuitem(
'Always on top', SettingsMenu, self.OnAlwaysOnTopToggle, kind=wx.ITEM_CHECK)

# SettingsMenu.AppendSeparator()
# self.AutoClearWhenImportMenuItem = make_menuitem('Auto clear when import', SettingsMenu, None)
# self.AutoClearWhenImportMenuItem.Check(True)
# self.AutoClearWhenBatchPrecessingMenuItem = make_menuitem(
# 'Auto clear after batch processing', SettingsMenu, None)
# self.AutoClearWhenBatchPrecessingMenuItem.Check(True)
MenuBar.Append(SettingsMenu, '&Settings')

HelpMenu = wx.Menu()
Expand Down
3 changes: 0 additions & 3 deletions source/preference.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,10 +16,7 @@ class Preference():
def __init__(self):
self.preference_dir = os.path.join(
os.path.expanduser('~'), 'AppData', 'Local', self.__appname__)
# self.preference_dir = os.path.join(
# os.path.expanduser('~'), 'Documents', self.__appname__)
self.preference_path = os.path.join(self.preference_dir, 'settings.json')
# print(self.preference_path)

def get_preference(self, key):
if os.path.exists(self.preference_path):
Expand Down
35 changes: 1 addition & 34 deletions source/statusbar.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,49 +10,16 @@
import wx


# class StatusPanel(wx.StatusBar):

# def __init__(self, parent):
# wx.StatusBar.__init__(self, parent, -1)
# self.parent = parent
# self.LeftText = wx.StaticText(self, -1, '')
# self.Bind(wx.EVT_SIZE, self.OnSize)

# def OnSize(self, event):
# margin = 4
# w, h = self.GetClientSize()
# self.LeftText.SetRect((margin, margin, w / 2 - margin * 2, h - margin * 2))


# class StatusBar():

# def __init__(self):
# self.StatusBar = StatusPanel(self)
# self.SetStatusBar(self.StatusBar)


class StatusPanel(wx.StatusBar):

def __init__(self, parent):
wx.StatusBar.__init__(self, parent, -1)
self.parent = parent
# self.Text = wx.StaticText(self, -1, '')
# self.Bind(wx.EVT_SIZE, self.OnSize)

# def OnSize(self, event):
# margin = 4
# w, h = self.GetClientSize()
# self.Text.SetRect((margin, margin, w - margin * 2, h - margin * 2))
# # self.Text.SetRect((margin, margin, w / 2 - margin * 2, h - margin * 2))
self.SetFieldsCount(1)


class StatusBar():

def __init__(self):
self.StatusBar = StatusPanel(self)
# print(dir(self.StatusBar))
self.StatusBar.SetFieldsCount(1)
# self.StatusBar.GetStatusWidth(0)
# self.StatusBar.SetMinHeight(40)
# self.StatusBar.SetStatusWidths([200])
self.SetStatusBar(self.StatusBar)

0 comments on commit ba8d69f

Please sign in to comment.