Exemple #1
0
    def __init__(self, mypgpkeyid, pgppassphrase, pgp_dir, app_dir,
                 gpg_binary):
        self.mypgpkeyid = mypgpkeyid
        if get_os() == 'Windows':
            keyring = app_dir + '\pubkeys.gpg'
            # TODO - account for filenames with spaces on windows
        else:
            keyring = app_dir + '/pubkeys.gpg'

        if os.path.dirname(gpg_binary) == resource_path('binaries'):
            gpg_exec_dir = '--exec-path ' + resource_path(
                'binaries'
            )  # We are using the gpg binaries shipped with the Axis Mundi executable, make sure we set the helpers path
            self.gpg = gnupg.GPG(
                gpgbinary=gpg_binary,
                gnupghome=pgp_dir,
                options={
                    gpg_exec_dir, '--primary-keyring=' + keyring,
                    '--no-emit-version', '--keyserver=hkp://127.0.0.1:5000',
                    '--keyserver-options=auto-key-retrieve=yes,http-proxy=',
                    '--primary-keyring="' + keyring + '"'
                })  # removed '--auto-key-locate=keyserver',
        else:
            self.gpg = gnupg.GPG(
                gpgbinary=gpg_binary,
                gnupghome=pgp_dir,
                options={
                    '--primary-keyring=' + keyring, '--no-emit-version',
                    '--keyserver=hkp://127.0.0.1:5000',
                    '--keyserver-options=auto-key-retrieve=yes,http-proxy=',
                    '--primary-keyring="' + keyring + '"'
                })  # removed '--auto-key-locate=keyserver',
        self.pgp_passphrase = pgppassphrase
Exemple #2
0
    def __init__(self,
                 icon=None,
                 tunableDict=json.loads(
                     json.dumps({
                         "windowX": 20,
                         "windowY": 50,
                         "windowWidth": 500,
                         "windowHeight": 500,
                         "volume": 50
                     })),
                 title="Window"):
        """
        Initializing the UI for Forge

        Args:\n
            icon (string, optional): File path to the icon(.ico file) for the top left of the window. Defaults to None.
            tunableDict (JSON, optional): The tunable variables class for saving the windows position on close.
                                          Defaults to {"windowX": 10, "windowY": 10, "windowWidth": 500, "windowHeight": 500}.
            title (str, optional): The name of the window. Defaults to "Window".
        """

        stylesheet = open(utilities.resource_path("QTPie Style\\style.css"),
                          "r")
        styling = stylesheet.read()
        stylesheet.close()

        self.actions = Actions()

        self.tunableDict = tunableDict

        self.app = QtWidgets.QApplication(sys.argv)
        self.app.setStyleSheet(styling)
        self.app.aboutToQuit.connect(
            lambda: self.actions.onWindowClose(self.mainWindow))

        if icon:
            appIcon = PyQt5.QtGui.QIcon()
            appIcon.addFile(utilities.resource_path("icon.png"))
            self.app.setWindowIcon(appIcon)

        self.grid = QtWidgets.QGridLayout()
        self.gridCount = 0
        self.grid.setSpacing(0)
        self.grid.setContentsMargins(0, 0, 0, 0)
        self.space = self.addLabel([1, 1, 1, 1], txt="", name="Spacer")

        self.window = QTPieWidget()
        self.window.setLayout(self.grid)

        self.mainWindow = QTPieWindow()
        self.mainWindow.setGeometry(self.tunableDict["windowX"],
                                    self.tunableDict["windowY"],
                                    self.tunableDict["windowWidth"],
                                    self.tunableDict["windowHeight"])
        self.mainWindow.setWindowTitle(title)
        self.mainWindow.setCentralWidget(self.window)
Exemple #3
0
 def init_ui(self) -> None:
     new_project_btn = ModeButton(
         resource_path("./img/icon_new_project.png"),
         "Start New Project",
         on_click=self.on_click_new_project)
     self.layout.addWidget(new_project_btn, 0, 0, 1, 1)
     open_project_btn = ModeButton(
         resource_path("./img/icon_open_project.png"),
         "Open Project",
         on_click=self.on_click_open_project)
     self.layout.addWidget(open_project_btn, 0, 1, 1, 1)
     self.setLayout(self.layout)
