コード例 #1
0
ファイル: project.py プロジェクト: sethfuller/sublimeless_zk
    def prepare(self):
        all_notes = self.get_all_note_files()
        samples_dir = os.path.join(base_dir(), 'zettelkasten')
        os.makedirs(self.folder, exist_ok=True)
        if not all_notes:
            # prepare welcome notes
            sample_notes = os.listdir(samples_dir)
            for s in sample_notes:
                shutil.copy2(os.path.join(samples_dir, s),
                             os.path.join(self.folder, s))
            self.welcome_note = os.path.join(self.folder,
                                             '201804141018 Welcome.md')
            self.show_welcome = True
        elif len(all_notes) == 1:
            self.welcome_note = all_notes[0]
            self.show_welcome = True

        if not os.path.exists(self.get_saved_searches_filn()):
            # prepare sample search
            shutil.copy2(os.path.join(base_dir(), 'saved_searches_default.md'),
                         self.get_saved_searches_filn())
        if not os.path.exists(self.get_search_results_filn()):
            # prepare welcome message
            shutil.copy2(os.path.join(base_dir(), 'search_results_default.md'),
                         self.get_search_results_filn())
        self.bibfile = Autobib.look_for_bibfile(self)
コード例 #2
0
ファイル: main.py プロジェクト: Earthpea1983/Futures_console
 def __init__(self):
     print("Program started.")
     BASE_DIR = settings.base_dir()
     app_dir = BASE_DIR + "/app"
     os.system("python {0}/sf_crawler.py".format(app_dir))
     os.system("python {0}/create_spot.py".format(app_dir))
     os.system("python {0}/logic.py".format(app_dir))
     os.system("python {0}/plot_figure.py".format(app_dir))
     print("Program closed.")
     input("Any key to exit.")
コード例 #3
0
ファイル: themes.py プロジェクト: sethfuller/sublimeless_zk
 def prepare_new_theme(new_theme_name, from_current_theme_name):
     if not new_theme_name.endswith('.json'):
         new_theme_name += '.json'
     if not from_current_theme_name.endswith('.json'):
         from_current_theme_name += '.json'
     dest = os.path.join(Theme.theme_folder(), new_theme_name)
     if not os.path.exists(dest):
         themes_src = os.path.join(base_dir(), 'themes')
         src = os.path.join(themes_src, from_current_theme_name)
         copy2(src, dest)
     return dest
コード例 #4
0
ファイル: themes.py プロジェクト: sethfuller/sublimeless_zk
 def prepare_theme_folder():
     always_deploy = ['saved_searches.json', 'search_results.json']
     if not os.path.exists(Theme.theme_folder()):
         os.makedirs(Theme.theme_folder(), exist_ok=True)
     # copy sample themes
     themes_src = os.path.join(base_dir(), 'themes')
     for f in os.listdir(themes_src):
         src = os.path.join(themes_src, f)
         dest = os.path.join(Theme.theme_folder(), f)
         if not os.path.exists(dest) or f in always_deploy:
             copy2(src, dest)
     return Theme.theme_folder()
コード例 #5
0
 def __init__(self):
     print("Figure plotting, please wait.")
     SqlControl.__init__(self)
     self.figure_dir = settings.base_dir(
     ) + '/figure'  #figure document location
     SqlControl.open_commodity_conn(self)
     spot_tb_name = "spot"  # spot table name         # the commodity table name
     spot = self.get_spot_name(
         spot_tb_name)  # to get the commodity spot name
     self.plot_figure(spot)  # use pygal to plot all the spot
     SqlControl.close_commodity_conn(self)
     print("Figures have been plotted.")
