Skip to content

Commit

Permalink
Prepare for new release (1.0b0)
Browse files Browse the repository at this point in the history
  • Loading branch information
cmdvmd committed Aug 18, 2023
1 parent cccc26b commit bf700b9
Show file tree
Hide file tree
Showing 10 changed files with 114 additions and 44 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<img src="https://github.com/cmdvmd/common-clipboard/blob/main/logo.png" alt="Common Clipboard logo" height align="right"/>
<img src="https://github.com/cmdvmd/common-clipboard/blob/main/static/logo.png" alt="Common Clipboard logo" height align="right"/>

# Common Clipboard

Expand Down
27 changes: 18 additions & 9 deletions src/common_clipboard.py
Original file line number Diff line number Diff line change
@@ -1,11 +1,15 @@
"""
Main file for application
"""

import requests
import time
import win32clipboard as clipboard
import sys
import pickle
from socket import gethostbyname, gethostname
from threading import Thread
from multiprocessing import Process
from multiprocessing import Process, freeze_support
from multiprocessing.managers import BaseManager
from enum import Enum
from pystray import Icon, Menu, MenuItem
Expand Down Expand Up @@ -50,13 +54,16 @@ def find_server():


def get_copied_data():
for fmt in list(Format):
if clipboard.IsClipboardFormatAvailable(fmt.value):
clipboard.OpenClipboard()
data = clipboard.GetClipboardData(fmt.value)
clipboard.CloseClipboard()
return data, fmt
else:
try:
for fmt in list(Format):
if clipboard.IsClipboardFormatAvailable(fmt.value):
clipboard.OpenClipboard()
data = clipboard.GetClipboardData(fmt.value)
clipboard.CloseClipboard()
return data, fmt
else:
raise BaseException
except BaseException:
try:
return current_data, current_format
except NameError:
Expand Down Expand Up @@ -159,6 +166,8 @@ def get_menu_items():


if __name__ == '__main__':
freeze_support()

finding_server_delay = 1
listener_delay = 0.3

Expand Down Expand Up @@ -189,7 +198,7 @@ def get_menu_items():
format_to_type = {Format.TEXT: 'text', Format.IMAGE: 'image'}
type_to_format = {v: k for k, v in format_to_type.items()}

icon = Image.open('icon.ico')
icon = Image.open('systray_icon.ico')
systray = Icon('Common Clipboard', icon=icon, title='Common Clipboard', menu=Menu(get_menu_items))
systray.run_detached()

Expand Down
4 changes: 4 additions & 0 deletions src/device_list.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
"""
Class to keep track of connected devices
"""

import time


Expand Down
6 changes: 5 additions & 1 deletion src/port_editor.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
"""
GUI to edit the current port the application is running on
"""

import tkinter
from tkinter import ttk
from tkinter import messagebox
Expand All @@ -9,7 +13,7 @@ def __init__(self, current_port):

self.root = tkinter.Tk()
self.root.title('Edit Port')
self.root.iconbitmap('icon.ico')
self.root.iconbitmap('systray_icon.ico')
self.root.geometry('250x75')
self.root.resizable(False, False)
self.root.bind('<Return>', lambda _: self.apply_port_number())
Expand Down
4 changes: 4 additions & 0 deletions src/server.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
"""
File to handle server operations
"""

from flask import Flask, request, make_response, send_file
from io import BytesIO
from device_list import DeviceList
Expand Down
115 changes: 82 additions & 33 deletions src/setup.py
Original file line number Diff line number Diff line change
@@ -1,35 +1,84 @@
import sys
from cx_Freeze import setup, Executable

setup(
name='Common Clipboard',
author='cmdvmd',
version='0.1-alpha',
options={
'build_exe': {
'packages': [
'setuptools',
'requests',
'time',
'win32clipboard',
'socket',
'threading',
'enum',
'infi.systray',
'io',
'plyer'
],
'include_files': [
'static'
]
}
},
executables=[
Executable(
script='common_clipboard.py',
icon='icon.ico',
shortcut_name='Common Clipboard',
shortcut_dir='StartMenuFolder',
base='Win32GUI'
)
]
)

def generate_shortcut_table(shortcuts):
table = []
for location in shortcuts:
table.append((
f'{location}Shortcut',
f'{location}Folder',
'Common Clipboard',
'TARGETDIR',
'[TARGETDIR]common_clipboard.exe',
None,
None,
None,
None,
None,
None,
'TARGETDIR'
))
return table


if __name__ == '__main__':
setup(
name='common_clipboard',
description='Common Clipboard',
author='cmdvmd',
version='1.0b0',
options={
'build_exe': {
'packages': [
'setuptools',
'requests',
'time',
'win32clipboard',
'sys',
'pickle',
'socket',
'threading',
'multiprocessing',
'enum',
'pystray',
'PIL',
'io',
'flask',
'tkinter'
],
'excludes': [
'_distutils_hack',
'asyncio'
'concurrent',
'distutils',
'lib2to3',
'pkg_resources',
'pydoc_data',
'test',
'unittest',
'xml',
'xmlrpc',
],
'include_files': [
'systray_icon.ico'
],
'optimize': 2
},
'bdist_msi': {
'data': {
'Shortcut': generate_shortcut_table(['Desktop', 'StartMenu', 'Startup'])
}
}
},
executables=[
Executable(
script='common_clipboard.py',
icon='../static/icon.ico',
copyright='Copyright (c) cmdvmd 2023',
base='Win32GUI' if sys.platform == 'win32' else None,
shortcut_name='Common Clipboard',
shortcut_dir=''
)
]
)
File renamed without changes.
File renamed without changes.
Binary file added static/installer_icon.ico
Binary file not shown.
File renamed without changes

0 comments on commit bf700b9

Please sign in to comment.