Exemple #4
0
 def __init__(self, data: ConverterData, row: int,
              table: TranslationTableWidget) -> None:
     super().__init__()
     self.transcription = data.transcriptions[row]
     self.image_icon_no = QIcon(resource_path('./img/image-no.png'))
     self.image_icon_yes = QIcon(resource_path('./img/image-yes.png'))
     self.setIcon(self.image_icon_no)
     self.clicked.connect(partial(self.on_click_image, row))
     self.setSizePolicy(QSizePolicy.Expanding, QSizePolicy.Expanding)
     self.set_tooltip()
     self.right_click.connect(self.remove_image)
     self.table = table
     self.table.setCellWidget(row, TABLE_COLUMNS['Image'], self)
Exemple #5
0
    def __init__(self, mypgpkeyid, pgppassphrase, pgp_dir, app_dir, gpg_binary):
        self.mypgpkeyid = mypgpkeyid
        if get_os() == 'Windows':
            keyring = app_dir + '\pubkeys.gpg'
            # TODO - account for filenames with spaces on windows
        else:
            keyring = app_dir + '/pubkeys.gpg'

        if os.path.dirname(gpg_binary) == resource_path('binaries'):
            gpg_exec_dir = '--exec-path ' + resource_path('binaries')  # We are using the gpg binaries shipped with the Axis Mundi executable, make sure we set the helpers path
            self.gpg = gnupg.GPG(gpgbinary=gpg_binary,gnupghome=pgp_dir, options={gpg_exec_dir,'--primary-keyring=' + keyring, '--no-emit-version', '--keyserver=hkp://127.0.0.1:5000',
                                                         '--keyserver-options=auto-key-retrieve=yes,http-proxy=', '--primary-keyring="' + keyring + '"'})  # removed '--auto-key-locate=keyserver',
        else:
            self.gpg = gnupg.GPG(gpgbinary=gpg_binary,gnupghome=pgp_dir, options={'--primary-keyring=' + keyring, '--no-emit-version', '--keyserver=hkp://127.0.0.1:5000',
                                                         '--keyserver-options=auto-key-retrieve=yes,http-proxy=', '--primary-keyring="' + keyring + '"'})  # removed '--auto-key-locate=keyserver',
        self.pgp_passphrase = pgppassphrase
def main_window() -> tk.Tk:
    """
    Creates, sets up and returns an instance of Tk to use as the main
    window. Only call once.
    """
    root = tk.Tk()
    root.title("Scheduling")
    root.geometry("1000x800+0+0")
    root.iconbitmap(resource_path('wingicon.ico'))
    root.protocol("WM_DELETE_WINDOW", root.quit)
    style = ttk.Style()
    titles = ("Georgia", 14)
    regular = ("Helvetica", 10)
    style.configure("Title.TFrame", foreground="white", background="SteelBlue4", relief="flat", font=titles)
    style.configure("Title.TLabel", foreground="white", background="SteelBlue4", relief="raised", font=titles)
    style.configure("Title.TCheckbutton", foreground="white", background="SteelBlue4", relief="raised", font=titles)
    style.configure("Title.Toolbutton", foreground="white", background="SteelBlue4", relief="raised", font=titles)
    style.configure("Subtitle.TFrame", foreground="white", background="SteelBlue2", relief="flat", font=titles)
    style.configure("Subtitle.TLabel", foreground="white", background="SteelBlue2", relief="raised", font=titles)
    style.configure("Subtitle.TCheckbutton", foreground="white", background="SteelBlue2", relief="raised", font=titles)
    style.configure("Subtitle.Toolbutton", foreground="white", background="SteelBlue2", relief="raised", font=titles)
    style.configure("Basic.TFrame", relief="flat", font=regular)
    style.configure("Basic.TEntry", relief="flat", font=regular)
    style.configure("Basic.TLabel", relief="flat", justify=tk.LEFT, font=regular)
    style.configure("Basic.TButton", relief="flat", justify=tk.RIGHT, font=regular)
    style.configure("Basic.TCheckbutton", relief="flat", justify=tk.RIGHT, font=regular)
    return root