コード例 #6
0
ファイル: logic.py プロジェクト: Earthpea1983/Futures_console
 def __init__(self):
     print("Suggestion on the way.")
     SqlControl.__init__(self)
     BASE_DIR = settings.base_dir()
     self.excel_path = "{0}/database/Suggestion.xlsx".format(BASE_DIR)
     day = 33  # to get the 33day for calculation
     #sql start
     SqlControl.open_commodity_conn(self)
     SqlControl.open_sf_conn(self)
     #----------------------------------------------------------------------------------------------------------
     spot = self.get_spot()
     res = self.judge_spot(spot,
                           day)  # -1 for going down, 1 for up, 0 for ignore
     df_content = self.get_sf()  #get sf table content
     res = self.refromat_res(res, df_content)  # reformat the res with jicha
     self.storage_to_excel(res)
     #-----------------------------------------------------------------------------------------------------------
     #sql stop
     SqlControl.close_sf_conn(self)
     SqlControl.close_commodity_conn(self)
     print("Suggestion has been made!")
     print("=" * 20)
     print(res)
     print("=" * 20)
コード例 #7
0
 def __init__(self):
     self.BASE_DIR = settings.base_dir()    #Futures_Web DIR path
     self.sfdata_db_path = self.BASE_DIR + '/database' + '/Sfdata.db'      # database path of sf data
     self.commodity_db_path = self.BASE_DIR + '/database' + '/Commodity.db'  # database path of commodity
コード例 #8
0
    def __init__(self, parent):
        super().__init__()
        # Setup the window
        self.setWindowTitle("About Sublimeless_ZK")
        self.setWindowFlags(Qt.WindowStaysOnTopHint)
        # Setup the picture
        picture = QPixmap(os.path.join(base_dir(), 'app_picture.png'))

        self.picture = QLabel(self)
        self.picture.setPixmap(picture)
        self.picture.setGeometry(self.frameGeometry())
        self.picture.setScaledContents(False)
        # Assign events
        self.picture.mousePressEvent = self._close
        self.picture.mouseDoubleClickEvent = self._close
        # Initialize layout
        self.layout = QGridLayout()
        self.layout.addWidget(self.picture)
        label1 = QLabel(f'Sublimeless_ZK {version} ({prefix})')
        label2 = QLabel('(c) in 2018 by Rene Schallner')
        label3 = QPushButton('https://github.com/renerocksai')
        label1.setStyleSheet('font: 20px bold; color: yellow; top: 20px')
        label2.setStyleSheet('font: 16px bold; color: white')
        label3.setStyleSheet(
            'font: 14px bold; background-color: lightgrey; color: #fd971f; margin: 2px'
        )
        label3.setFlat(True)
        label3.setAutoFillBackground(False)
        label3.clicked.connect(self.url_clicked)
        #        label4 = QLabel('')
        #        label4.setStyleSheet('font: 30px')

        license_button = QPushButton('License...', parent=self)
        license_button.setStyleSheet('font: 10px; margin: 2px')
        license_button.clicked.connect(self.show_license)
        license_button.move(220, 150)

        vlay = QVBoxLayout()
        vlay.addWidget(label1, alignment=Qt.AlignHCenter)
        vlay.addWidget(label2, alignment=Qt.AlignHCenter)
        vlay.addWidget(label3, alignment=Qt.AlignHCenter)
        #        vlay.addWidget(label4)
        #vlay.addWidget(license_button, alignment=Qt.AlignHCenter)
        self.layout.addLayout(vlay, 0, 0, Qt.AlignCenter)
        self.layout.setSpacing(0)
        self.layout.setContentsMargins(QMargins(0, 0, 0, 0))
        self.setLayout(self.layout)
        # Set the log window icon
        self.setWindowIcon(QIcon(os.path.join(base_dir(), 'app_logo_64.png')))
        my_width = 512
        my_height = 200
        # Set the info window position
        parent_left = parent.geometry().left()
        parent_top = parent.geometry().top()
        parent_width = parent.geometry().width()
        parent_height = parent.geometry().height()
        my_left = parent_left + (parent_width / 2) - (my_width / 2)
        my_top = parent_top + (parent_height / 2) - (my_height / 2)
        self.setGeometry(QRect(my_left, my_top, my_width, my_height))
        self.setFixedSize(my_width, my_height)
        self.setWindowFlags(Qt.WindowStaysOnTopHint | Qt.Dialog
                            | Qt.FramelessWindowHint)
        self.setAttribute(Qt.WA_TranslucentBackground)
        self.parent_for_lic = parent