setup.py and fixes

This commit is contained in:
ingvar1995 2016-07-05 21:43:51 +03:00
parent 88e9317a41
commit 1c788a73c6
14 changed files with 122 additions and 28 deletions

6
.gitignore vendored
View file

@ -15,3 +15,9 @@ src/libs
src/build src/build
src/dist src/dist
*.spec *.spec
dist/
/src/avatars
src/__pycache__
/*.egg-info
/*.egg

17
MANIFEST.in Normal file
View file

@ -0,0 +1,17 @@
include src/images/*.png
include src/images/*.ico
include src/images/*.gif
include src/sounds/*.wav
include src/stickers/tox/*.png
include src/smileys/default/*.png
include src/smileys/default/config.json
include src/smileys/animated/*.gif
include src/smileys/animated/config.json
include src/smileys/starwars/*.gif
include src/smileys/starwars/*.png
include src/smileys/starwars/config.json
include src/styles/style.qss
include src/translations/*.qm
include src/libs/libtox.dll
include src/libs/libsodium.a

View file

@ -3,6 +3,22 @@
## Use precompiled binary: ## Use precompiled binary:
[Check our releases page](https://github.com/xveduk/toxygen/releases) [Check our releases page](https://github.com/xveduk/toxygen/releases)
##Using pip3
### Windows (32-bit interpreter)
``pip3.4 install toxygen``
Run app using ``toxygen`` command.
##Linux
1. Install [toxcore](https://github.com/irungentoo/toxcore/blob/master/INSTALL.md) with toxav support in your system (install in /usr/lib/)
2. Install PortAudio:
``sudo apt-get install portaudio19-dev``
3. Install toxygen:
``sudo pip3.4 install toxygen``
4 Run toxygen using ``toxygen`` command.
## From source code (recommended for developers) ## From source code (recommended for developers)
### Windows ### Windows

43
setup.py Normal file
View file

@ -0,0 +1,43 @@
from setuptools import setup
from setuptools.command.install import install
from platform import system
from ctypes import CDLL
class DownloadScript(install):
"""Install all required libs"""
def run(self):
OS = system()
if OS == 'Linux': # install libtoxcore
try:
libtoxcore = CDLL('libtoxcore.so')
libtoxencryptsave = CDLL('libtoxencryptsave.so')
libtoxav = CDLL('libtoxav.so')
except: # toxcore is not installed
pass
install.run(self)
setup(name='Toxygen',
version='0.2.1.50',
description='Toxygen - Tox client',
long_description='Toxygen is powerful Tox client written in Python3',
url='https://github.com/xveduk/toxygen/',
keywords='toxygen tox',
author='Ingvar',
license='GPL3',
package_dir={'': 'src'},
packages=['', 'plugins', 'styles'],
install_requires=['PyAudio', 'PySide', 'PySocks'],
include_package_data=True,
classifiers=[
'Programming Language :: Python :: 3 :: Only',
'Programming Language :: Python :: 3.3',
'Programming Language :: Python :: 3.4',
],
entry_points={
'console_scripts': ['toxygen=main:main'],
},
cmdclass={
'install': DownloadScript,
},
)

View file

@ -3,7 +3,7 @@ try:
except ImportError: except ImportError:
from PyQt4 import QtCore, QtGui from PyQt4 import QtCore, QtGui
import widgets import widgets
import profile import profile_
import util import util
import pyaudio import pyaudio
import wave import wave
@ -54,7 +54,7 @@ class IncomingCallWidget(widgets.CenteredWidget):
self.setWindowTitle(text) self.setWindowTitle(text)
self.name.setText(name) self.name.setText(name)
self.call_type.setText(text) self.call_type.setText(text)
pr = profile.Profile.get_instance() pr = profile_.Profile.get_instance()
self.accept_audio.clicked.connect(lambda: pr.accept_call(friend_number, True, False) or self.stop()) self.accept_audio.clicked.connect(lambda: pr.accept_call(friend_number, True, False) or self.stop())
# self.accept_video.clicked.connect(lambda: pr.start_call(friend_number, True, True)) # self.accept_video.clicked.connect(lambda: pr.start_call(friend_number, True, True))
self.decline.clicked.connect(lambda: pr.stop_call(friend_number, False) or self.stop()) self.decline.clicked.connect(lambda: pr.stop_call(friend_number, False) or self.stop())

View file

@ -4,7 +4,7 @@ except ImportError:
from PyQt4 import QtCore from PyQt4 import QtCore
from notifications import * from notifications import *
from settings import Settings from settings import Settings
from profile import Profile from profile_ import Profile
from toxcore_enums_and_consts import * from toxcore_enums_and_consts import *
from toxav_enums import * from toxav_enums import *
from tox import bin_to_string from tox import bin_to_string

View file

@ -3,7 +3,7 @@ try:
from PySide import QtCore, QtGui from PySide import QtCore, QtGui
except ImportError: except ImportError:
from PyQt4 import QtCore, QtGui from PyQt4 import QtCore, QtGui
import profile import profile_
from file_transfers import TOX_FILE_TRANSFER_STATE, PAUSED_FILE_TRANSFERS, DO_NOT_SHOW_ACCEPT_BUTTON, ACTIVE_FILE_TRANSFERS, SHOW_PROGRESS_BAR from file_transfers import TOX_FILE_TRANSFER_STATE, PAUSED_FILE_TRANSFERS, DO_NOT_SHOW_ACCEPT_BUTTON, ACTIVE_FILE_TRANSFERS, SHOW_PROGRESS_BAR
from util import curr_directory, convert_time, curr_time from util import curr_directory, convert_time, curr_time
from widgets import DataLabel, create_menu from widgets import DataLabel, create_menu
@ -339,7 +339,7 @@ class FileTransferItem(QtGui.QListWidget):
self.paused = False self.paused = False
def cancel_transfer(self, friend_number, file_number): def cancel_transfer(self, friend_number, file_number):
pr = profile.Profile.get_instance() pr = profile_.Profile.get_instance()
pr.cancel_transfer(friend_number, file_number) pr.cancel_transfer(friend_number, file_number)
self.setStyleSheet('QListWidget { border: 1px solid #B40404; }') self.setStyleSheet('QListWidget { border: 1px solid #B40404; }')
self.cancel.setVisible(False) self.cancel.setVisible(False)
@ -354,18 +354,18 @@ class FileTransferItem(QtGui.QListWidget):
QtGui.QFileDialog.ShowDirsOnly | QtGui.QFileDialog.DontUseNativeDialog) QtGui.QFileDialog.ShowDirsOnly | QtGui.QFileDialog.DontUseNativeDialog)
self.pb.setVisible(True) self.pb.setVisible(True)
if directory: if directory:
pr = profile.Profile.get_instance() pr = profile_.Profile.get_instance()
pr.accept_transfer(self, directory + '/' + self.saved_name, friend_number, file_number, size) pr.accept_transfer(self, directory + '/' + self.saved_name, friend_number, file_number, size)
self.button_update('pause') self.button_update('pause')
elif self.state == TOX_FILE_TRANSFER_STATE['PAUSED_BY_USER']: # resume elif self.state == TOX_FILE_TRANSFER_STATE['PAUSED_BY_USER']: # resume
self.paused = False self.paused = False
profile.Profile.get_instance().resume_transfer(friend_number, file_number) profile_.Profile.get_instance().resume_transfer(friend_number, file_number)
self.button_update('pause') self.button_update('pause')
self.state = TOX_FILE_TRANSFER_STATE['RUNNING'] self.state = TOX_FILE_TRANSFER_STATE['RUNNING']
else: # pause else: # pause
self.paused = True self.paused = True
self.state = TOX_FILE_TRANSFER_STATE['PAUSED_BY_USER'] self.state = TOX_FILE_TRANSFER_STATE['PAUSED_BY_USER']
profile.Profile.get_instance().pause_transfer(friend_number, file_number) profile_.Profile.get_instance().pause_transfer(friend_number, file_number)
self.button_update('resume') self.button_update('resume')
self.accept_or_pause.clearFocus() self.accept_or_pause.clearFocus()
@ -435,7 +435,7 @@ class UnsentFileItem(FileTransferItem):
movie.start() movie.start()
def cancel_transfer(self, *args): def cancel_transfer(self, *args):
pr = profile.Profile.get_instance() pr = profile_.Profile.get_instance()
pr.cancel_not_started_transfer(self._time) pr.cancel_not_started_transfer(self._time)

View file

@ -1,5 +1,6 @@
import sys import sys
from loginscreen import LoginScreen from loginscreen import LoginScreen
import profile_
from settings import * from settings import *
try: try:
from PySide import QtCore, QtGui from PySide import QtCore, QtGui
@ -7,13 +8,11 @@ except ImportError:
from PyQt4 import QtCore, QtGui from PyQt4 import QtCore, QtGui
from bootstrap import node_generator from bootstrap import node_generator
from mainscreen import MainWindow from mainscreen import MainWindow
from profile import tox_factory
from callbacks import init_callbacks from callbacks import init_callbacks
from util import curr_directory from util import curr_directory, program_version
import styles.style import styles.style
import toxencryptsave import toxencryptsave
from passwordscreen import PasswordScreen, UnlockAppScreen from passwordscreen import PasswordScreen, UnlockAppScreen
import profile
from plugin_support import PluginLoader from plugin_support import PluginLoader
@ -67,7 +66,7 @@ class Toxygen:
if encrypt_save.is_data_encrypted(data): if encrypt_save.is_data_encrypted(data):
data = self.enter_pass(data) data = self.enter_pass(data)
settings = Settings(name) settings = Settings(name)
self.tox = tox_factory(data, settings) self.tox = profile_.tox_factory(data, settings)
else: else:
auto_profile = Settings.get_auto_profile() auto_profile = Settings.get_auto_profile()
if not auto_profile[0]: if not auto_profile[0]:
@ -95,7 +94,7 @@ class Toxygen:
elif _login.t == 1: # create new profile elif _login.t == 1: # create new profile
_login.name = _login.name.strip() _login.name = _login.name.strip()
name = _login.name if _login.name else 'toxygen_user' name = _login.name if _login.name else 'toxygen_user'
self.tox = tox_factory() self.tox = profile_.tox_factory()
self.tox.self_set_name(bytes(_login.name, 'utf-8') if _login.name else b'Toxygen User') self.tox.self_set_name(bytes(_login.name, 'utf-8') if _login.name else b'Toxygen User')
self.tox.self_set_status_message(b'Toxing on Toxygen') self.tox.self_set_status_message(b'Toxing on Toxygen')
ProfileHelper(Settings.get_default_path(), name).save_profile(self.tox.get_savedata()) ProfileHelper(Settings.get_default_path(), name).save_profile(self.tox.get_savedata())
@ -112,14 +111,14 @@ class Toxygen:
if encrypt_save.is_data_encrypted(data): if encrypt_save.is_data_encrypted(data):
data = self.enter_pass(data) data = self.enter_pass(data)
settings = Settings(name) settings = Settings(name)
self.tox = tox_factory(data, settings) self.tox = profile_.tox_factory(data, settings)
else: else:
path, name = auto_profile path, name = auto_profile
data = ProfileHelper(path, name).open_profile() data = ProfileHelper(path, name).open_profile()
if encrypt_save.is_data_encrypted(data): if encrypt_save.is_data_encrypted(data):
data = self.enter_pass(data) data = self.enter_pass(data)
settings = Settings(name) settings = Settings(name)
self.tox = tox_factory(data, settings) self.tox = profile_.tox_factory(data, settings)
if Settings.is_active_profile(path, name): # profile is in use if Settings.is_active_profile(path, name): # profile is in use
reply = QtGui.QMessageBox.question(None, reply = QtGui.QMessageBox.question(None,
@ -147,12 +146,12 @@ class Toxygen:
class Menu(QtGui.QMenu): class Menu(QtGui.QMenu):
def newStatus(self, status): def newStatus(self, status):
profile.Profile.get_instance().set_status(status) profile_.Profile.get_instance().set_status(status)
self.aboutToShow() self.aboutToShow()
self.hide() self.hide()
def aboutToShow(self): def aboutToShow(self):
status = profile.Profile.get_instance().status status = profile_.Profile.get_instance().status
act = self.act act = self.act
if status is None or Settings.get_instance().locked: if status is None or Settings.get_instance().locked:
self.actions()[1].setVisible(False) self.actions()[1].setVisible(False)
@ -256,7 +255,7 @@ class Toxygen:
ProfileHelper.get_instance().save_profile(data) ProfileHelper.get_instance().save_profile(data)
del self.tox del self.tox
# create new tox instance # create new tox instance
self.tox = tox_factory(data, Settings.get_instance()) self.tox = profile_.tox_factory(data, Settings.get_instance())
# init thread # init thread
self.init = self.InitThread(self.tox, self.ms, self.tray) self.init = self.InitThread(self.tox, self.ms, self.tray)
self.init.start() self.init.start()
@ -355,9 +354,22 @@ class Toxygen:
return self.arr[self.num] return self.arr[self.num]
if __name__ == '__main__': def main():
if len(sys.argv) == 1: if len(sys.argv) == 1:
toxygen = Toxygen() toxygen = Toxygen()
else: # path to profile or tox: uri else: # path to profile or tox: uri or --version or --help
toxygen = Toxygen(sys.argv[1]) arg = sys.argv[1]
if arg == '--version':
print('Toxygen ' + program_version)
return
elif arg == '--help':
print('Usage:\ntoxygen path_to_profile\ntoxygen tox_id\ntoxygen --version')
return
else:
toxygen = Toxygen(arg)
toxygen.main() toxygen.main()
if __name__ == '__main__':
main()

View file

@ -1,7 +1,7 @@
# -*- coding: utf-8 -*- # -*- coding: utf-8 -*-
from menu import * from menu import *
from profile import * from profile_ import *
from list_items import * from list_items import *
from widgets import MultilineEdit, LineEdit from widgets import MultilineEdit, LineEdit
import plugin_support import plugin_support

View file

@ -3,7 +3,7 @@ try:
except ImportError: except ImportError:
from PyQt4 import QtCore, QtGui from PyQt4 import QtCore, QtGui
from widgets import RubberBand, create_menu, QRightClickButton, CenteredWidget from widgets import RubberBand, create_menu, QRightClickButton, CenteredWidget
from profile import Profile from profile_ import Profile
import smileys import smileys
import util import util

View file

@ -3,7 +3,7 @@ try:
except ImportError: except ImportError:
from PyQt4 import QtCore, QtGui from PyQt4 import QtCore, QtGui
from settings import * from settings import *
from profile import Profile from profile_ import Profile
from util import curr_directory from util import curr_directory
from widgets import CenteredWidget, DataLabel, LineEdit from widgets import CenteredWidget, DataLabel, LineEdit
import pyaudio import pyaudio

View file

@ -1,5 +1,5 @@
import util import util
import profile import profile_
import os import os
import importlib import importlib
import inspect import inspect
@ -12,7 +12,7 @@ class PluginLoader(util.Singleton):
def __init__(self, tox, settings): def __init__(self, tox, settings):
super().__init__() super().__init__()
self._profile = profile.Profile.get_instance() self._profile = profile_.Profile.get_instance()
self._settings = settings self._settings = settings
self._plugins = {} # dict. key - plugin unique short name, value - tuple (plugin instance, is active) self._plugins = {} # dict. key - plugin unique short name, value - tuple (plugin instance, is active)
self._tox = tox self._tox = tox

View file

@ -1,5 +1,5 @@
from src.bootstrap import node_generator from src.bootstrap import node_generator
from src.profile import * from src.profile_ import *
from src.settings import ProfileHelper from src.settings import ProfileHelper
from src.tox_dns import tox_dns from src.tox_dns import tox_dns
import src.toxencryptsave as encr import src.toxencryptsave as encr