Exemple #7
0
class Tunable:
    """
    Tunable variables for Shift.
    """

    jsonFile = None
    tunableDict = None

    with open(utilities.resource_path(r"tunable.json")) as jsonFile:
        tunableDict = json.load(jsonFile)
    def __get_file(self, mode):
        fn = util.resource_path('connection.config')
        config_file = None
        try:
            config_file = open(fn, mode)
        except:
            open(fn, 'w').close()
            config_file = open(fn, mode)

        return config_file
Exemple #9
0
    def __get_file(self, mode):
        fn = util.resource_path('connection.config')
        config_file = None
        try:
            config_file = open(fn, mode)
        except:
            open(fn, 'w').close()
            config_file = open(fn, mode)

        return config_file
Exemple #10
0
 def __init__(self) -> None:
     super().__init__()
     self.addFile(resource_path('./img/icon-5-48.png'), QSize(48, 48))
     self.addFile(resource_path('./img/icon-5-96.png'), QSize(96, 96))
     self.addFile(resource_path('./img/icon-5-192.png'), QSize(192, 192))
     self.addFile(resource_path('./img/icon-5-256.png'), QSize(256, 256))
     self.addFile(resource_path('./img/icon-5-512.png'), QSize(512, 512))
     self.addFile(resource_path('./img/icon-5-1024.png'), QSize(1024, 1024))
Exemple #11
0
 def init_ui(self) -> None:
     self.setText(self.text)
     pixmap = QPixmap(resource_path(self.icon_path))
     icon = QIcon(pixmap)
     self.clicked.connect(self.on_click)
     self.setIcon(icon)
     self.setIconSize(QSize(100, 100))
     self.setAttribute(Qt.WA_TranslucentBackground)
     self.setStyleSheet("QPushButton {border-radius: 11px;"
                        "             background-color: whitesmoke;"
                        "             border: 1px solid lightgrey;"
                        "             padding: 5px;}\n"
                        "QPushButton:hover {background-color: lightgrey;}\n"
                        "QPushButton:pressed {background-color: grey;"
                        "                     color: whitesmoke}")
Exemple #12
0
 def init_ui(self) -> None:
     self.layout.setSizeConstraint(QLayout.SetFixedSize)
     logo_label = QLabel()
     logo_image = QPixmap(resource_path('./img/icon-5-128.png'))
     logo_label.setPixmap(logo_image)
     self.setWindowTitle('About')
     self.layout.addWidget(logo_label, 0, 1, 1, 1)
     name_label = QLabel(
         '<b>Hermes</b><br/><i>The Language Resource Creator</i></b>')
     name_label.setAlignment(Qt.AlignCenter)
     self.layout.addWidget(name_label, 1, 0, 1, 3)
     version_label = QLabel(f'Version {VERSION}')
     version_label.setAlignment(Qt.AlignCenter)
     self.layout.addWidget(version_label, 2, 0, 1, 3)
     link_label = QLabel(f'<a href="{REPO_LINK}">Report Issues Here</a>')
     link_label.setAlignment(Qt.AlignCenter)
     link_label.setTextFormat(Qt.RichText)
     link_label.setTextInteractionFlags(Qt.TextBrowserInteraction)
     link_label.setOpenExternalLinks(True)
     self.layout.addWidget(link_label, 3, 0, 1, 3)
     self.setLayout(self.layout)
     self.show()
Exemple #13
0
 def update_icon(self):
     if self.transcription and self.transcription.sample:
         image_icon = QIcon(resource_path('./img/play.png'))
     else:
         image_icon = QIcon(resource_path('./img/no_sample.png'))
     self.setIcon(image_icon)
Exemple #14
0
 def __init__(self):
     super(TaskBarIcon, self).__init__()
     self.set_icon(resource_path(TRAY_ICON))
     self.Bind(wx.EVT_TASKBAR_LEFT_DOWN, self.on_left_down)
Exemple #15
0
                       Signal,)
from themesmanager import ThemeManager
from filters import Filters
from utilities import (checksum_ok,
                       pop_up,
                       is_undef_freq,
                       is_undef_band,
                       format_numbers,
                       resource_path,
                       safe_cast,
                       is_mac_os)

