当前位置: 首页>>代码示例>>Python>>正文


Python util.curr_directory函数代码示例

本文整理汇总了Python中util.curr_directory函数的典型用法代码示例。如果您正苦于以下问题:Python curr_directory函数的具体用法?Python curr_directory怎么用?Python curr_directory使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了curr_directory函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: updater_available

def updater_available():
    if is_from_sources():
        return os.path.exists(util.curr_directory() + '/toxygen_updater.py')
    elif platform.system() == 'Windows':
        return os.path.exists(util.curr_directory() + '/toxygen_updater.exe')
    else:
        return os.path.exists(util.curr_directory() + '/toxygen_updater')
开发者ID:limalayla,项目名称:toxygen,代码行数:7,代码来源:updater.py

示例2: incoming_file_transfer

    def incoming_file_transfer(self, friend_number, file_number, size, file_name):
        """
        New transfer
        :param friend_number: number of friend who sent file
        :param file_number: file number
        :param size: file size in bytes
        :param file_name: file name without path
        """
        settings = Settings.get_instance()
        friend = self.get_friend_by_number(friend_number)
        auto = settings['allow_auto_accept'] and friend.tox_id in settings['auto_accept_from_friends']
        inline = (file_name == 'toxygen_inline.png' or file_name == 'utox-inline.png') and settings['allow_inline']
        if inline and size < 1024 * 1024:
            self.accept_transfer(None, '', friend_number, file_number, size, True)
            tm = TransferMessage(MESSAGE_OWNER['FRIEND'],
                                 time.time(),
                                 FILE_TRANSFER_MESSAGE_STATUS['INCOMING_STARTED'],
                                 size,
                                 file_name,
                                 friend_number,
                                 file_number)

        elif auto:
            path = settings['auto_accept_path'] or curr_directory()
            if not os.path.isdir(path):
                path = curr_directory()
            new_file_name, i = file_name, 1
            while os.path.isfile(path + '/' + new_file_name):  # file with same name already exists
                if '.' in file_name:  # has extension
                    d = file_name.rindex('.')
                else:  # no extension
                    d = len(file_name)
                new_file_name = file_name[:d] + ' ({})'.format(i) + file_name[d:]
                i += 1
            self.accept_transfer(None, path + '/' + new_file_name, friend_number, file_number, size)
            tm = TransferMessage(MESSAGE_OWNER['FRIEND'],
                                 time.time(),
                                 FILE_TRANSFER_MESSAGE_STATUS['INCOMING_STARTED'],
                                 size,
                                 new_file_name,
                                 friend_number,
                                 file_number)
        else:
            tm = TransferMessage(MESSAGE_OWNER['FRIEND'],
                                 time.time(),
                                 FILE_TRANSFER_MESSAGE_STATUS['INCOMING_NOT_STARTED'],
                                 size,
                                 file_name,
                                 friend_number,
                                 file_number)
        if friend_number == self.get_active_number():
            item = self.create_file_transfer_item(tm)
            if (inline and size < 1024 * 1024) or auto:
                self._file_transfers[(friend_number, file_number)].set_state_changed_handler(item.update)
            self._messages.scrollToBottom()
        else:
            friend.set_messages(True)

        friend.append_message(tm)
开发者ID:SergeyDjam,项目名称:toxygen,代码行数:59,代码来源:profile.py

示例3: get_default_settings

 def get_default_settings():
     return {
         'read': [],
         'write': [],
         'delete': [],
         'master': [],
         'folder': curr_directory(),
         'folder_save': curr_directory(),
         'auto_rights': 'r'
     }
开发者ID:milisarge,项目名称:toxfs,代码行数:10,代码来源:settings.py

示例4: __init__

 def __init__(self):
     if system() == 'Windows':
         self._libtoxcore = CDLL(util.curr_directory() + '/libs/libtox.dll')
     elif system() == 'Darwin':
         self._libtoxcore = CDLL('libtoxcore.dylib')
     else:
         # libtoxcore and libsodium must be installed in your os
         try:
             self._libtoxcore = CDLL('libtoxcore.so')
         except:
             self._libtoxcore = CDLL(util.curr_directory() + '/libs/libtoxcore.so')
开发者ID:limalayla,项目名称:toxygen,代码行数:11,代码来源:libtox.py

