commit
f47eac5935
16 changed files with 476 additions and 44 deletions
59
appveyor.yml
Normal file
59
appveyor.yml
Normal file
|
@ -0,0 +1,59 @@
|
||||||
|
version: 1.0.{build}
|
||||||
|
|
||||||
|
init:
|
||||||
|
- ps: $env:Path += ";C:\MinGW\bin\"
|
||||||
|
- ps: gcc --version
|
||||||
|
- ps: mingw32-make --version
|
||||||
|
- ps: mkdir C:\temp
|
||||||
|
- ps: Invoke-WebRequest "https://pypi.python.org/packages/55/90/e987e28ed29b571f315afea7d317b6bf4a551e37386b344190cffec60e72/miniupnpc-1.9.tar.gz" -OutFile "C:\temp\miniupnpc-1.9.tar.gz"
|
||||||
|
- ps: cd C:\temp
|
||||||
|
- ps: 7z e miniupnpc-1.9.tar.gz
|
||||||
|
- ps: 7z x miniupnpc-1.9.tar
|
||||||
|
- ps: cd C:\temp\miniupnpc-1.9
|
||||||
|
- ps: |
|
||||||
|
mingw32-make.exe -f Makefile.mingw
|
||||||
|
C:\Python27\python.exe C:\temp\miniupnpc-1.9\setupmingw32.py build --compiler=mingw32
|
||||||
|
C:\Python27\python.exe C:\temp\miniupnpc-1.9\setupmingw32.py install
|
||||||
|
- ps: Invoke-WebRequest "https://github.com/lbryio/lbry/raw/master/packaging/windows/libs/gmpy-1.17-cp27-none-win32.whl" -OutFile "C:\temp\gmpy-1.17-cp27-none-win32.whl"
|
||||||
|
- ps: C:\Python27\Scripts\pip.exe install "C:\temp\gmpy-1.17-cp27-none-win32.whl"
|
||||||
|
- ps: C:\Python27\Scripts\pip.exe install pypiwin32==219
|
||||||
|
- ps: C:\Python27\Scripts\pip.exe install six==1.9.0
|
||||||
|
- ps: C:\Python27\Scripts\pip.exe install requests==2.9.1
|
||||||
|
- ps: C:\Python27\Scripts\pip.exe install zope.interface==4.1.3
|
||||||
|
- ps: C:\Python27\Scripts\pip.exe install cx-freeze==4.3.3
|
||||||
|
- ps: C:\Python27\Scripts\pip.exe install cython==0.24.1
|
||||||
|
- ps: C:\Python27\Scripts\pip.exe install Twisted==16.0.0
|
||||||
|
- ps: C:\Python27\Scripts\pip.exe install Yapsy==1.11.223
|
||||||
|
- ps: C:\Python27\Scripts\pip.exe install appdirs==1.4.0
|
||||||
|
- ps: C:\Python27\Scripts\pip.exe install argparse==1.2.1
|
||||||
|
- ps: C:\Python27\Scripts\pip.exe install colorama==0.3.7
|
||||||
|
- ps: C:\Python27\Scripts\pip.exe install dnspython==1.12.0
|
||||||
|
- ps: C:\Python27\Scripts\pip.exe install ecdsa==0.13
|
||||||
|
- ps: C:\Python27\Scripts\pip.exe install jsonrpc==1.2
|
||||||
|
- ps: C:\Python27\Scripts\pip.exe install jsonrpclib==0.1.7
|
||||||
|
- ps: C:\Python27\Scripts\pip.exe install loggly-python-handler==1.0.0
|
||||||
|
- ps: C:\Python27\Scripts\pip.exe install pbkdf2==1.3
|
||||||
|
- ps: C:\Python27\Scripts\pip.exe install protobuf==3.0.0
|
||||||
|
- ps: C:\Python27\Scripts\pip.exe install pycrypto==2.6.1
|
||||||
|
- ps: C:\Python27\Scripts\pip.exe install python-bitcoinrpc==0.1
|
||||||
|
- ps: C:\Python27\Scripts\pip.exe install qrcode==5.2.2
|
||||||
|
- ps: C:\Python27\Scripts\pip.exe install requests_futures==0.9.7
|
||||||
|
- ps: C:\Python27\Scripts\pip.exe install seccure==0.3.1.3
|
||||||
|
- ps: C:\Python27\Scripts\pip.exe install simplejson==3.8.2
|
||||||
|
- ps: C:\Python27\Scripts\pip.exe install slowaes==0.1a1
|
||||||
|
- ps: C:\Python27\Scripts\pip.exe install txJSON-RPC==0.3.1
|
||||||
|
- ps: C:\Python27\Scripts\pip.exe install unqlite==0.5.3
|
||||||
|
- ps: C:\Python27\Scripts\pip.exe install wsgiref==0.1.2
|
||||||
|
- ps: C:\Python27\Scripts\pip.exe install base58==0.2.2
|
||||||
|
- ps: C:\Python27\Scripts\pip.exe install googlefinance==0.7
|
||||||
|
- ps: C:\Python27\Scripts\pip.exe install git+https://github.com/lbryio/lbryum.git
|
||||||
|
- ps: cd C:\projects\lbry
|
||||||
|
|
||||||
|
build_script:
|
||||||
|
- cmd: C:\Python27\python.exe setup_win32.py build bdist_msi
|
||||||
|
|
||||||
|
artifacts:
|
||||||
|
- path: dist/*.msi
|
||||||
|
name: msi
|
||||||
|
- path: build/exe.win32-2.7/
|
||||||
|
name: lbry-portable
|
|
@ -1,6 +1,7 @@
|
||||||
"""
|
"""
|
||||||
Some network wide and also application specific parameters
|
Some network wide and also application specific parameters
|
||||||
"""
|
"""
|
||||||
|
import os
|
||||||
|
|
||||||
|
|
||||||
MAX_HANDSHAKE_SIZE = 2**16
|
MAX_HANDSHAKE_SIZE = 2**16
|
||||||
|
@ -38,7 +39,10 @@ CRYPTSD_FILE_EXTENSION = ".cryptsd"
|
||||||
API_INTERFACE = "localhost"
|
API_INTERFACE = "localhost"
|
||||||
API_ADDRESS = "lbryapi"
|
API_ADDRESS = "lbryapi"
|
||||||
API_PORT = 5279
|
API_PORT = 5279
|
||||||
ICON_PATH = "app.icns"
|
if os.name == "nt":
|
||||||
|
ICON_PATH = "icons"
|
||||||
|
else:
|
||||||
|
ICON_PATH = "app.icns"
|
||||||
APP_NAME = "LBRY"
|
APP_NAME = "LBRY"
|
||||||
API_CONNECTION_STRING = "http://%s:%i/%s" % (API_INTERFACE, API_PORT, API_ADDRESS)
|
API_CONNECTION_STRING = "http://%s:%i/%s" % (API_INTERFACE, API_PORT, API_ADDRESS)
|
||||||
UI_ADDRESS = "http://%s:%i" % (API_INTERFACE, API_PORT)
|
UI_ADDRESS = "http://%s:%i" % (API_INTERFACE, API_PORT)
|
||||||
|
|
|
@ -1,9 +1,12 @@
|
||||||
import logging
|
import logging
|
||||||
|
import os
|
||||||
|
|
||||||
|
|
||||||
def migrate_db(db_dir, start, end):
|
def migrate_db(db_dir, start, end):
|
||||||
current = start
|
current = start
|
||||||
old_dirs = []
|
old_dirs = []
|
||||||
|
if os.name == "nt":
|
||||||
|
return old_dirs
|
||||||
while current < end:
|
while current < end:
|
||||||
if current == 0:
|
if current == 0:
|
||||||
from lbrynet.db_migrator.migrate0to1 import do_migration
|
from lbrynet.db_migrator.migrate0to1 import do_migration
|
||||||
|
|
|
@ -181,6 +181,11 @@ class LBRYDaemon(jsonrpc.JSONRPC):
|
||||||
from lbrynet.winhelpers.knownpaths import get_path, FOLDERID, UserHandle
|
from lbrynet.winhelpers.knownpaths import get_path, FOLDERID, UserHandle
|
||||||
default_download_directory = get_path(FOLDERID.Downloads, UserHandle.current)
|
default_download_directory = get_path(FOLDERID.Downloads, UserHandle.current)
|
||||||
self.db_dir = os.path.join(get_path(FOLDERID.RoamingAppData, UserHandle.current), "lbrynet")
|
self.db_dir = os.path.join(get_path(FOLDERID.RoamingAppData, UserHandle.current), "lbrynet")
|
||||||
|
try:
|
||||||
|
os.makedirs(self.db_dir)
|
||||||
|
except OSError:
|
||||||
|
if not os.path.isdir(self.db_dir):
|
||||||
|
raise
|
||||||
elif sys.platform == "darwin":
|
elif sys.platform == "darwin":
|
||||||
default_download_directory = os.path.join(os.path.expanduser("~"), 'Downloads')
|
default_download_directory = os.path.join(os.path.expanduser("~"), 'Downloads')
|
||||||
self.db_dir = user_data_dir("LBRY")
|
self.db_dir = user_data_dir("LBRY")
|
||||||
|
|
|
@ -31,6 +31,9 @@ log = logging.getLogger(__name__)
|
||||||
|
|
||||||
REMOTE_SERVER = "www.google.com"
|
REMOTE_SERVER = "www.google.com"
|
||||||
|
|
||||||
|
if getattr(sys, 'frozen', False) and os.name == "nt":
|
||||||
|
os.environ["REQUESTS_CA_BUNDLE"] = os.path.join(os.path.dirname(sys.executable), "cacert.pem")
|
||||||
|
|
||||||
|
|
||||||
def test_internet_connection():
|
def test_internet_connection():
|
||||||
try:
|
try:
|
||||||
|
|
|
@ -377,7 +377,15 @@ class LBRYFileUpload(resource.Resource):
|
||||||
# Move to a new temporary dir and restore the original file name
|
# Move to a new temporary dir and restore the original file name
|
||||||
newdirpath = tempfile.mkdtemp()
|
newdirpath = tempfile.mkdtemp()
|
||||||
newpath = os.path.join(newdirpath, origfilename)
|
newpath = os.path.join(newdirpath, origfilename)
|
||||||
shutil.move(uploaded_file.name, newpath)
|
if os.name == "nt":
|
||||||
|
shutil.copy(uploaded_file.name, newpath)
|
||||||
|
# TODO Still need to remove the file
|
||||||
|
try:
|
||||||
|
os.remove(uploaded_file.name)
|
||||||
|
except WindowsError as e:
|
||||||
|
pass
|
||||||
|
else:
|
||||||
|
shutil.move(uploaded_file.name, newpath)
|
||||||
self._api.uploaded_temp_files.append(newpath)
|
self._api.uploaded_temp_files.append(newpath)
|
||||||
|
|
||||||
return json.dumps(newpath)
|
return json.dumps(newpath)
|
||||||
|
|
|
@ -57,9 +57,14 @@ class Publisher(object):
|
||||||
self.bid_amount = bid
|
self.bid_amount = bid
|
||||||
self.metadata = metadata
|
self.metadata = metadata
|
||||||
|
|
||||||
|
if os.name == "nt":
|
||||||
|
file_mode = 'rb'
|
||||||
|
else:
|
||||||
|
file_mode = 'r'
|
||||||
|
|
||||||
d = self._check_file_path(self.file_path)
|
d = self._check_file_path(self.file_path)
|
||||||
d.addCallback(lambda _: create_lbry_file(self.session, self.lbry_file_manager,
|
d.addCallback(lambda _: create_lbry_file(self.session, self.lbry_file_manager,
|
||||||
self.file_name, open(self.file_path)))
|
self.file_name, open(self.file_path, file_mode)))
|
||||||
d.addCallback(self.add_to_lbry_files)
|
d.addCallback(self.add_to_lbry_files)
|
||||||
d.addCallback(lambda _: self._create_sd_blob())
|
d.addCallback(lambda _: self._create_sd_blob())
|
||||||
d.addCallback(lambda _: self._claim_name())
|
d.addCallback(lambda _: self._claim_name())
|
||||||
|
|
287
packaging/windows/lbry-win32-app/LBRYWin32App.py
Normal file
287
packaging/windows/lbry-win32-app/LBRYWin32App.py
Normal file
|
@ -0,0 +1,287 @@
|
||||||
|
import logging
|
||||||
|
import os
|
||||||
|
import socket
|
||||||
|
import sys
|
||||||
|
import threading
|
||||||
|
import webbrowser
|
||||||
|
|
||||||
|
from twisted.internet import reactor, error
|
||||||
|
from twisted.web import server
|
||||||
|
import win32api
|
||||||
|
import win32con
|
||||||
|
import win32gui_struct
|
||||||
|
|
||||||
|
try:
|
||||||
|
import winxpgui as win32gui
|
||||||
|
except ImportError:
|
||||||
|
import win32gui
|
||||||
|
|
||||||
|
from lbrynet.lbrynet_daemon.LBRYDaemonServer import LBRYDaemonServer, LBRYDaemonRequest
|
||||||
|
from lbrynet.conf import API_PORT, API_INTERFACE, ICON_PATH, APP_NAME
|
||||||
|
from lbrynet.conf import UI_ADDRESS
|
||||||
|
|
||||||
|
|
||||||
|
if getattr(sys, 'frozen', False) and os.name == "nt":
|
||||||
|
os.environ["REQUESTS_CA_BUNDLE"] = os.path.join(os.path.dirname(sys.executable), "cacert.pem")
|
||||||
|
|
||||||
|
log = logging.getLogger(__name__)
|
||||||
|
|
||||||
|
REMOTE_SERVER = "www.google.com"
|
||||||
|
|
||||||
|
|
||||||
|
def test_internet_connection():
|
||||||
|
try:
|
||||||
|
host = socket.gethostbyname(REMOTE_SERVER)
|
||||||
|
s = socket.create_connection((host, 80), 2)
|
||||||
|
return True
|
||||||
|
except:
|
||||||
|
return False
|
||||||
|
|
||||||
|
|
||||||
|
def non_string_iterable(obj):
|
||||||
|
try:
|
||||||
|
iter(obj)
|
||||||
|
except TypeError:
|
||||||
|
return False
|
||||||
|
else:
|
||||||
|
return not isinstance(obj, basestring)
|
||||||
|
|
||||||
|
|
||||||
|
class SysTrayIcon(object):
|
||||||
|
"""TODO"""
|
||||||
|
QUIT = 'QUIT'
|
||||||
|
SPECIAL_ACTIONS = [QUIT]
|
||||||
|
|
||||||
|
FIRST_ID = 1023
|
||||||
|
|
||||||
|
def __init__(self,
|
||||||
|
icon,
|
||||||
|
hover_text,
|
||||||
|
menu_options,
|
||||||
|
on_quit=None,
|
||||||
|
default_menu_index=None,
|
||||||
|
window_class_name=None, ):
|
||||||
|
|
||||||
|
self.icon = icon
|
||||||
|
self.hover_text = hover_text
|
||||||
|
self.on_quit = on_quit
|
||||||
|
|
||||||
|
menu_options = menu_options + (('Quit', None, self.QUIT),)
|
||||||
|
self._next_action_id = self.FIRST_ID
|
||||||
|
self.menu_actions_by_id = set()
|
||||||
|
self.menu_options = self._add_ids_to_menu_options(list(menu_options))
|
||||||
|
self.menu_actions_by_id = dict(self.menu_actions_by_id)
|
||||||
|
del self._next_action_id
|
||||||
|
|
||||||
|
self.default_menu_index = (default_menu_index or 0)
|
||||||
|
self.window_class_name = window_class_name or "SysTrayIconPy"
|
||||||
|
|
||||||
|
message_map = {win32gui.RegisterWindowMessage("TaskbarCreated"): self.restart,
|
||||||
|
win32con.WM_DESTROY: self.destroy,
|
||||||
|
win32con.WM_COMMAND: self.command,
|
||||||
|
win32con.WM_USER + 20: self.notify,}
|
||||||
|
# Register the Window class.
|
||||||
|
window_class = win32gui.WNDCLASS()
|
||||||
|
hinst = window_class.hInstance = win32gui.GetModuleHandle(None)
|
||||||
|
window_class.lpszClassName = self.window_class_name
|
||||||
|
window_class.style = win32con.CS_VREDRAW | win32con.CS_HREDRAW;
|
||||||
|
window_class.hCursor = win32gui.LoadCursor(0, win32con.IDC_ARROW)
|
||||||
|
window_class.hbrBackground = win32con.COLOR_WINDOW
|
||||||
|
window_class.lpfnWndProc = message_map # could also specify a wndproc.
|
||||||
|
classAtom = win32gui.RegisterClass(window_class)
|
||||||
|
# Create the Window.
|
||||||
|
style = win32con.WS_OVERLAPPED | win32con.WS_SYSMENU
|
||||||
|
self.hwnd = win32gui.CreateWindow(classAtom,
|
||||||
|
self.window_class_name,
|
||||||
|
style,
|
||||||
|
0,
|
||||||
|
0,
|
||||||
|
win32con.CW_USEDEFAULT,
|
||||||
|
win32con.CW_USEDEFAULT,
|
||||||
|
0,
|
||||||
|
0,
|
||||||
|
hinst,
|
||||||
|
None)
|
||||||
|
win32gui.UpdateWindow(self.hwnd)
|
||||||
|
self.notify_id = None
|
||||||
|
self.refresh_icon()
|
||||||
|
|
||||||
|
win32gui.PumpMessages()
|
||||||
|
|
||||||
|
def _add_ids_to_menu_options(self, menu_options):
|
||||||
|
result = []
|
||||||
|
for menu_option in menu_options:
|
||||||
|
option_text, option_icon, option_action = menu_option
|
||||||
|
if callable(option_action) or option_action in self.SPECIAL_ACTIONS:
|
||||||
|
self.menu_actions_by_id.add((self._next_action_id, option_action))
|
||||||
|
result.append(menu_option + (self._next_action_id,))
|
||||||
|
elif non_string_iterable(option_action):
|
||||||
|
result.append((option_text,
|
||||||
|
option_icon,
|
||||||
|
self._add_ids_to_menu_options(option_action),
|
||||||
|
self._next_action_id))
|
||||||
|
else:
|
||||||
|
print 'Unknown item', option_text, option_icon, option_action
|
||||||
|
self._next_action_id += 1
|
||||||
|
return result
|
||||||
|
|
||||||
|
def refresh_icon(self):
|
||||||
|
# Try and find a custom icon
|
||||||
|
hinst = win32gui.GetModuleHandle(None)
|
||||||
|
if os.path.isfile(self.icon):
|
||||||
|
icon_flags = win32con.LR_LOADFROMFILE | win32con.LR_DEFAULTSIZE
|
||||||
|
hicon = win32gui.LoadImage(hinst,
|
||||||
|
self.icon,
|
||||||
|
win32con.IMAGE_ICON,
|
||||||
|
0,
|
||||||
|
0,
|
||||||
|
icon_flags)
|
||||||
|
else:
|
||||||
|
print "Can't find icon file - using default."
|
||||||
|
hicon = win32gui.LoadIcon(0, win32con.IDI_APPLICATION)
|
||||||
|
|
||||||
|
if self.notify_id:
|
||||||
|
message = win32gui.NIM_MODIFY
|
||||||
|
else:
|
||||||
|
message = win32gui.NIM_ADD
|
||||||
|
self.notify_id = (self.hwnd,
|
||||||
|
0,
|
||||||
|
win32gui.NIF_ICON | win32gui.NIF_MESSAGE | win32gui.NIF_TIP,
|
||||||
|
win32con.WM_USER + 20,
|
||||||
|
hicon,
|
||||||
|
self.hover_text)
|
||||||
|
win32gui.Shell_NotifyIcon(message, self.notify_id)
|
||||||
|
|
||||||
|
def restart(self, hwnd, msg, wparam, lparam):
|
||||||
|
self.refresh_icon()
|
||||||
|
|
||||||
|
def destroy(self, hwnd, msg, wparam, lparam):
|
||||||
|
if self.on_quit: self.on_quit(self)
|
||||||
|
nid = (self.hwnd, 0)
|
||||||
|
win32gui.Shell_NotifyIcon(win32gui.NIM_DELETE, nid)
|
||||||
|
win32gui.PostQuitMessage(0) # Terminate the app.
|
||||||
|
|
||||||
|
def notify(self, hwnd, msg, wparam, lparam):
|
||||||
|
if lparam == win32con.WM_LBUTTONDBLCLK:
|
||||||
|
self.execute_menu_option(self.default_menu_index + self.FIRST_ID)
|
||||||
|
elif lparam == win32con.WM_RBUTTONUP:
|
||||||
|
self.show_menu()
|
||||||
|
elif lparam == win32con.WM_LBUTTONUP:
|
||||||
|
pass
|
||||||
|
return True
|
||||||
|
|
||||||
|
def show_menu(self):
|
||||||
|
menu = win32gui.CreatePopupMenu()
|
||||||
|
self.create_menu(menu, self.menu_options)
|
||||||
|
# win32gui.SetMenuDefaultItem(menu, 1000, 0)
|
||||||
|
|
||||||
|
pos = win32gui.GetCursorPos()
|
||||||
|
# See http://msdn.microsoft.com/library/default.asp?url=/library/en-us/winui/menus_0hdi.asp
|
||||||
|
win32gui.SetForegroundWindow(self.hwnd)
|
||||||
|
win32gui.TrackPopupMenu(menu,
|
||||||
|
win32con.TPM_LEFTALIGN,
|
||||||
|
pos[0],
|
||||||
|
pos[1],
|
||||||
|
0,
|
||||||
|
self.hwnd,
|
||||||
|
None)
|
||||||
|
win32gui.PostMessage(self.hwnd, win32con.WM_NULL, 0, 0)
|
||||||
|
|
||||||
|
def create_menu(self, menu, menu_options):
|
||||||
|
for option_text, option_icon, option_action, option_id in menu_options[::-1]:
|
||||||
|
if option_icon:
|
||||||
|
option_icon = self.prep_menu_icon(option_icon)
|
||||||
|
|
||||||
|
if option_id in self.menu_actions_by_id:
|
||||||
|
item, extras = win32gui_struct.PackMENUITEMINFO(text=option_text,
|
||||||
|
hbmpItem=option_icon,
|
||||||
|
wID=option_id)
|
||||||
|
win32gui.InsertMenuItem(menu, 0, 1, item)
|
||||||
|
else:
|
||||||
|
submenu = win32gui.CreatePopupMenu()
|
||||||
|
self.create_menu(submenu, option_action)
|
||||||
|
item, extras = win32gui_struct.PackMENUITEMINFO(text=option_text,
|
||||||
|
hbmpItem=option_icon,
|
||||||
|
hSubMenu=submenu)
|
||||||
|
win32gui.InsertMenuItem(menu, 0, 1, item)
|
||||||
|
|
||||||
|
def prep_menu_icon(self, icon):
|
||||||
|
# First load the icon.
|
||||||
|
ico_x = win32api.GetSystemMetrics(win32con.SM_CXSMICON)
|
||||||
|
ico_y = win32api.GetSystemMetrics(win32con.SM_CYSMICON)
|
||||||
|
hicon = win32gui.LoadImage(0, icon, win32con.IMAGE_ICON, ico_x, ico_y, win32con.LR_LOADFROMFILE)
|
||||||
|
|
||||||
|
hdcBitmap = win32gui.CreateCompatibleDC(0)
|
||||||
|
hdcScreen = win32gui.GetDC(0)
|
||||||
|
hbm = win32gui.CreateCompatibleBitmap(hdcScreen, ico_x, ico_y)
|
||||||
|
hbmOld = win32gui.SelectObject(hdcBitmap, hbm)
|
||||||
|
# Fill the background.
|
||||||
|
brush = win32gui.GetSysColorBrush(win32con.COLOR_MENU)
|
||||||
|
win32gui.FillRect(hdcBitmap, (0, 0, 16, 16), brush)
|
||||||
|
# unclear if brush needs to be feed. Best clue I can find is:
|
||||||
|
# "GetSysColorBrush returns a cached brush instead of allocating a new
|
||||||
|
# one." - implies no DeleteObject
|
||||||
|
# draw the icon
|
||||||
|
win32gui.DrawIconEx(hdcBitmap, 0, 0, hicon, ico_x, ico_y, 0, 0, win32con.DI_NORMAL)
|
||||||
|
win32gui.SelectObject(hdcBitmap, hbmOld)
|
||||||
|
win32gui.DeleteDC(hdcBitmap)
|
||||||
|
|
||||||
|
return hbm
|
||||||
|
|
||||||
|
def command(self, hwnd, msg, wparam, lparam):
|
||||||
|
id = win32gui.LOWORD(wparam)
|
||||||
|
self.execute_menu_option(id)
|
||||||
|
|
||||||
|
def execute_menu_option(self, id):
|
||||||
|
menu_action = self.menu_actions_by_id[id]
|
||||||
|
if menu_action == self.QUIT:
|
||||||
|
self.exit_app()
|
||||||
|
else:
|
||||||
|
menu_action(self)
|
||||||
|
|
||||||
|
def exit_app(self):
|
||||||
|
win32gui.DestroyWindow(self.hwnd)
|
||||||
|
|
||||||
|
|
||||||
|
def main():
|
||||||
|
def LBRYApp():
|
||||||
|
return SysTrayIcon(icon, hover_text, menu_options, on_quit=stop)
|
||||||
|
|
||||||
|
def openui_(sender):
|
||||||
|
webbrowser.open(UI_ADDRESS)
|
||||||
|
|
||||||
|
def replyToApplicationShouldTerminate_():
|
||||||
|
try:
|
||||||
|
reactor.stop()
|
||||||
|
except error.ReactorNotRunning:
|
||||||
|
log.debug('Reactor already stopped')
|
||||||
|
|
||||||
|
def stop(sysTrayIcon):
|
||||||
|
replyToApplicationShouldTerminate_()
|
||||||
|
|
||||||
|
if getattr(sys, 'frozen', False) and os.name == "nt":
|
||||||
|
icon = os.path.join(os.path.dirname(sys.executable), ICON_PATH, 'lbry16.ico')
|
||||||
|
else:
|
||||||
|
icon = os.path.join(ICON_PATH, 'lbry16.ico')
|
||||||
|
|
||||||
|
hover_text = APP_NAME
|
||||||
|
menu_options = (('Open', icon, openui_),)
|
||||||
|
|
||||||
|
if not test_internet_connection():
|
||||||
|
log.warn('No Internet Connection')
|
||||||
|
sys.exit(1)
|
||||||
|
|
||||||
|
systray_thread = threading.Thread(target=LBRYApp)
|
||||||
|
systray_thread.daemon = True
|
||||||
|
systray_thread.start()
|
||||||
|
|
||||||
|
lbry = LBRYDaemonServer()
|
||||||
|
d = lbry.start()
|
||||||
|
d.addCallback(lambda _: webbrowser.open(UI_ADDRESS))
|
||||||
|
lbrynet_server = server.Site(lbry.root)
|
||||||
|
lbrynet_server.requestFactory = LBRYDaemonRequest
|
||||||
|
reactor.listenTCP(API_PORT, lbrynet_server, interface=API_INTERFACE)
|
||||||
|
reactor.run()
|
||||||
|
|
||||||
|
if __name__ == '__main__':
|
||||||
|
main()
|
BIN
packaging/windows/lbry-win32-app/icons/lbry128.ico
Normal file
BIN
packaging/windows/lbry-win32-app/icons/lbry128.ico
Normal file
Binary file not shown.
After Width: | Height: | Size: 97 KiB |
BIN
packaging/windows/lbry-win32-app/icons/lbry16.ico
Normal file
BIN
packaging/windows/lbry-win32-app/icons/lbry16.ico
Normal file
Binary file not shown.
After Width: | Height: | Size: 1.1 KiB |
BIN
packaging/windows/lbry-win32-app/icons/lbry256.ico
Normal file
BIN
packaging/windows/lbry-win32-app/icons/lbry256.ico
Normal file
Binary file not shown.
After Width: | Height: | Size: 361 KiB |
BIN
packaging/windows/lbry-win32-app/icons/lbry32.ico
Normal file
BIN
packaging/windows/lbry-win32-app/icons/lbry32.ico
Normal file
Binary file not shown.
After Width: | Height: | Size: 5.3 KiB |
BIN
packaging/windows/lbry-win32-app/icons/lbry48.ico
Normal file
BIN
packaging/windows/lbry-win32-app/icons/lbry48.ico
Normal file
Binary file not shown.
After Width: | Height: | Size: 15 KiB |
BIN
packaging/windows/lbry-win32-app/icons/lbry96.ico
Normal file
BIN
packaging/windows/lbry-win32-app/icons/lbry96.ico
Normal file
Binary file not shown.
After Width: | Height: | Size: 31 KiB |
BIN
packaging/windows/libs/gmpy-1.17-cp27-none-win32.whl
Normal file
BIN
packaging/windows/libs/gmpy-1.17-cp27-none-win32.whl
Normal file
Binary file not shown.
140
setup_win32.py
140
setup_win32.py
|
@ -3,12 +3,25 @@
|
||||||
To create local builds and distributable .msi, run the following command:
|
To create local builds and distributable .msi, run the following command:
|
||||||
python setup_win32.py build bdist_msi
|
python setup_win32.py build bdist_msi
|
||||||
"""
|
"""
|
||||||
|
import opcode
|
||||||
import os
|
import os
|
||||||
|
import pkg_resources
|
||||||
import sys
|
import sys
|
||||||
|
|
||||||
from cx_Freeze import setup, Executable
|
from cx_Freeze import setup, Executable
|
||||||
import requests.certs
|
import requests.certs
|
||||||
|
|
||||||
|
from lbrynet import __version__
|
||||||
|
|
||||||
|
win_icon = os.path.join('packaging', 'windows', 'lbry-win32-app', 'icons', 'lbry256.ico')
|
||||||
|
wordlist_path = pkg_resources.resource_filename('lbryum', 'wordlist')
|
||||||
|
|
||||||
|
base_dir = os.path.abspath(os.path.dirname(__file__))
|
||||||
|
|
||||||
|
# Allow virtualenv to find distutils of base python installation
|
||||||
|
distutils_path = os.path.join(os.path.dirname(opcode.__file__), 'distutils')
|
||||||
|
|
||||||
|
|
||||||
def find_data_file(filename):
|
def find_data_file(filename):
|
||||||
if getattr(sys, 'frozen', False):
|
if getattr(sys, 'frozen', False):
|
||||||
# The application is frozen
|
# The application is frozen
|
||||||
|
@ -19,58 +32,102 @@ def find_data_file(filename):
|
||||||
data_dir = os.path.dirname(__file__)
|
data_dir = os.path.dirname(__file__)
|
||||||
return os.path.join(data_dir, filename)
|
return os.path.join(data_dir, filename)
|
||||||
|
|
||||||
shortcut_table = [
|
console_scripts = ['lbrynet-stdin-uploader = lbrynet.lbrynet_console.LBRYStdinUploader:launch_stdin_uploader',
|
||||||
('DesktopShortcut', # Shortcut
|
'lbrynet-stdout-downloader = lbrynet.lbrynet_console.LBRYStdoutDownloader:launch_stdout_downloader',
|
||||||
'DesktopFolder', # Directory
|
'lbrynet-create-network = lbrynet.create_network:main',
|
||||||
'LBRY', # Name
|
'lbrynet-launch-node = lbrynet.dht.node:main',
|
||||||
'TARGETDIR', # Component
|
'lbrynet-launch-rpc-node = lbrynet.rpc_node:main',
|
||||||
'[TARGETDIR]\LBRY.exe', # Target
|
'lbrynet-rpc-node-cli = lbrynet.node_rpc_cli:main',
|
||||||
None, # Arguments
|
'lbrynet-lookup-hosts-for-hash = lbrynet.dht_scripts:get_hosts_for_hash_in_dht',
|
||||||
None, # Description
|
'lbrynet-announce_hash_to_dht = lbrynet.dht_scripts:announce_hash_to_dht',
|
||||||
None, # Hotkey
|
'lbrynet-daemon = lbrynet.lbrynet_daemon.LBRYDaemonControl:start',
|
||||||
os.path.join('lbrynet', 'lbrynet_gui', 'lbry-dark-icon.ico'), # Icon
|
'stop-lbrynet-daemon = lbrynet.lbrynet_daemon.LBRYDaemonControl:stop',
|
||||||
None, # IconIndex
|
'lbrynet-cli = lbrynet.lbrynet_daemon.LBRYDaemonCLI:main']
|
||||||
None, # ShowCmd
|
|
||||||
'TARGETDIR', # WkDir
|
|
||||||
),
|
|
||||||
]
|
|
||||||
|
|
||||||
# Now create the table dictionary
|
# shortcut_table = [
|
||||||
msi_data = {'Shortcut': shortcut_table}
|
# ('DesktopShortcut', # Shortcut
|
||||||
|
# 'DesktopFolder', # Directory
|
||||||
|
# 'LBRY 1', # Name
|
||||||
|
# 'TARGETDIR', # Component
|
||||||
|
# '[TARGETDIR]\LBRY.exe', # Target
|
||||||
|
# None, # Arguments
|
||||||
|
# None, # Description
|
||||||
|
# None, # Hotkey
|
||||||
|
# win_icon, # Icon
|
||||||
|
# None, # IconIndex
|
||||||
|
# None, # ShowCmd
|
||||||
|
# 'TARGETDIR', # WkDir
|
||||||
|
# ),
|
||||||
|
# ]
|
||||||
|
#
|
||||||
|
# # Now create the table dictionary
|
||||||
|
# msi_data = {'Shortcut': shortcut_table}
|
||||||
|
|
||||||
bdist_msi_options = {
|
bdist_msi_options = {
|
||||||
'upgrade_code': '{66620F3A-DC3A-11E2-B341-002219E9B01F}',
|
# 'upgrade_code': '{66620F3A-DC3A-11E2-B341-002219E9B01F}',
|
||||||
'add_to_path': False,
|
'add_to_path': False,
|
||||||
'initial_target_dir': r'[LocalAppDataFolder]\LBRY',
|
'initial_target_dir': r'[LocalAppDataFolder]\LBRY',
|
||||||
'data': msi_data,
|
# 'data': msi_data,
|
||||||
}
|
}
|
||||||
|
|
||||||
build_exe_options = {
|
build_exe_options = {
|
||||||
'include_msvcr': True,
|
'include_msvcr': True,
|
||||||
'includes': [],
|
'includes': [],
|
||||||
'packages': ['six', 'os', 'twisted', 'miniupnpc', 'unqlite', 'seccure',
|
'packages': ['cython',
|
||||||
'requests', 'bitcoinrpc', 'txjsonrpc', 'win32api', 'Crypto',
|
'twisted',
|
||||||
'gmpy', 'yapsy', 'lbryum', 'google.protobuf'],
|
'yapsy',
|
||||||
'excludes': ['zope.interface._zope_interface_coptimizations'],
|
'appdirs',
|
||||||
'include_files': [os.path.join('lbrynet', 'lbrynet_gui', 'close.gif'),
|
'argparse',
|
||||||
os.path.join('lbrynet', 'lbrynet_gui', 'close1.png'),
|
'base58',
|
||||||
os.path.join('lbrynet', 'lbrynet_gui', 'close2.gif'),
|
'colorama',
|
||||||
os.path.join('lbrynet', 'lbrynet_gui', 'drop_down.gif'),
|
'cx_Freeze',
|
||||||
os.path.join('lbrynet', 'lbrynet_gui', 'hide_options.gif'),
|
'dns',
|
||||||
os.path.join('lbrynet', 'lbrynet_gui', 'lbry-dark-242x80.gif'),
|
'ecdsa',
|
||||||
os.path.join('lbrynet', 'lbrynet_gui', 'lbry-dark-icon.ico'),
|
'gmpy',
|
||||||
os.path.join('lbrynet', 'lbrynet_gui', 'lbry-dark-icon.xbm'),
|
'googlefinance',
|
||||||
os.path.join('lbrynet', 'lbrynet_gui', 'show_options.gif'),
|
'jsonrpc',
|
||||||
os.path.join('lbrycrdd.exe'), # Not included in repo
|
'jsonrpclib',
|
||||||
os.path.join('lbrycrd-cli.exe'), # Not included in repo
|
'lbryum',
|
||||||
(requests.certs.where(), 'cacert.pem'),
|
'loggly',
|
||||||
|
'miniupnpc',
|
||||||
|
'pbkdf2',
|
||||||
|
'google.protobuf',
|
||||||
|
'Crypto',
|
||||||
|
'bitcoinrpc',
|
||||||
|
'win32api',
|
||||||
|
'qrcode',
|
||||||
|
'requests',
|
||||||
|
'requests_futures',
|
||||||
|
'seccure',
|
||||||
|
'simplejson',
|
||||||
|
'six',
|
||||||
|
'aes',
|
||||||
|
'txjsonrpc',
|
||||||
|
'unqlite',
|
||||||
|
'wsgiref',
|
||||||
|
'zope.interface',
|
||||||
|
'os',
|
||||||
|
'pkg_resources'
|
||||||
|
],
|
||||||
|
'excludes': ['distutils', 'collections.sys', 'collections._weakref', 'collections.abc',
|
||||||
|
'Tkinter', 'tk', 'tcl', 'PyQt4', 'nose', 'mock'
|
||||||
|
'zope.interface._zope_interface_coptimizations'],
|
||||||
|
'include_files': [(distutils_path, 'distutils'), (requests.certs.where(), 'cacert.pem'),
|
||||||
|
(os.path.join('packaging', 'windows', 'lbry-win32-app', 'icons', 'lbry16.ico'),
|
||||||
|
os.path.join('icons', 'lbry16.ico')),
|
||||||
|
(os.path.join(wordlist_path, 'chinese_simplified.txt'),
|
||||||
|
os.path.join('wordlist', 'chinese_simplified.txt')),
|
||||||
|
(os.path.join(wordlist_path, 'english.txt'), os.path.join('wordlist', 'english.txt')),
|
||||||
|
(os.path.join(wordlist_path, 'japanese.txt'), os.path.join('wordlist', 'japanese.txt')),
|
||||||
|
(os.path.join(wordlist_path, 'portuguese.txt'), os.path.join('wordlist', 'portuguese.txt')),
|
||||||
|
(os.path.join(wordlist_path, 'spanish.txt'), os.path.join('wordlist', 'spanish.txt'))
|
||||||
],
|
],
|
||||||
'namespace_packages': ['zope']}
|
'namespace_packages': ['zope', 'google']}
|
||||||
|
|
||||||
exe = Executable(
|
exe = Executable(
|
||||||
script=os.path.join('lbrynet', 'lbrynet_gui', 'gui.py'),
|
script=os.path.join('packaging', 'windows', 'lbry-win32-app', 'LBRYWin32App.py'),
|
||||||
base='Win32GUI',
|
base='Win32GUI',
|
||||||
icon=os.path.join('lbrynet', 'lbrynet_gui', 'lbry-dark-icon.ico'),
|
icon=win_icon,
|
||||||
compress=True,
|
compress=True,
|
||||||
shortcutName='LBRY',
|
shortcutName='LBRY',
|
||||||
shortcutDir='DesktopFolder',
|
shortcutDir='DesktopFolder',
|
||||||
|
@ -80,11 +137,12 @@ exe = Executable(
|
||||||
|
|
||||||
setup(
|
setup(
|
||||||
name='LBRY',
|
name='LBRY',
|
||||||
version='0.0.4',
|
version=__version__,
|
||||||
description='A fully decentralized network for distributing data',
|
description='A decentralized media library and marketplace',
|
||||||
url='lbry.io',
|
url='lbry.io',
|
||||||
author='',
|
author='LBRY, Inc.',
|
||||||
keywords='LBRY',
|
keywords='LBRY',
|
||||||
|
data_files=[],
|
||||||
options={'build_exe': build_exe_options,
|
options={'build_exe': build_exe_options,
|
||||||
'bdist_msi': bdist_msi_options},
|
'bdist_msi': bdist_msi_options},
|
||||||
executables=[exe],
|
executables=[exe],
|
||||||
|
|
Loading…
Reference in a new issue