# import default_imgs_rc

__VERSION__ = "3.0.1"
qt_creator_file = resource_path("artemis.ui")
Ui_MainWindow, _ = uic.loadUiType(qt_creator_file)


class Artemis(QMainWindow, Ui_MainWindow):
    """Main application class."""

    def __init__(self):
        """Set all connections of the application."""
        super().__init__()
        self.setupUi(self)
        self.setWindowTitle("ARTΣMIS " + __VERSION__)
        self.set_initial_size()
        self.closing = False
        self.download_window = DownloadWindow()
        self.download_window.complete.connect(self.show_downloaded_signals)
Exemple #16
0
 def __init__(self):
     super(TaskBarIcon, self).__init__()
     self.set_icon(resource_path(TRAY_ICON))
     self.Bind(wx.EVT_TASKBAR_LEFT_DOWN, self.on_left_down)
Exemple #17
0
    def __init__(self, *args):

        QApplication.__init__(self, *args)

        # initialize logging
        logging.basicConfig(filename='log.txt',
                            level=logging.INFO,
                            filemode='w',
                            format='%(asctime)s %(message)s')
        logging.info("Starting application.")

        # initialize user preferences
        preferences = Preferences()

        # initialize model
        market = GoxMarket(preferences)

        # initialize view
        self.view = View(preferences, market)

        self.connect(self, SIGNAL('lastWindowClosed()'), self.__quit)

    def __quit(self):
        self.view.stop()


if __name__ == '__main__':
    app = Application(sys.argv)
    app.setWindowIcon(QIcon(utilities.resource_path('bitcoin.png')))
    app.exec_()
Exemple #18
0
    '''

    def __init__(self, *args):

        QApplication.__init__(self, *args)

        # initialize logging
        logging.basicConfig(filename='log.txt', level=logging.INFO,
                            filemode='w',format='%(asctime)s %(message)s')
        logging.info("Starting application.")

        # initialize user preferences
        preferences = Preferences()

        # initialize model
        market = GoxMarket(preferences)

        # initialize view
        self.view = View(preferences, market)

        self.connect(self, SIGNAL('lastWindowClosed()'), self.__quit)

    def __quit(self):
        self.view.stop()


if __name__ == '__main__':
    app = Application(sys.argv)
    app.setWindowIcon(QIcon(utilities.resource_path('bitcoin.png')))
    app.exec_()
Exemple #19
0
        # initialize model (gox)
        #goxapi.FORCE_PROTOCOL = 'socketio'
        self.config = goxapi.GoxConfig("goxtool.ini")
        self.secret = goxapi.Secret(self.config)
        self.gox = goxapi.Gox(self.secret, self.config)

        
        self.strategy_object = stoploss.Strategy(self.gox)
                
        # initialize view
        self.view = View(self.gox, self.secret, self.logfile)
        self.view.log('Starting application.')

        # start connection to MtGox
        self.gox.start()
        
        self.connect(self, SIGNAL('lastWindowClosed()'), self.__quit)

    def __quit(self):
        self.gox.stop()
        self.logfile.close()




if __name__ == '__main__':
    app = Application(sys.argv)
    app.setWindowIcon(QIcon(resource_path('bitcoin.png')))
    app.exec_()
Exemple #20
0
from PyQt5 import uic
from PyQt5.QtCore import Qt, pyqtSlot, pyqtSignal
from PyQt5.QtWidgets import QWidget
from threads import DownloadThread, ThreadStatus
from utilities import pop_up, resource_path
from constants import Constants, Messages


Ui_Download_window, _ = uic.loadUiType(
    resource_path("download_db_window.ui")
)


class DownloadWindow(QWidget, Ui_Download_window):
    """Subclass QWidget and Ui_Download_window. It is the window displayed during the database download."""

    complete = pyqtSignal()
    closed = pyqtSignal()

    def __init__(self):
        """Initialize the window."""
        super().__init__()
        self.setupUi(self)
        self.setWindowFlags(
            # Qt.Window                |
            Qt.CustomizeWindowHint   |
            Qt.WindowTitleHint       |
            Qt.WindowCloseButtonHint |
            Qt.WindowStaysOnTopHint
        )