示例5: import_sm

    def import_sm(self):
        directory = QtGui.QFileDialog.getExistingDirectory(self,
                                                           QtGui.QApplication.translate("MainWindow",
                                                                                        'Choose folder with smiley pack',
                                                                                        None,
                                                                                        QtGui.QApplication.UnicodeUTF8),
                                                           curr_directory(),
                                                           QtGui.QFileDialog.ShowDirsOnly | QtGui.QFileDialog.DontUseNativeDialog)

        if directory:
            src = directory + '/'
            dest = curr_directory() + '/smileys/' + os.path.basename(directory) + '/'
            copy(src, dest)
开发者ID:supercoeus,项目名称:toxygen,代码行数:13,代码来源:menu.py

示例6: sound_notification

def sound_notification(t):
    """
    Plays sound notification
    :param t: type of notification
    """
    if t == SOUND_NOTIFICATION['MESSAGE']:
        f = curr_directory() + '/sounds/message.wav'
    elif t == SOUND_NOTIFICATION['FILE_TRANSFER']:
        f = curr_directory() + '/sounds/file.wav'
    else:
        f = curr_directory() + '/sounds/contact.wav'
    a = AudioFile(f)
    a.play()
    a.close()
开发者ID:SergeyDjam,项目名称:toxygen,代码行数:14,代码来源:notifications.py

示例7: get_params

def get_params(url, version):
    if is_from_sources():
        return ['python3', 'toxygen_updater.py', url, version]
    elif platform.system() == 'Windows':
        return [util.curr_directory() + '/toxygen_updater.exe', url, version]
    else:
        return ['./toxygen_updater', url, version]
开发者ID:limalayla,项目名称:toxygen,代码行数:7,代码来源:updater.py

示例8: __init__

    def __init__(self, text, time, user="", sent=True, message_type=TOX_MESSAGE_TYPE["NORMAL"], parent=None):
        QtGui.QWidget.__init__(self, parent)
        self.name = DataLabel(self)
        self.name.setGeometry(QtCore.QRect(2, 2, 95, 23))
        self.name.setTextFormat(QtCore.Qt.PlainText)
        font = QtGui.QFont()
        font.setFamily(settings.Settings.get_instance()["font"])
        font.setPointSize(11)
        font.setBold(True)
        self.name.setFont(font)
        self.name.setText(user)

        self.time = QtGui.QLabel(self)
        self.time.setGeometry(QtCore.QRect(parent.width() - 60, 0, 50, 25))
        font.setPointSize(10)
        font.setBold(False)
        self.time.setFont(font)
        self._time = time
        if not sent:
            movie = QtGui.QMovie(curr_directory() + "/images/spinner.gif")
            self.time.setMovie(movie)
            movie.start()
            self.t = True
        else:
            self.time.setText(convert_time(time))
            self.t = False

        self.message = MessageEdit(text, parent.width() - 160, message_type, self)
        if message_type != TOX_MESSAGE_TYPE["NORMAL"]:
            self.name.setStyleSheet("QLabel { color: #5CB3FF; }")
            self.message.setAlignment(QtCore.Qt.AlignCenter)
            self.time.setStyleSheet("QLabel { color: #5CB3FF; }")
        self.message.setGeometry(QtCore.QRect(100, 0, parent.width() - 160, self.message.height()))
        self.setFixedHeight(self.message.height())
开发者ID:toxygen-project,项目名称:toxygen,代码行数:34,代码来源:list_items.py

示例9: import_plugin

    def import_plugin(self):
        import util

        directory = QtGui.QFileDialog.getExistingDirectory(
            self,
            QtGui.QApplication.translate(
                "MainWindow", "Choose folder with plugin", None, QtGui.QApplication.UnicodeUTF8
            ),
            util.curr_directory(),
            QtGui.QFileDialog.ShowDirsOnly | QtGui.QFileDialog.DontUseNativeDialog,
        )
        if directory:
            src = directory + "/"
            dest = curr_directory() + "/plugins/"
            util.copy(src, dest)
            msgBox = QtGui.QMessageBox()
            msgBox.setWindowTitle(
                QtGui.QApplication.translate("MainWindow", "Restart Toxygen", None, QtGui.QApplication.UnicodeUTF8)
            )
            msgBox.setText(
                QtGui.QApplication.translate(
                    "MainWindow", "Plugin will be loaded after restart", None, QtGui.QApplication.UnicodeUTF8
                )
            )
            msgBox.exec_()
开发者ID:toxygen-project,项目名称:toxygen,代码行数:25,代码来源:mainscreen.py

示例10: run

            def run(self):
                class AudioFile:
                    chunk = 1024

                    def __init__(self, fl):
                        self.stop = False
                        self.fl = fl
                        self.wf = wave.open(self.fl, 'rb')
                        self.p = pyaudio.PyAudio()
                        self.stream = self.p.open(
                            format=self.p.get_format_from_width(self.wf.getsampwidth()),
                            channels=self.wf.getnchannels(),
                            rate=self.wf.getframerate(),
                            output=True)

                    def play(self):
                        while not self.stop:
                            data = self.wf.readframes(self.chunk)
                            while data and not self.stop:
                                self.stream.write(data)
                                data = self.wf.readframes(self.chunk)
                            self.wf = wave.open(self.fl, 'rb')

                    def close(self):
                        self.stream.close()
                        self.p.terminate()

                self.a = AudioFile(curr_directory() + '/sounds/call.wav')
                self.a.play()
                self.a.close()
开发者ID:toxygen-project,项目名称:toxygen,代码行数:30,代码来源:avwidgets.py

示例11: mouseReleaseEvent

    def mouseReleaseEvent(self, event):
        if event.button() == QtCore.Qt.LeftButton and self._resize_needed:  # scale inline
            if self._full_size:
                pixmap = self._pixmap.scaled(self._max_size, self._max_size, QtCore.Qt.KeepAspectRatio)
                self._image_label.setPixmap(pixmap)
                self.resize(QtCore.QSize(self._max_size, pixmap.height()))
                self._image_label.setGeometry(5, 0, pixmap.width(), pixmap.height())
            else:
                self._image_label.setPixmap(self._pixmap)
                self.resize(QtCore.QSize(self._max_size, self._pixmap.height() + 17))
                self._image_label.setGeometry(5, 0, self._pixmap.width(), self._pixmap.height())
            self._full_size = not self._full_size
            self._elem.setSizeHint(QtCore.QSize(self.width(), self.height()))
        elif event.button() == QtCore.Qt.RightButton:  # save inline
            directory = QtGui.QFileDialog.getExistingDirectory(
                self,
                QtGui.QApplication.translate("MainWindow", "Choose folder", None, QtGui.QApplication.UnicodeUTF8),
                curr_directory(),
                QtGui.QFileDialog.ShowDirsOnly | QtGui.QFileDialog.DontUseNativeDialog,
            )
            if directory:
                fl = QtCore.QFile(directory + "/toxygen_inline_" + curr_time().replace(":", "_") + ".png")
                self._pixmap.save(fl, "PNG")

        return False
开发者ID:toxygen-project,项目名称:toxygen,代码行数:25,代码来源:list_items.py

示例12: __init__

 def __init__(self, file_name, size, user, time, width, parent=None):
     super(UnsentFileItem, self).__init__(file_name, size, time, user, -1, -1,
                                          TOX_FILE_TRANSFER_STATE['PAUSED_BY_FRIEND'], width, parent)
     self._time = time
     self.pb.setVisible(False)
     movie = QtGui.QMovie(curr_directory() + '/images/spinner.gif')
     self.time.setMovie(movie)
     movie.start()
开发者ID:supercoeus,项目名称:toxygen,代码行数:8,代码来源:list_items.py

示例13: __init__

 def __init__(self):
     if system() == 'Linux':
         # libtoxcore and libsodium must be installed in your os
         self._libtoxcore = CDLL('libtoxcore.so')
     elif system() == 'Windows':
         self._libtoxcore = CDLL(util.curr_directory() + '/libs/libtox.dll')
     else:
         raise OSError('Unknown system.')
开发者ID:gourytch,项目名称:toxygen,代码行数:8,代码来源:libtox.py

示例14: copy_public_key

 def copy_public_key(self):
     clipboard = QtGui.QApplication.clipboard()
     profile = Profile.get_instance()
     clipboard.setText(profile.tox_id[:64])
     pixmap = QtGui.QPixmap(curr_directory() + '/images/accept.png')
     icon = QtGui.QIcon(pixmap)
     self.copy_pk.setIcon(icon)
     self.copy_pk.setIconSize(QtCore.QSize(10, 10))
开发者ID:supercoeus,项目名称:toxygen,代码行数:8,代码来源:menu.py

示例15: download

def download(version):
    os.chdir(util.curr_directory())
    url = get_url(version)
    params = get_params(url, version)
    print('Updating Toxygen')
    util.log('Updating Toxygen')
    try:
        subprocess.Popen(params)
    except Exception as ex:
        util.log('Exception: running updater failed with ' + str(ex))
开发者ID:limalayla,项目名称:toxygen,代码行数:10,代码来源:updater.py


注:本文中的util.curr_directory函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。